aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-11-05 09:53:44 -0800
committerdaneren2005 <daneren2005@gmail.com>2013-11-05 09:53:44 -0800
commit573137b3458ec39e0ccdd320c552a42a36d6b228 (patch)
tree01741966c621caa3b7cd92f3748241896b8727b0 /src/github
parent3f735b00f6e180bbd4a66f606bde0b8bb1b3620b (diff)
downloaddsub-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.java53
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