From c09708a09e884a21ccc4f9c564c1e8f3308cdb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 25 Feb 2015 19:51:01 +0100 Subject: [PATCH] Get rid of "on/off" descriptions for checkbox prefs Closes #149 --- F-Droid/res/values/strings.xml | 13 ----- .../views/fragments/PreferenceFragment.java | 47 ++++++------------- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/F-Droid/res/values/strings.xml b/F-Droid/res/values/strings.xml index 9d375edc4..feea22715 100644 --- a/F-Droid/res/values/strings.xml +++ b/F-Droid/res/values/strings.xml @@ -12,7 +12,6 @@ Enable NFC Send… App cache Keep downloaded apk files on SD card - Do not keep any apk files Updates Other Last repo scan: %s @@ -22,26 +21,20 @@ No automatic app list updates Only on wifi Update app lists automatically only on wifi - Always update app lists automatically Notify Notify when updates are available - Do not notify of any updates Update history Days to consider apps new or recent: %s Install using root access Request root access to install, update, and remove packages - Do not request root access to install, update, and remove packages Install using system-permissions Use system permissions to install, update, and remove packages - Do not use system permissions to install, update, and remove packages Broadcast Local Repo Advertise your local repo using Bonjour (mDNS) - Do not advertise your local repo. Name of your Local Repo The advertised title of your local repo: %s Use Private Connection Use encrypted HTTPS:// connection for local repo - Use insecure HTTP:// connection for local repo Search Results App Details @@ -147,20 +140,16 @@ Expert Show extra info and enable extra settings - Hide extras for experienced users Search applications Application compatibility Incompatible versions Show app versions incompatible with the device - Hide app versions incompatible with the device Root Do not grey out apps requiring root privileges - Grey out apps requiring root privileges Ignore Touchscreen Always include apps that require touchscreen - Filter apps normally All What\'s New @@ -227,11 +216,9 @@ Permissions for version %s Show permissions Display a list of permissions an app requires - Don\'t show permissions before downloading You don\'t have any available app that can handle %s Compact Layout Show icons at a smaller size - Show icons at regular size Theme Unsigned Unverified diff --git a/F-Droid/src/org/fdroid/fdroid/views/fragments/PreferenceFragment.java b/F-Droid/src/org/fdroid/fdroid/views/fragments/PreferenceFragment.java index b3a7cdb59..a5db36c9a 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/fragments/PreferenceFragment.java +++ b/F-Droid/src/org/fdroid/fdroid/views/fragments/PreferenceFragment.java @@ -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);