Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
fix(Hide Suggested Video Overlay): Autoplay options followed the syst…
Browse files Browse the repository at this point in the history
…em settings
  • Loading branch information
YT-Advanced committed Feb 26, 2024
1 parent 452f682 commit 2872632
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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) {
Expand All @@ -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) -> {
Expand All @@ -130,4 +132,8 @@ public static void hideSuggestedVideoOverlay(ViewGroup viewGroup) {
}
});
}

public static void saveAutoplay(boolean originalValue) {
isAutoplayOn = originalValue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down

0 comments on commit 2872632

Please sign in to comment.