Replace if-else with switch
This commit is contained in:
parent
18d54b6225
commit
9dd0f1984f
1 changed files with 8 additions and 10 deletions
|
|
@ -988,16 +988,14 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
|
|||
}
|
||||
|
||||
private void setRepeatButton(final int repeatMode) {
|
||||
if (repeatMode == REPEAT_MODE_ALL) {
|
||||
binding.repeatButton.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_all);
|
||||
} else if (repeatMode == REPEAT_MODE_ONE) {
|
||||
binding.repeatButton.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_one);
|
||||
} else /* repeatMode == REPEAT_MODE_OFF */ {
|
||||
binding.repeatButton.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_off);
|
||||
}
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue