Merge pull request #13504 from laiosg/repeatmode-ui-fix

Fix repeat mode UI out-of-sync when switching videos
This commit is contained in:
Tobi 2026-05-16 08:41:01 +02:00 committed by GitHub
commit 6f3f4219dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -399,6 +399,10 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
// #6825 - Ensure that the shuffle-button is in the correct state on the UI
setShuffleButton(player.getExoPlayer().getShuffleModeEnabled());
// Set repeat button to the correct UI state
setRepeatButton(player.getExoPlayer().getRepeatMode());
}
public abstract void removeViewFromParent();
@ -982,6 +986,18 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
private void setShuffleButton(final boolean shuffled) {
binding.shuffleButton.setImageAlpha(shuffled ? 255 : 77);
}
private void setRepeatButton(final int repeatMode) {
final int resId = switch (repeatMode) {
case REPEAT_MODE_ALL
-> com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_all;
case REPEAT_MODE_ONE
-> com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_one;
default -> com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_off;
};
binding.repeatButton.setImageResource(resId);
}
//endregion