added on/off summaries
This commit is contained in:
@@ -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) {
|
final String authority) {
|
||||||
boolean syncEnabled = ContentResolver.getSyncAutomatically(account, authority);
|
boolean syncEnabled = ContentResolver.getSyncAutomatically(account, authority);
|
||||||
syncCheckBox.setChecked(syncEnabled);
|
syncCheckBox.setChecked(syncEnabled);
|
||||||
|
setSummary(syncCheckBox, authority, syncEnabled);
|
||||||
|
|
||||||
syncCheckBox.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
syncCheckBox.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -520,10 +522,33 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
// cancel any ongoing/pending syncs
|
// cancel any ongoing/pending syncs
|
||||||
ContentResolver.cancelSync(account, authority);
|
ContentResolver.cancelSync(account, authority);
|
||||||
}
|
}
|
||||||
|
setSummary(syncCheckBox, authority, syncEnabled);
|
||||||
return true;
|
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) {
|
protected boolean isValidFragment(String fragmentName) {
|
||||||
|
|||||||
@@ -177,9 +177,13 @@
|
|||||||
<string name="pref_keybase_summary">"Search keys on keybase.io"</string>
|
<string name="pref_keybase_summary">"Search keys on keybase.io"</string>
|
||||||
|
|
||||||
<string name="label_sync_settings_keyserver_title">"Automatically update keys"</string>
|
<string name="label_sync_settings_keyserver_title">"Automatically update keys"</string>
|
||||||
<string name="label_sync_settings_keyserver_summary">"Updates keys older than a week, from the preferred keyserver"</string>
|
<string name="label_sync_settings_keyserver_summary_on">"Keys older than a week are updated from the preferred keyserver"</string>
|
||||||
|
<string name="label_sync_settings_keyserver_summary_off">"Keys not automatically updated"</string>
|
||||||
<string name="label_sync_settings_contacts_title">"Sync Contacts with Keys"</string>
|
<string name="label_sync_settings_contacts_title">"Sync Contacts with Keys"</string>
|
||||||
<string name="label_sync_settings_contacts_summary">"Associates contacts with imported keys, based on email, completely offline"</string>
|
<string name="label_sync_settings_contacts_summary_on">"Keys linked to contacts with matching emails, happens completely offline"</string>
|
||||||
|
<string name="label_sync_settings_contacts_summary_off">"New keys will not be linked to contacts"</string>
|
||||||
|
<!-- label shown in Android settings under the OpenKeychain account -->
|
||||||
|
<string name="keyserver_sync_settings_title">"Automatically update keys"</string>
|
||||||
|
|
||||||
<!-- Proxy Preferences -->
|
<!-- Proxy Preferences -->
|
||||||
<string name="pref_proxy_tor_title">"Enable Tor"</string>
|
<string name="pref_proxy_tor_title">"Enable Tor"</string>
|
||||||
@@ -1358,7 +1362,6 @@
|
|||||||
<string name="passp_cache_notif_pwd">"Password"</string>
|
<string name="passp_cache_notif_pwd">"Password"</string>
|
||||||
|
|
||||||
<!-- Keyserver sync -->
|
<!-- Keyserver sync -->
|
||||||
<string name="keyserver_sync_settings_title">"Update Keys from Cloud"</string>
|
|
||||||
<string name="keyserver_sync_orbot_notif_title">"Sync From Cloud requires Orbot"</string>
|
<string name="keyserver_sync_orbot_notif_title">"Sync From Cloud requires Orbot"</string>
|
||||||
<string name="keyserver_sync_orbot_notif_msg">"Tap to start orbot"</string>
|
<string name="keyserver_sync_orbot_notif_msg">"Tap to start orbot"</string>
|
||||||
<string name="keyserver_sync_orbot_notif_start">"Start Orbot"</string>
|
<string name="keyserver_sync_orbot_notif_start">"Start Orbot"</string>
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="syncKeyserver"
|
android:key="syncKeyserver"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/label_sync_settings_keyserver_title"
|
android:title="@string/label_sync_settings_keyserver_title"/>
|
||||||
android:summary="@string/label_sync_settings_keyserver_summary" />
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="syncContacts"
|
android:key="syncContacts"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/label_sync_settings_contacts_title"
|
android:title="@string/label_sync_settings_contacts_title" />
|
||||||
android:summary="@string/label_sync_settings_contacts_summary" />
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
Reference in New Issue
Block a user