Skip to content

Commit 417c4dc

Browse files
committed
feat: resolved review comments
1 parent 3ccb552 commit 417c4dc

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,10 +1280,6 @@ public void cycleNextRepeatMode() {
12801280
break;
12811281
}
12821282
simpleExoPlayer.setRepeatMode(repeatMode);
1283-
prefs
1284-
.edit()
1285-
.putInt(context.getString(R.string.repeat_mode_key), repeatMode)
1286-
.apply();
12871283
}
12881284
}
12891285

@@ -1295,6 +1291,10 @@ public void onRepeatModeChanged(@RepeatMode final int repeatMode) {
12951291
}
12961292
UIs.call(playerUi -> playerUi.onRepeatModeChanged(repeatMode));
12971293
notifyPlaybackUpdateToListeners();
1294+
prefs
1295+
.edit()
1296+
.putInt(context.getString(R.string.repeat_mode_key), repeatMode)
1297+
.apply();
12981298
}
12991299

13001300
@Override

app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ public void initPlayback() {
400400

401401
// #6825 - Ensure that the shuffle-button is in the correct state on the UI
402402
setShuffleButton(player.getExoPlayer().getShuffleModeEnabled());
403+
// Ensure that the repeat-button is in the correct state on the UI
404+
setRepeatButton(player.getRepeatMode());
403405
}
404406

405407
public abstract void removeViewFromParent();
@@ -951,16 +953,7 @@ public void onShuffleClicked() {
951953
public void onRepeatModeChanged(@RepeatMode final int repeatMode) {
952954
super.onRepeatModeChanged(repeatMode);
953955

954-
if (repeatMode == REPEAT_MODE_ALL) {
955-
binding.repeatButton.setImageResource(
956-
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_all);
957-
} else if (repeatMode == REPEAT_MODE_ONE) {
958-
binding.repeatButton.setImageResource(
959-
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_one);
960-
} else /* repeatMode == REPEAT_MODE_OFF */ {
961-
binding.repeatButton.setImageResource(
962-
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_off);
963-
}
956+
setRepeatButton(repeatMode);
964957
}
965958

966959
@Override
@@ -980,6 +973,19 @@ private void setMuteButton(final boolean isMuted) {
980973
? R.drawable.ic_volume_off : R.drawable.ic_volume_up));
981974
}
982975

976+
private void setRepeatButton(@RepeatMode final int repeatMode) {
977+
if (repeatMode == REPEAT_MODE_ALL) {
978+
binding.repeatButton.setImageResource(
979+
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_all);
980+
} else if (repeatMode == REPEAT_MODE_ONE) {
981+
binding.repeatButton.setImageResource(
982+
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_one);
983+
} else /* repeatMode == REPEAT_MODE_OFF */ {
984+
binding.repeatButton.setImageResource(
985+
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_off);
986+
}
987+
}
988+
983989
private void setShuffleButton(final boolean shuffled) {
984990
binding.shuffleButton.setImageAlpha(shuffled ? 255 : 77);
985991
}

0 commit comments

Comments
 (0)