aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-03-28 17:24:48 -0700
committerScott Jackson <daneren2005@gmail.com>2016-03-28 17:24:48 -0700
commit8006545a86a0158ff9ede9c8cf7b547ab2d1686a (patch)
treefd77f2b44352eaf3e3db63502837582e3ce87661 /app/src/main/java/github/daneren2005
parent79a92bd6f401aef9095b48e5e47570b7c1b1159e (diff)
downloaddsub-8006545a86a0158ff9ede9c8cf7b547ab2d1686a.tar.gz
dsub-8006545a86a0158ff9ede9c8cf7b547ab2d1686a.tar.bz2
dsub-8006545a86a0158ff9ede9c8cf7b547ab2d1686a.zip
Fixes #667: Add optional caching while casting
Diffstat (limited to 'app/src/main/java/github/daneren2005')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java9
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Util.java4
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);