From b91e932e65c04b1c1aee9a2f3dc3a73772d9c225 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sun, 27 Oct 2024 07:06:35 -0400 Subject: [PATCH] feat(YouTube - Hide player flyout menu items): Hide stable volume (#3827) --- .../PlayerFlyoutMenuItemsFilter.java | 30 +++++++++++-------- .../extension/youtube/settings/Settings.java | 29 ++++++++++-------- .../HidePlayerFlyoutMenuPatch.kt | 3 +- .../resources/addresources/values/strings.xml | 9 ++++-- 4 files changed, 42 insertions(+), 29 deletions(-) diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java index 2b0d3c814e..888687d8c4 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java @@ -20,12 +20,12 @@ public class PlayerFlyoutMenuItemsFilter extends Filter { public PlayerFlyoutMenuItemsFilter() { exception = new ByteArrayFilterGroup( // Whitelist Quality menu item when "Hide Additional settings menu" is enabled - Settings.HIDE_ADDITIONAL_SETTINGS_MENU, + Settings.HIDE_PLAYER_FLYOUT_ADDITIONAL_SETTINGS, "quality_sheet" ); videoQualityMenuFooter = new StringFilterGroup( - Settings.HIDE_VIDEO_QUALITY_MENU_FOOTER, + Settings.HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER, "quality_sheet_footer" ); @@ -36,47 +36,51 @@ public PlayerFlyoutMenuItemsFilter() { flyoutFilterGroupList.addAll( new ByteArrayFilterGroup( - Settings.HIDE_CAPTIONS_MENU, + Settings.HIDE_PLAYER_FLYOUT_CAPTIONS, "closed_caption" ), new ByteArrayFilterGroup( - Settings.HIDE_ADDITIONAL_SETTINGS_MENU, + Settings.HIDE_PLAYER_FLYOUT_ADDITIONAL_SETTINGS, "yt_outline_gear" ), new ByteArrayFilterGroup( - Settings.HIDE_LOOP_VIDEO_MENU, + Settings.HIDE_PLAYER_FLYOUT_LOOP_VIDEO, "yt_outline_arrow_repeat_1_" ), new ByteArrayFilterGroup( - Settings.HIDE_AMBIENT_MODE_MENU, + Settings.HIDE_PLAYER_FLYOUT_AMBIENT_MODE, "yt_outline_screen_light" ), new ByteArrayFilterGroup( - Settings.HIDE_HELP_MENU, + Settings.HIDE_PLAYER_FLYOUT_STABLE_VOLUME, + "volume_stable" + ), + new ByteArrayFilterGroup( + Settings.HIDE_PLAYER_FLYOUT_HELP, "yt_outline_question_circle" ), new ByteArrayFilterGroup( - Settings.HIDE_MORE_INFO_MENU, + Settings.HIDE_PLAYER_FLYOUT_MORE_INFO, "yt_outline_info_circle" ), new ByteArrayFilterGroup( - Settings.HIDE_LOCK_SCREEN_MENU, + Settings.HIDE_PLAYER_FLYOUT_LOCK_SCREEN, "yt_outline_lock" ), new ByteArrayFilterGroup( - Settings.HIDE_SPEED_MENU, + Settings.HIDE_PLAYER_FLYOUT_SPEED, "yt_outline_play_arrow_half_circle" ), new ByteArrayFilterGroup( - Settings.HIDE_AUDIO_TRACK_MENU, + Settings.HIDE_PLAYER_FLYOUT_AUDIO_TRACK, "yt_outline_person_radar" ), new ByteArrayFilterGroup( - Settings.HIDE_PLAYER_FLYOUT_MENU_SLEEP_TIMER, + Settings.HIDE_PLAYER_FLYOUT_SLEEP_TIMER, "yt_outline_moon_z_" ), new ByteArrayFilterGroup( - Settings.HIDE_WATCH_IN_VR_MENU, + Settings.HIDE_PLAYER_FLYOUT_WATCH_IN_VR, "yt_outline_vr" ) ); diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java index 7cfe9ce719..89831b82b1 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java @@ -178,18 +178,21 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_PLAYLIST_BUTTON = new BooleanSetting("revanced_hide_playlist_button", FALSE); // Player flyout menu items - public static final BooleanSetting HIDE_CAPTIONS_MENU = new BooleanSetting("revanced_hide_player_flyout_captions", FALSE); - public static final BooleanSetting HIDE_ADDITIONAL_SETTINGS_MENU = new BooleanSetting("revanced_hide_player_flyout_additional_settings", FALSE); - public static final BooleanSetting HIDE_LOOP_VIDEO_MENU = new BooleanSetting("revanced_hide_player_flyout_loop_video", FALSE); - public static final BooleanSetting HIDE_AMBIENT_MODE_MENU = new BooleanSetting("revanced_hide_player_flyout_ambient_mode", FALSE); - public static final BooleanSetting HIDE_HELP_MENU = new BooleanSetting("revanced_hide_player_flyout_help", TRUE); - public static final BooleanSetting HIDE_SPEED_MENU = new BooleanSetting("revanced_hide_player_flyout_speed", FALSE); - public static final BooleanSetting HIDE_MORE_INFO_MENU = new BooleanSetting("revanced_hide_player_flyout_more_info", TRUE); - public static final BooleanSetting HIDE_LOCK_SCREEN_MENU = new BooleanSetting("revanced_hide_player_flyout_lock_screen", FALSE); - public static final BooleanSetting HIDE_AUDIO_TRACK_MENU = new BooleanSetting("revanced_hide_player_flyout_audio_track", FALSE); - public static final BooleanSetting HIDE_PLAYER_FLYOUT_MENU_SLEEP_TIMER = new BooleanSetting("revanced_hide_player_flyout_sleep_timer", FALSE); - public static final BooleanSetting HIDE_WATCH_IN_VR_MENU = new BooleanSetting("revanced_hide_player_flyout_watch_in_vr", TRUE); - public static final BooleanSetting HIDE_VIDEO_QUALITY_MENU_FOOTER = new BooleanSetting("revanced_hide_video_quality_menu_footer", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_CAPTIONS = new BooleanSetting("revanced_hide_player_flyout_captions", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_ADDITIONAL_SETTINGS = new BooleanSetting("revanced_hide_player_flyout_additional_settings", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_LOOP_VIDEO = new BooleanSetting("revanced_hide_player_flyout_loop_video", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_AMBIENT_MODE = new BooleanSetting("revanced_hide_player_flyout_ambient_mode", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_HELP = new BooleanSetting("revanced_hide_player_flyout_help", TRUE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_SPEED = new BooleanSetting("revanced_hide_player_flyout_speed", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_MORE_INFO = new BooleanSetting("revanced_hide_player_flyout_more_info", TRUE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_LOCK_SCREEN = new BooleanSetting("revanced_hide_player_flyout_lock_screen", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_AUDIO_TRACK = new BooleanSetting("revanced_hide_player_flyout_audio_track", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_SLEEP_TIMER = new BooleanSetting("revanced_hide_player_flyout_sleep_timer", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_STABLE_VOLUME = new BooleanSetting("revanced_hide_player_flyout_stable_volume", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_WATCH_IN_VR = new BooleanSetting("revanced_hide_player_flyout_watch_in_vr", TRUE); + @Deprecated + private static final BooleanSetting DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER = new BooleanSetting("revanced_hide_video_quality_menu_footer", FALSE); + public static final BooleanSetting HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER = new BooleanSetting("revanced_hide_player_flyout_video_quality_footer", FALSE); // General layout public static final EnumSetting CHANGE_START_PAGE = new EnumSetting<>("revanced_change_start_page", StartPage.ORIGINAL, true); @@ -379,6 +382,8 @@ public class Settings extends BaseSettings { migrateOldSettingToNew(HIDE_PLAYER_BUTTONS, HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS); + migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER, HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER); + // endregion } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt index 3dc281f742..7a01bbfba0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt @@ -46,6 +46,7 @@ val hidePlayerFlyoutMenuPatch = bytecodePatch( SwitchPreference("revanced_hide_player_flyout_additional_settings"), SwitchPreference("revanced_hide_player_flyout_loop_video"), SwitchPreference("revanced_hide_player_flyout_ambient_mode"), + SwitchPreference("revanced_hide_player_flyout_stable_volume"), SwitchPreference("revanced_hide_player_flyout_help"), SwitchPreference("revanced_hide_player_flyout_speed"), SwitchPreference("revanced_hide_player_flyout_lock_screen"), @@ -53,7 +54,7 @@ val hidePlayerFlyoutMenuPatch = bytecodePatch( SwitchPreference("revanced_hide_player_flyout_audio_track"), SwitchPreference("revanced_hide_player_flyout_watch_in_vr"), SwitchPreference("revanced_hide_player_flyout_sleep_timer"), - SwitchPreference("revanced_hide_video_quality_menu_footer"), + SwitchPreference("revanced_hide_player_flyout_video_quality_footer"), ), ), ) diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index 2aff788d57..ee04e92898 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -527,6 +527,9 @@ This is because Crowdin requires temporarily flattening this file and removing t Hide Ambient mode Ambient mode menu is hidden Ambient mode menu is shown + Hide Stable volume + Stable volume menu is shown + Stable volume menu is hidden Hide Help & feedback Help & feedback menu is hidden @@ -552,9 +555,9 @@ This is because Crowdin requires temporarily flattening this file and removing t Hide Watch in VR Watch in VR menu is hidden Watch in VR menu is shown - Hide video quality menu footer - Video quality menu footer is hidden - Video quality menu footer is shown + Hide video quality menu footer + Video quality menu footer is hidden + Video quality menu footer is shown Hide previous & next video buttons