aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java')
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index b3349b4..e09ae34 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -131,30 +131,27 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
}
@Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
- String key) {
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (BluetoothGpsProviderService.PREF_START_GPS_PROVIDER.equals(key)){
- boolean val = false;
- if (val = sharedPreferences.getBoolean(key, false)){
+ boolean val = sharedPreferences.getBoolean(key, false);
+ CheckBoxPreference pref = (CheckBoxPreference)findPreference(key);
+ if (pref.isChecked() != val){
+ pref.setChecked(val);
+ } else if (val){
startService(new Intent(BluetoothGpsProviderService.ACTION_START_GPS_PROVIDER));
} else {
startService(new Intent(BluetoothGpsProviderService.ACTION_STOP_GPS_PROVIDER));
}
+ } else if (BluetoothGpsProviderService.PREF_TRACK_RECORDING.equals(key)){
+ boolean val = sharedPreferences.getBoolean(key, false);
CheckBoxPreference pref = (CheckBoxPreference)findPreference(key);
if (pref.isChecked() != val){
pref.setChecked(val);
- }
- } else if (BluetoothGpsProviderService.PREF_TRACK_RECORDING.equals(key)){
- boolean val = false;
- if (val = sharedPreferences.getBoolean(key, false)){
+ } else if (val){
startService(new Intent(BluetoothGpsProviderService.ACTION_START_TRACK_RECORDING));
} else {
startService(new Intent(BluetoothGpsProviderService.ACTION_STOP_TRACK_RECORDING));
}
- CheckBoxPreference pref = (CheckBoxPreference)findPreference(key);
- if (pref.isChecked() != val){
- pref.setChecked(val);
- }
} else if (BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE.equals(key)){
updateDevicePreferenceSummary();
}