From 157ff5887feece779da13157ea71cbe4a8e8899c Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Fri, 4 Oct 2013 15:49:51 -0700 Subject: Added constant for pausing on disconnect --- src/github/daneren2005/dsub/util/Constants.java | 1 + 1 file changed, 1 insertion(+) 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"; -- cgit v1.2.3 From 2421212b8339c5712ce85f55ab2137bda2483d04 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Fri, 4 Oct 2013 15:56:55 -0700 Subject: #90 Add option to not pause on headphone disconnect --- .../daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index dbdd830d..ef11ea22 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(); + } } } }); -- cgit v1.2.3 From 15a2868be3f4b64dca2856c17055a52798f86c18 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Fri, 4 Oct 2013 16:02:10 -0700 Subject: #90 Add option to not pause on bluetooth disconnect --- src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 +} -- cgit v1.2.3