diff options
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java index 0ae0c62a5..842059da5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java @@ -503,10 +503,12 @@ public class SettingsActivity extends AppCompatPreferenceActivity { ); } - private void initializeSyncCheckBox(CheckBoxPreference syncCheckBox, final Account account, + private void initializeSyncCheckBox(final CheckBoxPreference syncCheckBox, + final Account account, final String authority) { boolean syncEnabled = ContentResolver.getSyncAutomatically(account, authority); syncCheckBox.setChecked(syncEnabled); + setSummary(syncCheckBox, authority, syncEnabled); syncCheckBox.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @@ -520,10 +522,33 @@ public class SettingsActivity extends AppCompatPreferenceActivity { // cancel any ongoing/pending syncs ContentResolver.cancelSync(account, authority); } + setSummary(syncCheckBox, authority, syncEnabled); return true; } }); } + + private void setSummary(CheckBoxPreference syncCheckBox, String authority, + boolean checked) { + switch (authority) { + case Constants.PROVIDER_AUTHORITY: { + if (checked) { + syncCheckBox.setSummary(R.string.label_sync_settings_keyserver_summary_on); + } else { + syncCheckBox.setSummary(R.string.label_sync_settings_keyserver_summary_off); + } + break; + } + case ContactsContract.AUTHORITY: { + if (checked) { + syncCheckBox.setSummary(R.string.label_sync_settings_contacts_summary_on); + } else { + syncCheckBox.setSummary(R.string.label_sync_settings_contacts_summary_off); + } + break; + } + } + } } protected boolean isValidFragment(String fragmentName) { |