From c04999f5859fe9d0569e77bcfaacc13af8439c42 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 10 Jan 2018 17:34:28 -0800 Subject: Tweak getRecentDownloads to take how many songs we have set to load into account --- app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/src') 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 e1b3d0ae..da9deac1 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -1038,7 +1038,8 @@ public class DownloadService extends Service { public synchronized List getRecentDownloads() { int from = Math.max(currentPlayingIndex - 10, 0); - int to = Math.min(currentPlayingIndex + 20, downloadList.size() - 1); + int songsToKeep = Math.max(Util.getPreloadCount(this), 20); + int to = Math.min(currentPlayingIndex + songsToKeep, downloadList.size() - 1); List temp = downloadList.subList(from, to); temp.addAll(backgroundDownloadList); return temp; -- cgit v1.2.3