Fixed shuffle button opacity bug
Parameterised shuffle state into initPlayback for potentially passing the shuffle state into the player in the future
This commit is contained in:
parent
94dfabf3dc
commit
d2306b0fd7
|
@ -635,6 +635,7 @@ public final class Player implements
|
||||||
final int repeatMode = intent.getIntExtra(REPEAT_MODE, getRepeatMode());
|
final int repeatMode = intent.getIntExtra(REPEAT_MODE, getRepeatMode());
|
||||||
final boolean playWhenReady = intent.getBooleanExtra(PLAY_WHEN_READY, true);
|
final boolean playWhenReady = intent.getBooleanExtra(PLAY_WHEN_READY, true);
|
||||||
final boolean isMuted = intent.getBooleanExtra(IS_MUTED, isMuted());
|
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):
|
* 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());
|
state.getProgressMillis());
|
||||||
}
|
}
|
||||||
initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch,
|
initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch,
|
||||||
playbackSkipSilence, playWhenReady, isMuted);
|
playbackSkipSilence, playWhenReady, isMuted, shuffleMode);
|
||||||
},
|
},
|
||||||
error -> {
|
error -> {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
@ -699,19 +700,19 @@ public final class Player implements
|
||||||
}
|
}
|
||||||
// In case any error we can start playback without history
|
// In case any error we can start playback without history
|
||||||
initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch,
|
initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch,
|
||||||
playbackSkipSilence, playWhenReady, isMuted);
|
playbackSkipSilence, playWhenReady, isMuted, shuffleMode);
|
||||||
},
|
},
|
||||||
() -> {
|
() -> {
|
||||||
// Completed but not found in history
|
// Completed but not found in history
|
||||||
initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch,
|
initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch,
|
||||||
playbackSkipSilence, playWhenReady, isMuted);
|
playbackSkipSilence, playWhenReady, isMuted, shuffleMode);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
// Good to go...
|
// Good to go...
|
||||||
// In a case of equal PlayQueues we can re-init old one but only when it is disposed
|
// In a case of equal PlayQueues we can re-init old one but only when it is disposed
|
||||||
initPlayback(samePlayQueue ? playQueue : newQueue, repeatMode, playbackSpeed,
|
initPlayback(samePlayQueue ? playQueue : newQueue, repeatMode, playbackSpeed,
|
||||||
playbackPitch, playbackSkipSilence, playWhenReady, isMuted);
|
playbackPitch, playbackSkipSilence, playWhenReady, isMuted, shuffleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldPlayerType != playerType && playQueue != null) {
|
if (oldPlayerType != playerType && playQueue != null) {
|
||||||
|
@ -770,10 +771,12 @@ public final class Player implements
|
||||||
final float playbackPitch,
|
final float playbackPitch,
|
||||||
final boolean playbackSkipSilence,
|
final boolean playbackSkipSilence,
|
||||||
final boolean playOnReady,
|
final boolean playOnReady,
|
||||||
final boolean isMuted) {
|
final boolean isMuted,
|
||||||
|
final boolean shuffleEnabled) {
|
||||||
destroyPlayer();
|
destroyPlayer();
|
||||||
initPlayer(playOnReady);
|
initPlayer(playOnReady);
|
||||||
setRepeatMode(repeatMode);
|
setRepeatMode(repeatMode);
|
||||||
|
onShuffleModeEnabledChanged(shuffleEnabled);
|
||||||
setPlaybackParameters(playbackSpeed, playbackPitch, playbackSkipSilence);
|
setPlaybackParameters(playbackSpeed, playbackPitch, playbackSkipSilence);
|
||||||
|
|
||||||
playQueue = queue;
|
playQueue = queue;
|
||||||
|
|
Loading…
Reference in New Issue