From a11ceaf4b486544be7764fddcb66fd06bcda7ef3 Mon Sep 17 00:00:00 2001 From: ashrafzadeh Date: Wed, 5 Sep 2018 14:57:34 +0430 Subject: [PATCH] repeat single bug fix --- .../audiostreamer/AudioStreamingManager.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dmaudiostreamer/src/main/java/dm/audiostreamer/AudioStreamingManager.java b/dmaudiostreamer/src/main/java/dm/audiostreamer/AudioStreamingManager.java index d8e42bf..29a5cd2 100644 --- a/dmaudiostreamer/src/main/java/dm/audiostreamer/AudioStreamingManager.java +++ b/dmaudiostreamer/src/main/java/dm/audiostreamer/AudioStreamingManager.java @@ -168,10 +168,14 @@ public int lastSeekPosition() { @Override public void onSkipToNext() { + if (repeatType == SINGLE) { + onSeekTo(0); + scheduleSeekBarUpdate(); + currentSessionCallback.playCurrent(index, currentAudio); + return; + } int nextIndex = index + 1; - if (repeatType == SINGLE) - nextIndex = index; - else if (shuffleEnable) + if (shuffleEnable) nextIndex = getRandomIndex(); if (!isValidIndex(true, nextIndex)) if (repeatType == ALL) @@ -190,10 +194,14 @@ else if (shuffleEnable) @Override public void onSkipToPrevious() { + if (repeatType == SINGLE) { + onSeekTo(0); + scheduleSeekBarUpdate(); + currentSessionCallback.playCurrent(index, currentAudio); + return; + } int prvIndex = index - 1; - if (repeatType == SINGLE) - prvIndex = index; - else if (shuffleEnable) + if (shuffleEnable) prvIndex = getRandomIndex(); if (!isValidIndex(true, prvIndex)) if (repeatType == ALL)