From fad5688f698bd10d91e730e4c5ee284e238d2faa Mon Sep 17 00:00:00 2001 From: Herbert von Broeuschmeul Date: Thu, 30 Sep 2010 23:37:15 +0100 Subject: rewrite connection/disconnection parts Conflicts: src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java --- .../bluetooth/provider/BluetoothGpsActivity.java | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java') diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java index f5f936e..a398e19 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(); } else if (BluetoothGpsProviderService.PREF_SIRF_ENABLE_GLL.equals(key) -- cgit v1.1