aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorWalter Huf <hufman@gmail.com>2018-01-15 08:51:48 -0800
committerWalter Huf <hufman@gmail.com>2018-01-15 13:33:37 -0800
commitc0764f3b1d75a1086cede47f1d930a57efdea803 (patch)
treeb0d14123dd9cad336b89bb71b9e10a9068fa107b /app
parentc04999f5859fe9d0569e77bcfaacc13af8439c42 (diff)
downloaddsub-c0764f3b1d75a1086cede47f1d930a57efdea803.tar.gz
dsub-c0764f3b1d75a1086cede47f1d930a57efdea803.tar.bz2
dsub-c0764f3b1d75a1086cede47f1d930a57efdea803.zip
Sends a remote queue of 50 items instead of 3
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
index da9deac1..c5caad26 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -110,7 +110,8 @@ public class DownloadService extends Service {
private static final long DEFAULT_DELAY_UPDATE_PROGRESS = 1000L;
private static final double DELETE_CUTOFF = 0.84;
private static final int REQUIRED_ALBUM_MATCHES = 4;
- private static final int REMOTE_PLAYLIST_TOTAL = 3;
+ private static final int REMOTE_PLAYLIST_PREV = 10;
+ private static final int REMOTE_PLAYLIST_NEXT = 40;
private static final int SHUFFLE_MODE_NONE = 0;
private static final int SHUFFLE_MODE_ALL = 1;
private static final int SHUFFLE_MODE_ARTIST = 2;
@@ -507,14 +508,17 @@ public class DownloadService extends Service {
private synchronized void updateRemotePlaylist() {
List<DownloadFile> playlist = new ArrayList<>();
if(currentPlaying != null) {
- int index = downloadList.indexOf(currentPlaying);
- if(index == -1) {
- index = 0;
+ int startIndex = downloadList.indexOf(currentPlaying) - REMOTE_PLAYLIST_PREV;
+ if(startIndex < 0) {
+ startIndex = 0;
}
int size = size();
- int end = index + REMOTE_PLAYLIST_TOTAL;
- for(int i = index; i < size && i < end; i++) {
+ int endIndex = downloadList.indexOf(currentPlaying) + REMOTE_PLAYLIST_NEXT;
+ if(endIndex > size) {
+ endIndex = size;
+ }
+ for(int i = startIndex; i < endIndex; i++) {
playlist.add(downloadList.get(i));
}
}