From 236541a9150567901af78ba360a9da0d70b0635e Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 3 Jul 2015 16:28:59 +0200 Subject: [PATCH] Uncheck disabled settings. --- .../syncthingandroid/fragments/SettingsFragment.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java index 509c5ba9..e4cfa68a 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java @@ -221,11 +221,17 @@ public class SettingsFragment extends PreferenceFragment if (preference.equals(mSyncOnlyCharging) || preference.equals(mSyncOnlyWifi)) { mSyncthingService.updateState(); } else if (preference.equals(mAlwaysRunInBackground)) { - preference.setSummary(((Boolean) o) + boolean value = (Boolean) o; + preference.setSummary((value) ? R.string.always_run_in_background_enabled : R.string.always_run_in_background_disabled); - mSyncOnlyCharging.setEnabled((Boolean) o); - mSyncOnlyWifi.setEnabled((Boolean) o); + mSyncOnlyCharging.setEnabled(value); + mSyncOnlyWifi.setEnabled(value); + // Uncheck items when disabled, so it is clear they have no effect. + if (!value) { + mSyncOnlyCharging.setChecked(false); + mSyncOnlyWifi.setChecked(false); + } } else if (preference.equals(mUseRoot)) { if (!(Boolean) o) new Thread(new ChownFilesRunnable()).start();