diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java index d1f73610..fe6a8291 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java @@ -227,9 +227,7 @@ public class SettingsFragment extends PreferenceFragment boolean requireRestart = false; - if (preference.equals(mSyncOnlyCharging) || preference.equals(mSyncOnlyWifi)) { - mSyncthingService.updateState(); - } else if (preference.equals(mAlwaysRunInBackground)) { + if (preference.equals(mAlwaysRunInBackground)) { boolean value = (Boolean) o; preference.setSummary((value) ? R.string.always_run_in_background_enabled diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java index c9e23201..fd9e7ee6 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java @@ -268,6 +268,8 @@ public class SyncthingService extends Service implements public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals(PREF_NOTIFICATION_TYPE)) updateNotification(); + else if (key.equals(PREF_SYNC_ONLY_CHARGING) || key.equals(PREF_SYNC_ONLY_WIFI)) + updateState(); } /**