aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-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
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/settings_cast.xml6
5 files changed, 17 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);
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ee4af53c..b201b4cb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -472,6 +472,8 @@
<string name="settings.casting_stream_original_summary">Stream original files where supported by cast device</string>
<string name="settings.heads_up_notification">Heads Up Notifications (5.0+)</string>
<string name="settings.heads_up_notification_summary">Show playing notifications as Heads Up notifications (Android Lollipop+ only)</string>
+ <string name="settings.casting_cache">Cache While Casting</string>
+ <string name="settings.casting_cache_summary">Cache currently playing songs while casting</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/app/src/main/res/xml/settings_cast.xml b/app/src/main/res/xml/settings_cast.xml
index 45766162..c23ae04d 100644
--- a/app/src/main/res/xml/settings_cast.xml
+++ b/app/src/main/res/xml/settings_cast.xml
@@ -21,5 +21,11 @@
android:summary="@string/settings.casting_stream_original_summary"
android:key="castStreamOriginal"
android:defaultValue="true"/>
+
+ <CheckBoxPreference
+ android:title="@string/settings.casting_cache"
+ android:summary="@string/settings.casting_cache_summary"
+ android:key="castCache"
+ android:defaultValue="false"/>
</PreferenceCategory>
</PreferenceScreen> \ No newline at end of file