diff options
author | Scott Jackson <daneren2005@users.noreply.github.com> | 2018-01-23 14:06:16 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-23 14:06:16 -0800 |
commit | 3cb68cf66cde60ac780f7c87510d447dd2873cbb (patch) | |
tree | 95cb65b5bdcf9da20d0a574c0ec6d5828f9984ec | |
parent | caae662a02faef75a73fa079c855cc6f2b50ce78 (diff) | |
parent | c0764f3b1d75a1086cede47f1d930a57efdea803 (diff) | |
download | dsub-3cb68cf66cde60ac780f7c87510d447dd2873cbb.tar.gz dsub-3cb68cf66cde60ac780f7c87510d447dd2873cbb.tar.bz2 dsub-3cb68cf66cde60ac780f7c87510d447dd2873cbb.zip |
Merge pull request #843 from hufman/aa-queue-size
Sends a remote queue of 50 items instead of 3
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 16 |
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)); } } |