mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-23 12:51: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:
commit
a0a3a855c7
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue