diff options
author | daneren2005 <daneren2005@gmail.com> | 2013-11-05 09:53:44 -0800 |
---|---|---|
committer | daneren2005 <daneren2005@gmail.com> | 2013-11-05 09:53:44 -0800 |
commit | 573137b3458ec39e0ccdd320c552a42a36d6b228 (patch) | |
tree | 01741966c621caa3b7cd92f3748241896b8727b0 /src/github | |
parent | 3f735b00f6e180bbd4a66f606bde0b8bb1b3620b (diff) | |
download | dsub-573137b3458ec39e0ccdd320c552a42a36d6b228.tar.gz dsub-573137b3458ec39e0ccdd320c552a42a36d6b228.tar.bz2 dsub-573137b3458ec39e0ccdd320c552a42a36d6b228.zip |
Make the next button obey the same rules that the normal progression does
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index fbeba752..731794de 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -583,21 +583,7 @@ public class DownloadServiceImpl extends Service implements DownloadService { return; } - int index = getCurrentPlayingIndex(); - if (index != -1) { - switch (getRepeatMode()) { - case OFF: - index = index + 1; - break; - case ALL: - index = (index + 1) % size(); - break; - case SINGLE: - break; - default: - break; - } - } + int index = getNextPlayingIndex(); nextSetup = false; if(nextPlayingTask != null) { @@ -618,6 +604,24 @@ public class DownloadServiceImpl extends Service implements DownloadService { public synchronized int getCurrentPlayingIndex() { return downloadList.indexOf(currentPlaying); } + private int getNextPlayingIndex() { + int index = getCurrentPlayingIndex(); + if (index != -1) { + switch (getRepeatMode()) { + case OFF: + index = index + 1; + break; + case ALL: + index = (index + 1) % size(); + break; + case SINGLE: + break; + default: + break; + } + } + return index; + } @Override public DownloadFile getCurrentPlaying() { @@ -767,27 +771,12 @@ public class DownloadServiceImpl extends Service implements DownloadService { public synchronized void next() { int index = getCurrentPlayingIndex(); if (index != -1) { - play(index + 1); + play(getNextPlayingIndex()); } } private void onSongCompleted() { - int index = getCurrentPlayingIndex(); - if (index != -1) { - switch (getRepeatMode()) { - case OFF: - play(index + 1); - break; - case ALL: - play((index + 1) % size()); - break; - case SINGLE: - play(index); - break; - default: - break; - } - } + play(getNextPlayingIndex()); } @Override |