From 15a2868be3f4b64dca2856c17055a52798f86c18 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Fri, 4 Oct 2013 16:02:10 -0700 Subject: [PATCH] #90 Add option to not pause on bluetooth disconnect --- .../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 567cf8f42..8af0b462f 100644 --- a/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java +++ b/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java @@ -44,7 +44,11 @@ public void onReceive(Context context, Intent intent) { 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 @@ else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(intent.getAction())) { } return false; } -} \ No newline at end of file +}