mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-19 08:17:33 +01:00
fix(YouTube - Restore old video quality menu): Show advanced quality menu in Shorts quality flyout (#632)
This commit is contained in:
parent
44dea1af4e
commit
77c9825b82
@ -5,9 +5,9 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
import app.revanced.integrations.shared.Logger;
|
||||
import app.revanced.integrations.youtube.patches.components.VideoQualityMenuFilterPatch;
|
||||
import app.revanced.integrations.youtube.settings.Settings;
|
||||
import app.revanced.integrations.shared.Logger;
|
||||
|
||||
/**
|
||||
* This patch contains the logic to show the old video quality menu.
|
||||
@ -44,7 +44,18 @@ public final class RestoreOldVideoQualityMenuPatch {
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point. Only used if spoofing to an old app version.
|
||||
* Injection point.
|
||||
*
|
||||
* Used to force the creation of the advanced menu item for the Shorts quality flyout.
|
||||
*/
|
||||
public static boolean forceAdvancedVideoQualityMenuCreation() {
|
||||
return Settings.RESTORE_OLD_VIDEO_QUALITY_MENU.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*
|
||||
* Used if spoofing to an old app version, and also used for the Shorts video quality flyout.
|
||||
*/
|
||||
public static void showOldVideoQualityMenu(final ListView listView) {
|
||||
if (!Settings.RESTORE_OLD_VIDEO_QUALITY_MENU.get()) return;
|
||||
@ -52,8 +63,7 @@ public final class RestoreOldVideoQualityMenuPatch {
|
||||
listView.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
|
||||
@Override
|
||||
public void onChildViewAdded(View parent, View child) {
|
||||
Logger.printDebug(() -> "Added listener to old type of quality menu");
|
||||
|
||||
try {
|
||||
parent.setVisibility(View.GONE);
|
||||
|
||||
final var indexOfAdvancedQualityMenuItem = 4;
|
||||
@ -63,6 +73,10 @@ public final class RestoreOldVideoQualityMenuPatch {
|
||||
|
||||
final var qualityItemMenuPosition = 4;
|
||||
listView.performItemClick(null, qualityItemMenuPosition, 0);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.printException(() -> "showOldVideoQualityMenu failure", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user