feat(YouTube Music - Hide action bar components): Limit the available versions of the Override Download action button setting to 7.16.53

This commit is contained in:
inotia00
2024-12-21 11:49:18 +09:00
parent 8e02716d95
commit f894327f0d
3 changed files with 10 additions and 111 deletions

View File

@ -7,10 +7,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import java.util.Map;
import app.revanced.extension.music.settings.Settings;
import app.revanced.extension.music.utils.VideoUtils;
@SuppressWarnings("unused")
public class ActionBarPatch {
@ -42,41 +39,6 @@ public class ActionBarPatch {
);
}
private static final String senderView = "com.google.android.libraries.youtube.rendering.elements.sender_view";
public static boolean inAppDownloadButtonOnClick(Map mMap) {
if (!Settings.EXTERNAL_DOWNLOADER_ACTION_BUTTON.get()) {
return false;
}
if (mMap == null || mMap.isEmpty()) {
return false;
}
if (!mMap.containsKey(senderView)) {
return false;
}
if (!(getLithoViewFromMap(mMap, senderView, View.class) instanceof View view)) {
return false;
}
VideoUtils.launchExternalDownloader();
return true;
}
/**
* Rest of the implementation added by patch.
*/
private static Object getLithoViewFromMap(Map mMap, Object mObject, Class<?> mClass) {
return null;
}
public static void inAppDownloadButtonOnClick(View view) {
if (!Settings.EXTERNAL_DOWNLOADER_ACTION_BUTTON.get()) {
return;
}
if (buttonType.equals(ActionButton.DOWNLOAD.name))
view.setOnClickListener(imageView -> VideoUtils.launchExternalDownloader());
}
public static void setButtonType(@NonNull Object obj) {
final String buttonType = obj.toString();