Get rid of "on/off" descriptions for checkbox prefs

Closes #149
This commit is contained in:
Daniel Martí 2015-02-25 19:51:01 +01:00
parent da01be7986
commit c09708a09e
2 changed files with 15 additions and 45 deletions

View File

@ -12,7 +12,6 @@
<string name="enable_nfc_send">Enable NFC Send…</string>
<string name="cache_downloaded">App cache</string>
<string name="cache_downloaded_on">Keep downloaded apk files on SD card</string>
<string name="cache_downloaded_off">Do not keep any apk files</string>
<string name="updates">Updates</string>
<string name="other">Other</string>
<string name="last_update_check">Last repo scan: %s</string>
@ -22,26 +21,20 @@
<string name="update_interval_zero">No automatic app list updates</string>
<string name="automatic_scan_wifi">Only on wifi</string>
<string name="automatic_scan_wifi_on">Update app lists automatically only on wifi</string>
<string name="automatic_scan_wifi_off">Always update app lists automatically</string>
<string name="notify">Notify</string>
<string name="notify_on">Notify when updates are available</string>
<string name="notify_off">Do not notify of any updates</string>
<string name="update_history">Update history</string>
<string name="update_history_summ">Days to consider apps new or recent: %s</string>
<string name="root_installer">Install using root access</string>
<string name="root_installer_on">Request root access to install, update, and remove packages</string>
<string name="root_installer_off">Do not request root access to install, update, and remove packages</string>
<string name="system_installer">Install using system-permissions</string>
<string name="system_installer_on">Use system permissions to install, update, and remove packages</string>
<string name="system_installer_off">Do not use system permissions to install, update, and remove packages</string>
<string name="local_repo_bonjour">Broadcast Local Repo</string>
<string name="local_repo_bonjour_on">Advertise your local repo using Bonjour (mDNS)</string>
<string name="local_repo_bonjour_off">Do not advertise your local repo.</string>
<string name="local_repo_name">Name of your Local Repo</string>
<string name="local_repo_name_summary">The advertised title of your local repo: %s</string>
<string name="local_repo_https">Use Private Connection</string>
<string name="local_repo_https_on">Use encrypted HTTPS:// connection for local repo</string>
<string name="local_repo_https_off">Use insecure HTTP:// connection for local repo</string>
<string name="search_results">Search Results</string>
<string name="app_details">App Details</string>
@ -147,20 +140,16 @@
<string name="expert">Expert</string>
<string name="expert_on">Show extra info and enable extra settings</string>
<string name="expert_off">Hide extras for experienced users</string>
<string name="search_hint">Search applications</string>
<string name="appcompatibility">Application compatibility</string>
<string name="show_incompat_versions">Incompatible versions</string>
<string name="show_incompat_versions_on">Show app versions incompatible with the device</string>
<string name="show_incompat_versions_off">Hide app versions incompatible with the device</string>
<string name="rooted">Root</string>
<string name="rooted_on">Do not grey out apps requiring root privileges</string>
<string name="rooted_off">Grey out apps requiring root privileges</string>
<string name="ignoreTouch">Ignore Touchscreen</string>
<string name="ignoreTouch_on">Always include apps that require touchscreen</string>
<string name="ignoreTouch_off">Filter apps normally</string>
<string name="category_all">All</string>
<string name="category_whatsnew">What\'s New</string>
@ -227,11 +216,9 @@
<string name="permissions_for_long">Permissions for version %s</string>
<string name="showPermissions">Show permissions</string>
<string name="showPermissions_on">Display a list of permissions an app requires</string>
<string name="showPermissions_off">Don\'t show permissions before downloading</string>
<string name="no_handler_app">You don\'t have any available app that can handle %s</string>
<string name="compactlayout">Compact Layout</string>
<string name="compactlayout_on">Show icons at a smaller size</string>
<string name="compactlayout_off">Show icons at regular size</string>
<string name="theme">Theme</string>
<string name="unsigned">Unsigned</string>
<string name="unverified">Unverified</string>

View File

@ -48,13 +48,9 @@ public class PreferenceFragment
addPreferencesFromResource(R.xml.preferences);
}
protected void onoffSummary(String key, int on, int off) {
protected void checkSummary(String key, int resId) {
CheckBoxPreference pref = (CheckBoxPreference)findPreference(key);
if (pref.isChecked()) {
pref.setSummary(on);
} else {
pref.setSummary(off);
}
pref.setSummary(resId);
}
protected void entrySummary(String key) {
@ -85,23 +81,19 @@ public class PreferenceFragment
}
} else if (key.equals(Preferences.PREF_UPD_WIFI_ONLY)) {
onoffSummary(key, R.string.automatic_scan_wifi_on,
R.string.automatic_scan_wifi_off);
checkSummary(key, R.string.automatic_scan_wifi_on);
} else if (key.equals(Preferences.PREF_UPD_NOTIFY)) {
onoffSummary(key, R.string.notify_on,
R.string.notify_off);
checkSummary(key, R.string.notify_on);
} else if (key.equals(Preferences.PREF_UPD_HISTORY)) {
textSummary(key, R.string.update_history_summ);
} else if (key.equals(Preferences.PREF_PERMISSIONS)) {
onoffSummary(key, R.string.showPermissions_on,
R.string.showPermissions_off);
checkSummary(key, R.string.showPermissions_on);
} else if (key.equals(Preferences.PREF_COMPACT_LAYOUT)) {
onoffSummary(key, R.string.compactlayout_on,
R.string.compactlayout_off);
checkSummary(key, R.string.compactlayout_on);
} else if (key.equals(Preferences.PREF_THEME)) {
entrySummary(key);
@ -111,43 +103,34 @@ public class PreferenceFragment
}
} else if (key.equals(Preferences.PREF_INCOMP_VER)) {
onoffSummary(key, R.string.show_incompat_versions_on,
R.string.show_incompat_versions_off);
checkSummary(key, R.string.show_incompat_versions_on);
} else if (key.equals(Preferences.PREF_ROOTED)) {
onoffSummary(key, R.string.rooted_on,
R.string.rooted_off);
checkSummary(key, R.string.rooted_on);
} else if (key.equals(Preferences.PREF_IGN_TOUCH)) {
onoffSummary(key, R.string.ignoreTouch_on,
R.string.ignoreTouch_off);
checkSummary(key, R.string.ignoreTouch_on);
} else if (key.equals(Preferences.PREF_LOCAL_REPO_BONJOUR)) {
onoffSummary(key, R.string.local_repo_bonjour_on,
R.string.local_repo_bonjour_off);
checkSummary(key, R.string.local_repo_bonjour_on);
} else if (key.equals(Preferences.PREF_LOCAL_REPO_NAME)) {
textSummary(key, R.string.local_repo_name_summary);
} else if (key.equals(Preferences.PREF_LOCAL_REPO_HTTPS)) {
onoffSummary(key, R.string.local_repo_https_on,
R.string.local_repo_https_off);
checkSummary(key, R.string.local_repo_https_on);
} else if (key.equals(Preferences.PREF_CACHE_APK)) {
onoffSummary(key, R.string.cache_downloaded_on,
R.string.cache_downloaded_off);
checkSummary(key, R.string.cache_downloaded_on);
} else if (key.equals(Preferences.PREF_EXPERT)) {
onoffSummary(key, R.string.expert_on,
R.string.expert_off);
checkSummary(key, R.string.expert_on);
} else if (key.equals(Preferences.PREF_ROOT_INSTALLER)) {
onoffSummary(key, R.string.root_installer_on,
R.string.root_installer_off);
checkSummary(key, R.string.root_installer_on);
} else if (key.equals(Preferences.PREF_SYSTEM_INSTALLER)) {
onoffSummary(key, R.string.system_installer_on,
R.string.system_installer_off);
checkSummary(key, R.string.system_installer_on);
} else if (key.equals(Preferences.PREF_ENABLE_PROXY)) {
CheckBoxPreference pref = (CheckBoxPreference) findPreference(key);