Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #6217 fixed. replay button doesn't appear twice. #6322

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,11 @@ public final class Player implements
@NonNull private final SharedPreferences prefs;
@NonNull private final HistoryRecordManager recordManager;

/*//////////////////////////////////////////////////////////////////////////
// this field is added to address issue #6217 regarding the replay button appearing twice.
//////////////////////////////////////////////////////////////////////////*/

private boolean isOnreplay = false;

/*//////////////////////////////////////////////////////////////////////////
// Constructor
Expand Down Expand Up @@ -2142,12 +2146,16 @@ private void onPausedSeek() {
}

private void onCompleted() {
if (isOnreplay) {
return;
}
if (DEBUG) {
Log.d(TAG, "onCompleted() called");
}

animate(binding.playPauseButton, false, 0, AnimationType.SCALE_AND_ALPHA, 0,
() -> {
isOnreplay = true;
binding.playPauseButton.setImageResource(R.drawable.ic_replay);
animatePlayButtons(true, DEFAULT_CONTROLS_DURATION);
});
Expand Down Expand Up @@ -3546,6 +3554,10 @@ public void onClick(final View v) {
seekToDefault();
} else if (v.getId() == binding.playPauseButton.getId()) {
playPause();
if (isOnreplay) {
isOnreplay = false;
playPause();
}
} else if (v.getId() == binding.playPreviousButton.getId()) {
playPrevious();
} else if (v.getId() == binding.playNextButton.getId()) {
Expand Down