diff options
Diffstat (limited to 'app/src/main/java/github/daneren2005')
3 files changed, 9 insertions, 5 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 ae6e46ee..10ef0e0d 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -1042,6 +1042,8 @@ public class DownloadService extends Service { bufferAndPlay(position, start); checkDownloads(); setNextPlaying(); + } else { + checkDownloads(); } } } @@ -1716,10 +1718,7 @@ public class DownloadService extends Service { setNextPlayerState(IDLE); } } - - if(remoteState == LOCAL) { - checkDownloads(); - } + checkDownloads(); if(routeId != null) { final Runnable delayedReconnect = new Runnable() { @@ -2154,7 +2153,7 @@ public class DownloadService extends Service { int preloaded = 0; - if(n != 0 && remoteState == LOCAL) { + if(n != 0 && (remoteState == LOCAL || Util.shouldCacheDuringCasting(this))) { int start = currentPlaying == null ? 0 : getCurrentPlayingIndex(); if(start == -1) { start = 0; diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java index 541f342e..ec3489ab 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java @@ -173,6 +173,7 @@ public final class Constants { public static final String PREFERENCES_KEY_CAST_GAPLESS_PLAYBACK = "castingGaplessPlayback"; public static final String PREFERENCES_KEY_CAST_STREAM_ORIGINAL = "castStreamOriginal"; public static final String PREFERENCES_KEY_HEADS_UP_NOTIFICATION = "headsUpNotification"; + public static final String PREFERENCES_KEY_CAST_CACHE = "castCache"; public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount"; public static final String OFFLINE_SCROBBLE_ID = "scrobbleID"; diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java index 435c33c0..7efb020d 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Util.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java @@ -694,6 +694,10 @@ public final class Util { editor.commit(); } + public static boolean shouldCacheDuringCasting(Context context) { + return Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CAST_CACHE, false); + } + public static boolean shouldStartOnHeadphones(Context context) { SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_START_ON_HEADPHONES, false); |