mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-08-30 02:56:21 +02:00
fix: old-quality-layout
patch
This commit is contained in:
parent
887bcff415
commit
5a5e8824c5
@ -0,0 +1,40 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
public class OldQualityLayoutPatch {
|
||||
// TODO: hide listView, OnHierarchyChange will not be triggered though
|
||||
public static void showOldQualityMenu(ListView listView)
|
||||
{
|
||||
if (!SettingsEnum.OLD_STYLE_QUALITY_SETTINGS.getBoolean()) return;
|
||||
|
||||
listView.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
|
||||
@Override
|
||||
public void onChildViewAdded(View parent, View child) {
|
||||
LogHelper.debug(OldQualityLayoutPatch.class, "Added: " + child);
|
||||
|
||||
final var indexOfAdvancedQualityMenuItem = 4;
|
||||
if (listView.indexOfChild(child) != indexOfAdvancedQualityMenuItem) return;
|
||||
|
||||
LogHelper.debug(OldQualityLayoutPatch.class, "Found advanced menu: " + child);
|
||||
|
||||
final var qualityItemMenuPosition = 4;
|
||||
listView.performItemClick(null, qualityItemMenuPosition, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildViewRemoved(View parent, View child) {}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class OldStyleQualityPatch {
|
||||
|
||||
//Used by app.revanced.patches.youtube.layout.oldqualitylayout.patch.OldQualityLayoutPatch
|
||||
public static boolean useOldStyleQualitySettings() {
|
||||
return SettingsEnum.OLD_STYLE_QUALITY_SETTINGS.getBoolean();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user