diff options
Diffstat (limited to 'app/src/main/java/github')
3 files changed, 4 insertions, 4 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 6c73e8c1..f0e119bb 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -2103,7 +2103,7 @@ public class DownloadService extends Service { // Get users desired random playlist size SharedPreferences prefs = Util.getPreferences(this); - int listSize = Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_RANDOM_SIZE, "20")); + int listSize = Math.max(1, Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_RANDOM_SIZE, "20"))); boolean wasEmpty = downloadList.isEmpty(); long revisionBefore = revision; @@ -2145,7 +2145,7 @@ public class DownloadService extends Service { private synchronized void checkArtistRadio() { // Get users desired random playlist size SharedPreferences prefs = Util.getPreferences(this); - int listSize = Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_RANDOM_SIZE, "20")); + int listSize = Math.max(1, Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_RANDOM_SIZE, "20"))); boolean wasEmpty = downloadList.isEmpty(); long revisionBefore = revision; diff --git a/app/src/main/java/github/daneren2005/dsub/util/ArtistRadioBuffer.java b/app/src/main/java/github/daneren2005/dsub/util/ArtistRadioBuffer.java index 6e9b8309..2af468f6 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/ArtistRadioBuffer.java +++ b/app/src/main/java/github/daneren2005/dsub/util/ArtistRadioBuffer.java @@ -52,7 +52,7 @@ public class ArtistRadioBuffer { }; // Calculate out the capacity and refill threshold based on the user's random size preference - int shuffleListSize = Integer.parseInt(Util.getPreferences(context).getString(Constants.PREFERENCES_KEY_RANDOM_SIZE, "20")); + int shuffleListSize = Math.max(1, Integer.parseInt(Util.getPreferences(context).getString(Constants.PREFERENCES_KEY_RANDOM_SIZE, "20"))); // ex: default 20 -> 50 capacity = shuffleListSize * 5 / 2; capacity = Math.min(500, capacity); diff --git a/app/src/main/java/github/daneren2005/dsub/util/ShufflePlayBuffer.java b/app/src/main/java/github/daneren2005/dsub/util/ShufflePlayBuffer.java index 7da35f77..6996acaf 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/ShufflePlayBuffer.java +++ b/app/src/main/java/github/daneren2005/dsub/util/ShufflePlayBuffer.java @@ -73,7 +73,7 @@ public class ShufflePlayBuffer { executorService.scheduleWithFixedDelay(runnable, 1, 10, TimeUnit.SECONDS); // Calculate out the capacity and refill threshold based on the user's random size preference - int shuffleListSize = Integer.parseInt(Util.getPreferences(context).getString(Constants.PREFERENCES_KEY_RANDOM_SIZE, "20")); + int shuffleListSize = Math.max(1, Integer.parseInt(Util.getPreferences(context).getString(Constants.PREFERENCES_KEY_RANDOM_SIZE, "20"))); // ex: default 20 -> 50 capacity = shuffleListSize * 5 / 2; capacity = Math.min(500, capacity); |