Moved accessing sharedPreferences into PreferencesUtils.

This commit is contained in:
Dennis Guse
2019-11-03 00:54:34 +01:00
parent bc5ab0d7e5
commit 353c958ae0
17 changed files with 114 additions and 82 deletions
@@ -87,7 +87,7 @@ public class BluetoothRemoteSensorManager {
private final SharedPreferences.OnSharedPreferenceChangeListener sharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
if (bluetoothConnectionManager != null && key == null || key.equals(PreferencesUtils.getKey(context, R.string.bluetooth_sensor_key))) {
if (bluetoothConnectionManager != null && PreferencesUtils.isKey(context, R.string.bluetooth_sensor_key, key)) {
String address = PreferencesUtils.getString(context, R.string.bluetooth_sensor_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT);
if (address.equals(PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT)) {
stop();