diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java b/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java index 3a9f3b82..f72de469 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java @@ -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 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