From c0764f3b1d75a1086cede47f1d930a57efdea803 Mon Sep 17 00:00:00 2001 From: Walter Huf Date: Mon, 15 Jan 2018 08:51:48 -0800 Subject: Sends a remote queue of 50 items instead of 3 --- .../github/daneren2005/dsub/service/DownloadService.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'app/src/main/java/github') 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 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)); } } -- cgit v1.2.3