aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-10-04 21:24:08 -0700
committerScott Jackson <daneren2005@gmail.com>2013-10-04 21:24:08 -0700
commitcaeef7ad091471f5f23596c5ef95e6fd55c23a4d (patch)
treec7bf363f1c3da64057221abe11e79640209c1b2b /src
parentc2dcb58813ac18f4717cf01ceeb4fe6a2e0bb7be (diff)
parent15a2868be3f4b64dca2856c17055a52798f86c18 (diff)
downloaddsub-caeef7ad091471f5f23596c5ef95e6fd55c23a4d.tar.gz
dsub-caeef7ad091471f5f23596c5ef95e6fd55c23a4d.tar.bz2
dsub-caeef7ad091471f5f23596c5ef95e6fd55c23a4d.zip
Merge branch 'master' of https://github.com/daneren2005/Subsonic
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java8
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java6
-rw-r--r--src/github/daneren2005/dsub/util/Constants.java1
3 files changed, 12 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java b/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java
index 567cf8f4..8af0b462 100644
--- a/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java
+++ b/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java
@@ -44,7 +44,11 @@ public class BluetoothIntentReceiver extends BroadcastReceiver {
Util.registerMediaButtonEventReceiver(context);
} else if (isDisconnected(intent)) {
Log.i(TAG, "Disconnected from Bluetooth A2DP, requesting pause.");
- context.sendBroadcast(new Intent(DownloadServiceImpl.CMD_PAUSE));
+ SharedPreferences prefs = Util.getPreferences(context);
+ int pausePref = Integer.parseInt(prefs.getString(PREFERENCES_KEY_PAUSE_DISCONNECT, "0"));
+ if(pausePref == 0 || pausePref == 2) {
+ context.sendBroadcast(new Intent(DownloadServiceImpl.CMD_PAUSE));
+ }
}
}
private boolean isConnected(Intent intent) {
@@ -75,4 +79,4 @@ public class BluetoothIntentReceiver extends BroadcastReceiver {
}
return false;
}
-} \ No newline at end of file
+}
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index 299371c8..6a4f54a8 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -141,7 +141,11 @@ public class DownloadServiceLifecycleSupport {
@Override
public void run() {
if(!downloadService.isRemoteEnabled()) {
- downloadService.pause();
+ SharedPreferences prefs = Util.getPreferences(downloadService);
+ int pausePref = Integer.parseInt(prefs.getString(PREFERENCES_KEY_PAUSE_DISCONNECT, "0"));
+ if(pausePref == 0 || pausePref == 1) {
+ downloadService.pause();
+ }
}
}
});
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java
index 4cd44514..bdeeb920 100644
--- a/src/github/daneren2005/dsub/util/Constants.java
+++ b/src/github/daneren2005/dsub/util/Constants.java
@@ -116,6 +116,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_CHAT_ENABLED = "chatEnabled";
public static final String PREFERENCES_KEY_VIDEO_PLAYER = "videoPlayer";
public static final String PREFERENCES_KEY_CONTROL_MODE = "remoteControlMode";
+ public static final String PREFERENCES_KEY_PAUSE_DISCONNECT = "pauseOnDisconnect";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";