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

Commit

Permalink
fix(YouTube Music - Player components): Remember shuffle state sett…
Browse files Browse the repository at this point in the history
…ing does not remember the correct state
  • Loading branch information
anddea committed Sep 30, 2024
1 parent 32edcf2 commit 509ef96
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import app.revanced.integrations.music.settings.Settings;
import app.revanced.integrations.music.shared.VideoType;
import app.revanced.integrations.music.utils.VideoUtils;

@SuppressWarnings({"unused"})
public class PlayerPatch {
Expand Down Expand Up @@ -145,14 +146,16 @@ public static int hideFullscreenShareButton(int original) {
return Settings.HIDE_FULLSCREEN_SHARE_BUTTON.get() ? 0 : original;
}

public static void setShuffleState(int buttonState) {
public static void setShuffleState(Enum<?> shuffleState) {
if (!Settings.REMEMBER_SHUFFLE_SATE.get())
return;
Settings.SHUFFLE_SATE.save(buttonState);
Settings.ALWAYS_SHUFFLE.save(shuffleState.ordinal() == 1);
}

public static int getShuffleState() {
return Settings.SHUFFLE_SATE.get();
public static void shuffleTracks() {
if (!Settings.ALWAYS_SHUFFLE.get())
return;
VideoUtils.shuffleTracks();
}

public static boolean rememberRepeatState(boolean original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_FULLSCREEN_SHARE_BUTTON = new BooleanSetting("revanced_hide_fullscreen_share_button", FALSE, true);
public static final BooleanSetting REMEMBER_REPEAT_SATE = new BooleanSetting("revanced_remember_repeat_state", TRUE);
public static final BooleanSetting REMEMBER_SHUFFLE_SATE = new BooleanSetting("revanced_remember_shuffle_state", TRUE);
public static final IntegerSetting SHUFFLE_SATE = new IntegerSetting("revanced_shuffle_state", 1);
public static final BooleanSetting ALWAYS_SHUFFLE = new BooleanSetting("revanced_always_shuffle", FALSE);
public static final BooleanSetting RESTORE_OLD_COMMENTS_POPUP_PANELS = new BooleanSetting("revanced_restore_old_comments_popup_panels", FALSE, true);
public static final BooleanSetting RESTORE_OLD_PLAYER_BACKGROUND = new BooleanSetting("revanced_restore_old_player_background", FALSE, true);
public static final BooleanSetting RESTORE_OLD_PLAYER_LAYOUT = new BooleanSetting("revanced_restore_old_player_layout", FALSE, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.media.AudioManager;
import android.util.Log;

import androidx.annotation.NonNull;

Expand Down Expand Up @@ -70,6 +71,13 @@ public static void openInYouTubeMusic(@NonNull String songId) {
launchView(url, context.getPackageName());
}

/**
* Rest of the implementation added by patch.
*/
public static void shuffleTracks() {
Log.d("Extended: VideoUtils", "Tracks are shuffled");
}

/**
* Rest of the implementation added by patch.
*/
Expand Down

0 comments on commit 509ef96

Please sign in to comment.