diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/PlayerFragment.java b/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/PlayerFragment.java index 66518b05..0c454557 100644 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/PlayerFragment.java +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/PlayerFragment.java @@ -304,15 +304,8 @@ public class PlayerFragment extends Fragment implements GestureDetector.OnGestur @Override protected Boolean doInBackground() { - if (mediaPlayerControllerLazy.getValue().getCurrentPlayingNumberOnPlaylist() < mediaPlayerControllerLazy.getValue().getPlaylistSize() - 1) - { - mediaPlayerControllerLazy.getValue().next(); - return true; - } - else - { - return false; - } + mediaPlayerControllerLazy.getValue().next(); + return true; } @Override diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerControllerImpl.java b/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerControllerImpl.java index 0c173960..d5bffc02 100644 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerControllerImpl.java +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerControllerImpl.java @@ -458,7 +458,20 @@ public class MediaPlayerControllerImpl implements MediaPlayerController int index = downloader.getCurrentPlayingIndex(); if (index != -1) { - play(index + 1); + switch (getRepeatMode()) + { + case SINGLE: + case OFF: + if (index + 1 >= 0 && index + 1 < downloader.downloadList.size()) { + play(index + 1); + } + break; + case ALL: + play((index + 1) % downloader.downloadList.size()); + break; + default: + break; + } } }