Skip to content

Commit 809e013

Browse files
author
LisoUseInAIKyrios
committed
feat(YouTube - Hide player flyout menu items): Add option to hide quality flyout menu
1 parent 182829d commit 809e013

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import app.revanced.extension.shared.settings.Setting;
44
import app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch;
55
import app.revanced.extension.youtube.settings.Settings;
6-
import app.revanced.extension.youtube.shared.PlayerType;
6+
import app.revanced.extension.youtube.shared.ShortsPlayerState;
77

88
@SuppressWarnings("unused")
99
public class PlayerFlyoutMenuItemsFilter extends Filter {
@@ -20,17 +20,9 @@ public boolean isAvailable() {
2020
}
2121

2222
private final ByteArrayFilterGroupList flyoutFilterGroupList = new ByteArrayFilterGroupList();
23-
24-
private final ByteArrayFilterGroup exception;
2523
private final StringFilterGroup videoQualityMenuFooter;
2624

2725
public PlayerFlyoutMenuItemsFilter() {
28-
exception = new ByteArrayFilterGroup(
29-
// Whitelist Quality menu item when "Hide Additional settings menu" is enabled
30-
Settings.HIDE_PLAYER_FLYOUT_ADDITIONAL_SETTINGS,
31-
"quality_sheet"
32-
);
33-
3426
videoQualityMenuFooter = new StringFilterGroup(
3527
Settings.HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER,
3628
"quality_sheet_footer"
@@ -44,51 +36,55 @@ public PlayerFlyoutMenuItemsFilter() {
4436
flyoutFilterGroupList.addAll(
4537
new ByteArrayFilterGroup(
4638
Settings.HIDE_PLAYER_FLYOUT_CAPTIONS,
47-
"closed_caption"
39+
"closed_caption_"
4840
),
4941
new ByteArrayFilterGroup(
5042
Settings.HIDE_PLAYER_FLYOUT_ADDITIONAL_SETTINGS,
51-
"yt_outline_gear"
43+
"yt_outline_gear_"
5244
),
5345
new ByteArrayFilterGroup(
5446
Settings.HIDE_PLAYER_FLYOUT_LOOP_VIDEO,
5547
"yt_outline_arrow_repeat_1_"
5648
),
5749
new ByteArrayFilterGroup(
5850
Settings.HIDE_PLAYER_FLYOUT_AMBIENT_MODE,
59-
"yt_outline_screen_light"
51+
"yt_outline_screen_light_"
6052
),
6153
new ByteArrayFilterGroup(
6254
Settings.HIDE_PLAYER_FLYOUT_STABLE_VOLUME,
63-
"volume_stable"
55+
"volume_stable_"
6456
),
6557
new ByteArrayFilterGroup(
6658
Settings.HIDE_PLAYER_FLYOUT_HELP,
67-
"yt_outline_question_circle"
59+
"yt_outline_question_circle_"
6860
),
6961
new ByteArrayFilterGroup(
7062
Settings.HIDE_PLAYER_FLYOUT_MORE_INFO,
71-
"yt_outline_info_circle"
63+
"yt_outline_info_circle_"
7264
),
7365
new ByteArrayFilterGroup(
7466
Settings.HIDE_PLAYER_FLYOUT_LOCK_SCREEN,
75-
"yt_outline_lock"
67+
"yt_outline_lock_"
7668
),
7769
new ByteArrayFilterGroup(
7870
Settings.HIDE_PLAYER_FLYOUT_SPEED,
79-
"yt_outline_play_arrow_half_circle"
71+
"yt_outline_play_arrow_half_circle_"
8072
),
8173
new ByteArrayFilterGroup(
8274
Settings.HIDE_PLAYER_FLYOUT_AUDIO_TRACK,
83-
"yt_outline_person_radar"
75+
"yt_outline_person_radar_"
8476
),
8577
new ByteArrayFilterGroup(
8678
Settings.HIDE_PLAYER_FLYOUT_SLEEP_TIMER,
8779
"yt_outline_moon_z_"
8880
),
8981
new ByteArrayFilterGroup(
9082
Settings.HIDE_PLAYER_FLYOUT_WATCH_IN_VR,
91-
"yt_outline_vr"
83+
"yt_outline_vr_"
84+
),
85+
new ByteArrayFilterGroup(
86+
Settings.HIDE_PLAYER_FLYOUT_VIDEO_QUALITY,
87+
"yt_outline_adjust_"
9288
)
9389
);
9490
}
@@ -105,7 +101,7 @@ boolean isFiltered(String identifier, String path, byte[] buffer,
105101
}
106102

107103
// Shorts also use this player flyout panel
108-
if (PlayerType.getCurrent().isNoneOrHidden() || exception.check(buffer).isFiltered()) {
104+
if (ShortsPlayerState.isOpen()) {
109105
return false;
110106
}
111107

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ public class Settings extends BaseSettings {
244244
public static final BooleanSetting HIDE_PLAYER_FLYOUT_SPEED = new BooleanSetting("revanced_hide_player_flyout_speed", FALSE);
245245
public static final BooleanSetting HIDE_PLAYER_FLYOUT_STABLE_VOLUME = new BooleanSetting("revanced_hide_player_flyout_stable_volume", FALSE);
246246
public static final BooleanSetting HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER = new BooleanSetting("revanced_hide_player_flyout_video_quality_footer", FALSE);
247+
public static final BooleanSetting HIDE_PLAYER_FLYOUT_VIDEO_QUALITY = new BooleanSetting("revanced_hide_player_flyout_video_quality", FALSE);
247248
public static final BooleanSetting HIDE_PLAYER_FLYOUT_WATCH_IN_VR = new BooleanSetting("revanced_hide_player_flyout_watch_in_vr", TRUE);
248249

249250
// General layout

patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ val hidePlayerFlyoutMenuPatch = bytecodePatch(
5757
),
5858
SwitchPreference("revanced_hide_player_flyout_watch_in_vr"),
5959
SwitchPreference("revanced_hide_player_flyout_sleep_timer"),
60+
SwitchPreference("revanced_hide_player_flyout_video_quality"),
6061
SwitchPreference("revanced_hide_player_flyout_video_quality_footer"),
6162
),
6263
),

patches/src/main/resources/addresources/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,9 @@ To show the Audio track menu, change \'Spoof video streams\' to iOS TV"</string>
756756
<string name="revanced_hide_player_flyout_watch_in_vr_title">Hide Watch in VR</string>
757757
<string name="revanced_hide_player_flyout_watch_in_vr_summary_on">Watch in VR menu is hidden</string>
758758
<string name="revanced_hide_player_flyout_watch_in_vr_summary_off">Watch in VR menu is shown</string>
759+
<string name="revanced_hide_player_flyout_video_quality_title">Hide video quality menu</string>
760+
<string name="revanced_hide_player_flyout_video_quality_summary_on">Video quality menu is hidden</string>
761+
<string name="revanced_hide_player_flyout_video_quality_summary_off">Video quality menu is shown</string>
759762
<string name="revanced_hide_player_flyout_video_quality_footer_title">Hide video quality menu footer</string>
760763
<string name="revanced_hide_player_flyout_video_quality_footer_summary_on">Video quality menu footer is hidden</string>
761764
<string name="revanced_hide_player_flyout_video_quality_footer_summary_off">Video quality menu footer is shown</string>

0 commit comments

Comments
 (0)