1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-23 04:41:16 +00:00

Merge pull request #497 from capi/fix-settings-change-racecondition

Fix "Wifi only" / "Charging only" not being applied immediately
This commit is contained in:
Felix Ableitner 2015-11-15 17:46:45 +01:00
commit a0a3a855c7
2 changed files with 3 additions and 3 deletions

View file

@ -227,9 +227,7 @@ public class SettingsFragment extends PreferenceFragment
boolean requireRestart = false; boolean requireRestart = false;
if (preference.equals(mSyncOnlyCharging) || preference.equals(mSyncOnlyWifi)) { if (preference.equals(mAlwaysRunInBackground)) {
mSyncthingService.updateState();
} else if (preference.equals(mAlwaysRunInBackground)) {
boolean value = (Boolean) o; boolean value = (Boolean) o;
preference.setSummary((value) preference.setSummary((value)
? R.string.always_run_in_background_enabled ? R.string.always_run_in_background_enabled

View file

@ -268,6 +268,8 @@ public class SyncthingService extends Service implements
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(PREF_NOTIFICATION_TYPE)) if (key.equals(PREF_NOTIFICATION_TYPE))
updateNotification(); updateNotification();
else if (key.equals(PREF_SYNC_ONLY_CHARGING) || key.equals(PREF_SYNC_ONLY_WIFI))
updateState();
} }
/** /**