1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-25 19:35:53 +00:00

Remove SharedPreferences.OnSharedPreferenceChangeListener

This commit is contained in:
Catfriend1 2018-07-26 12:21:29 +02:00
parent 50ea1e47de
commit a1e0b10e7b

View file

@ -36,7 +36,7 @@ import javax.inject.Inject;
* This information is actively read on instance creation, and then updated from intents
* that are passed with {@link #ACTION_DEVICE_STATE_CHANGED}.
*/
public class RunConditionMonitor implements SharedPreferences.OnSharedPreferenceChangeListener {
public class RunConditionMonitor {
private static final String TAG = "RunConditionMonitor";
@ -73,7 +73,7 @@ public class RunConditionMonitor implements SharedPreferences.OnSharedPreference
Log.v(TAG, "Created new instance");
((SyncthingApp) context.getApplicationContext()).component().inject(this);
mContext = context;
mPreferences.registerOnSharedPreferenceChangeListener(this);
// ToDo mPreferences.registerOnSharedPreferenceChangeListener(this);
mOnRunConditionChangedListener = listener;
/**
@ -105,28 +105,18 @@ public class RunConditionMonitor implements SharedPreferences.OnSharedPreference
public void shutdown() {
Log.v(TAG, "Shutting down");
mPreferences.unregisterOnSharedPreferenceChangeListener(this);
ContentResolver.removeStatusChangeListener(mSyncStatusObserver);
mReceiverManager.unregisterAllReceivers(mContext);
}
/*
// ToDo
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
List<String> watched = Lists.newArrayList(
Constants.PREF_RUN_ON_MOBILE_DATA,
Constants.PREF_RUN_ON_WIFI,
Constants.PREF_RUN_ON_METERED_WIFI,
Constants.PREF_WIFI_SSID_WHITELIST,
Constants.PREF_POWER_SOURCE,
Constants.PREF_RUN_IN_FLIGHT_MODE,
Constants.PREF_RESPECT_BATTERY_SAVING,
Constants.PREF_RESPECT_MASTER_SYNC
);
if (watched.contains(key)) {
// Force a re-evaluation of which run conditions apply according to the changed prefs.
updateShouldRunDecision();
}
public void onRunConditionPreferencesChanged() {
// Force a re-evaluation of which run conditions apply according to the changed prefs.
updateShouldRunDecision();
}
*/
private class BatteryReceiver extends BroadcastReceiver {
@Override