From c38e4190f1f740f4cf5b4b9462dd2410cdb68a59 Mon Sep 17 00:00:00 2001 From: John Zhen M Date: Fri, 8 Sep 2017 07:52:38 -0700 Subject: [PATCH] -Fix restart button not working --- app/src/main/java/org/schabi/newpipe/player/BasePlayer.java | 1 + app/src/main/java/org/schabi/newpipe/playlist/PlayQueue.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index aed8ba960..87c74e0b3 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -695,6 +695,7 @@ public abstract class BasePlayer implements Player.EventListener, if (!isPlaying()) audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN); else audioManager.abandonAudioFocus(this); + if (getCurrentState() == STATE_COMPLETED) playQueue.setIndex(0); simpleExoPlayer.setPlayWhenReady(!isPlaying()); } diff --git a/app/src/main/java/org/schabi/newpipe/playlist/PlayQueue.java b/app/src/main/java/org/schabi/newpipe/playlist/PlayQueue.java index f45093e27..203ffb1a5 100644 --- a/app/src/main/java/org/schabi/newpipe/playlist/PlayQueue.java +++ b/app/src/main/java/org/schabi/newpipe/playlist/PlayQueue.java @@ -124,7 +124,7 @@ public abstract class PlayQueue implements Serializable { // Write ops //////////////////////////////////////////////////////////////////////////*/ - private synchronized void setIndex(final int index) { + public synchronized void setIndex(final int index) { if (index < 0 || index >= streams.size()) return; queueIndex.set(Math.min(Math.max(0, index), streams.size() - 1));