From d2306b0fd71e2d8fe6bf7efa90e1d3d1eadcd8e6 Mon Sep 17 00:00:00 2001 From: 0x416c6578 <14030169+0x416c6578@users.noreply.github.com> Date: Wed, 4 Aug 2021 14:33:40 +0100 Subject: [PATCH] Fixed shuffle button opacity bug Parameterised shuffle state into initPlayback for potentially passing the shuffle state into the player in the future --- .../main/java/org/schabi/newpipe/player/Player.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 22e66e793..fa63b0345 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -635,6 +635,7 @@ public final class Player implements final int repeatMode = intent.getIntExtra(REPEAT_MODE, getRepeatMode()); final boolean playWhenReady = intent.getBooleanExtra(PLAY_WHEN_READY, true); final boolean isMuted = intent.getBooleanExtra(IS_MUTED, isMuted()); + final boolean shuffleMode = false; //Set the default shuffle mode to disabled /* * There are 3 situations when playback shouldn't be started from scratch (zero timestamp): @@ -691,7 +692,7 @@ public final class Player implements state.getProgressMillis()); } initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch, - playbackSkipSilence, playWhenReady, isMuted); + playbackSkipSilence, playWhenReady, isMuted, shuffleMode); }, error -> { if (DEBUG) { @@ -699,19 +700,19 @@ public final class Player implements } // In case any error we can start playback without history initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch, - playbackSkipSilence, playWhenReady, isMuted); + playbackSkipSilence, playWhenReady, isMuted, shuffleMode); }, () -> { // Completed but not found in history initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch, - playbackSkipSilence, playWhenReady, isMuted); + playbackSkipSilence, playWhenReady, isMuted, shuffleMode); } )); } else { // Good to go... // In a case of equal PlayQueues we can re-init old one but only when it is disposed initPlayback(samePlayQueue ? playQueue : newQueue, repeatMode, playbackSpeed, - playbackPitch, playbackSkipSilence, playWhenReady, isMuted); + playbackPitch, playbackSkipSilence, playWhenReady, isMuted, shuffleMode); } if (oldPlayerType != playerType && playQueue != null) { @@ -770,10 +771,12 @@ public final class Player implements final float playbackPitch, final boolean playbackSkipSilence, final boolean playOnReady, - final boolean isMuted) { + final boolean isMuted, + final boolean shuffleEnabled) { destroyPlayer(); initPlayer(playOnReady); setRepeatMode(repeatMode); + onShuffleModeEnabledChanged(shuffleEnabled); setPlaybackParameters(playbackSpeed, playbackPitch, playbackSkipSilence); playQueue = queue;