Merge pull request #13504 from laiosg/repeatmode-ui-fix
Fix repeat mode UI out-of-sync when switching videos
This commit is contained in:
commit
1a1192f919
1 changed files with 16 additions and 0 deletions
|
|
@ -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
|
// #6825 - Ensure that the shuffle-button is in the correct state on the UI
|
||||||
setShuffleButton(player.getExoPlayer().getShuffleModeEnabled());
|
setShuffleButton(player.getExoPlayer().getShuffleModeEnabled());
|
||||||
|
|
||||||
|
// Set repeat button to the correct UI state
|
||||||
|
setRepeatButton(player.getExoPlayer().getRepeatMode());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void removeViewFromParent();
|
public abstract void removeViewFromParent();
|
||||||
|
|
@ -982,6 +986,18 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
|
||||||
private void setShuffleButton(final boolean shuffled) {
|
private void setShuffleButton(final boolean shuffled) {
|
||||||
binding.shuffleButton.setImageAlpha(shuffled ? 255 : 77);
|
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
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue