From 287263241ce6e935a6102d802030489a0452406e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ho=C3=A0ng=20Gia=20B=E1=BA=A3o?= <70064328+YT-Advanced@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:04:37 +0700 Subject: [PATCH] fix(Hide Suggested Video Overlay): Autoplay options followed the system settings --- .../youtube/patches/player/PlayerPatch.java | 10 ++++++++-- .../integrations/youtube/settings/SettingsEnum.java | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/player/PlayerPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/player/PlayerPatch.java index 1e4a683066..cf5498fd4c 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/player/PlayerPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/player/PlayerPatch.java @@ -14,6 +14,8 @@ @SuppressWarnings("unused") public class PlayerPatch { + private static boolean isAutoplayOn = false; + public static void changePlayerOpacity(ImageView imageView) { int opacity = SettingsEnum.CUSTOM_PLAYER_OVERLAY_OPACITY.getInt(); @@ -105,7 +107,7 @@ public static boolean hideSeekUndoMessage() { } public static void hideSuggestedVideoOverlay(View view) { - if (!SettingsEnum.HIDE_SUGGESTED_VIDEO_OVERLAY.getBoolean() || !SettingsEnum.HIDE_SUGGESTED_VIDEO_OVERLAY_AUTO_PLAY.getBoolean()) + if (!SettingsEnum.HIDE_SUGGESTED_VIDEO_OVERLAY.getBoolean() || !isAutoplayOn) return; if (view != null) { @@ -115,7 +117,7 @@ public static void hideSuggestedVideoOverlay(View view) { } public static void hideSuggestedVideoOverlay(ViewGroup viewGroup) { - if (!SettingsEnum.HIDE_SUGGESTED_VIDEO_OVERLAY.getBoolean() || SettingsEnum.HIDE_SUGGESTED_VIDEO_OVERLAY_AUTO_PLAY.getBoolean()) + if (!SettingsEnum.HIDE_SUGGESTED_VIDEO_OVERLAY.getBoolean() || isAutoplayOn) return; viewGroup.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { @@ -130,4 +132,8 @@ public static void hideSuggestedVideoOverlay(ViewGroup viewGroup) { } }); } + + public static void saveAutoplay(boolean originalValue) { + isAutoplayOn = originalValue; + } } diff --git a/app/src/main/java/app/revanced/integrations/youtube/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/youtube/settings/SettingsEnum.java index 912698575c..92f370646b 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/youtube/settings/SettingsEnum.java @@ -305,8 +305,6 @@ public enum SettingsEnum { HIDE_SEEK_UNDO_MESSAGE("revanced_hide_seek_undo_message", BOOLEAN, FALSE, true), HIDE_SUGGESTED_ACTION("revanced_hide_suggested_actions", BOOLEAN, TRUE, true), HIDE_SUGGESTED_VIDEO_OVERLAY("revanced_hide_suggested_video_overlay", BOOLEAN, FALSE, true), - HIDE_SUGGESTED_VIDEO_OVERLAY_AUTO_PLAY("revanced_hide_suggested_video_overlay_auto_play", BOOLEAN, TRUE, true, - parents(HIDE_SUGGESTED_VIDEO_OVERLAY)), HIDE_YOUTUBE_MUSIC_BUTTON("revanced_hide_youtube_music_button", BOOLEAN, FALSE),