mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-06-01 19:06:29 +02:00
468dfac054
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
50 lines
1.4 KiB
Java
50 lines
1.4 KiB
Java
package app.revanced.integrations.youtube.videoplayer;
|
|
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import app.revanced.integrations.shared.Logger;
|
|
import app.revanced.integrations.youtube.patches.DownloadsPatch;
|
|
import app.revanced.integrations.youtube.settings.Settings;
|
|
|
|
@SuppressWarnings("unused")
|
|
public class ExternalDownloadButton extends BottomControlButton {
|
|
@Nullable
|
|
private static ExternalDownloadButton instance;
|
|
|
|
public ExternalDownloadButton(ViewGroup viewGroup) {
|
|
super(
|
|
viewGroup,
|
|
"revanced_external_download_button",
|
|
Settings.EXTERNAL_DOWNLOADER,
|
|
ExternalDownloadButton::onDownloadClick,
|
|
null
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Injection point.
|
|
*/
|
|
public static void initializeButton(View view) {
|
|
try {
|
|
instance = new ExternalDownloadButton((ViewGroup) view);
|
|
} catch (Exception ex) {
|
|
Logger.printException(() -> "initializeButton failure", ex);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Injection point.
|
|
*/
|
|
public static void changeVisibility(boolean showing) {
|
|
if (instance != null) instance.setVisibility(showing);
|
|
}
|
|
|
|
private static void onDownloadClick(View view) {
|
|
DownloadsPatch.launchExternalDownloader(view.getContext(), true);
|
|
}
|
|
}
|
|
|