aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-10-04 22:38:48 -0700
committerScott Jackson <daneren2005@gmail.com>2013-10-04 22:38:48 -0700
commit50f996b85834970689ff667f1c53c038d0c089de (patch)
tree4f2e0d468b07003df66ccfb52d04302415a9da2b /src/github/daneren2005
parentcaeef7ad091471f5f23596c5ef95e6fd55c23a4d (diff)
downloaddsub-50f996b85834970689ff667f1c53c038d0c089de.tar.gz
dsub-50f996b85834970689ff667f1c53c038d0c089de.tar.bz2
dsub-50f996b85834970689ff667f1c53c038d0c089de.zip
#90 Make disconnect pause optional
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/activity/SettingsActivity.java3
-rw-r--r--src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java4
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java4
3 files changed, 9 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java
index 89d475d3..06a99ce6 100644
--- a/src/github/daneren2005/dsub/activity/SettingsActivity.java
+++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java
@@ -68,6 +68,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
private ListPreference preloadCountMobile;
private EditTextPreference randomSize;
private ListPreference tempLoss;
+ private ListPreference pauseDisconnect;
private EditTextPreference bufferLength;
private Preference addServerPreference;
private PreferenceCategory serversCategory;
@@ -95,6 +96,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
preloadCountMobile = (ListPreference) findPreference(Constants.PREFERENCES_KEY_PRELOAD_COUNT_MOBILE);
randomSize = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_RANDOM_SIZE);
tempLoss = (ListPreference) findPreference(Constants.PREFERENCES_KEY_TEMP_LOSS);
+ pauseDisconnect = (ListPreference) findPreference(Constants.PREFERENCES_KEY_PAUSE_DISCONNECT);
bufferLength = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_BUFFER_LENGTH);
addServerPreference = (Preference) findPreference(Constants.PREFERENCES_KEY_SERVER_ADD);
serversCategory = (PreferenceCategory) findPreference(Constants.PREFERENCES_KEY_SERVER_KEY);
@@ -240,6 +242,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
preloadCountMobile.setSummary(preloadCountMobile.getEntry());
randomSize.setSummary(randomSize.getText());
tempLoss.setSummary(tempLoss.getEntry());
+ pauseDisconnect.setSummary(pauseDisconnect.getEntry());
bufferLength.setSummary(bufferLength.getText() + " seconds");
chatRefreshRate.setSummary(chatRefreshRate.getText());
videoPlayer.setSummary(videoPlayer.getEntry());
diff --git a/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java b/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java
index 8af0b462..ab46c784 100644
--- a/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java
+++ b/src/github/daneren2005/dsub/receiver/BluetoothIntentReceiver.java
@@ -22,8 +22,10 @@ import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.util.Log;
import github.daneren2005.dsub.service.DownloadServiceImpl;
+import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.Util;
/**
@@ -45,7 +47,7 @@ public class BluetoothIntentReceiver extends BroadcastReceiver {
} else if (isDisconnected(intent)) {
Log.i(TAG, "Disconnected from Bluetooth A2DP, requesting pause.");
SharedPreferences prefs = Util.getPreferences(context);
- int pausePref = Integer.parseInt(prefs.getString(PREFERENCES_KEY_PAUSE_DISCONNECT, "0"));
+ int pausePref = Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_PAUSE_DISCONNECT, "0"));
if(pausePref == 0 || pausePref == 2) {
context.sendBroadcast(new Intent(DownloadServiceImpl.CMD_PAUSE));
}
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index 6a4f54a8..563565b2 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -31,6 +31,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.SharedPreferences;
import android.media.RemoteControlClient;
import android.os.AsyncTask;
import android.os.Build;
@@ -43,6 +44,7 @@ import android.view.KeyEvent;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.domain.PlayerState;
import github.daneren2005.dsub.util.CacheCleaner;
+import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.Util;
@@ -142,7 +144,7 @@ public class DownloadServiceLifecycleSupport {
public void run() {
if(!downloadService.isRemoteEnabled()) {
SharedPreferences prefs = Util.getPreferences(downloadService);
- int pausePref = Integer.parseInt(prefs.getString(PREFERENCES_KEY_PAUSE_DISCONNECT, "0"));
+ int pausePref = Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_PAUSE_DISCONNECT, "0"));
if(pausePref == 0 || pausePref == 1) {
downloadService.pause();
}