From 9a88af8e4103483f7eda54f4bf61280017c1e817 Mon Sep 17 00:00:00 2001 From: lado Date: Fri, 4 Nov 2011 01:32:49 +0100 Subject: streamdev auth --- .../vdrmanager/gui/PreferencesActivity.java | 168 +-------------------- 1 file changed, 1 insertion(+), 167 deletions(-) (limited to 'vdrmanager/src/de/bjusystems') diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java index d741004..c633b50 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java @@ -20,7 +20,7 @@ import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.app.VdrManagerApp; import de.bjusystems.vdrmanager.data.Preferences; -public class PreferencesActivity extends PreferenceActivity implements +public class PreferencesActivity extends BasePreferencesActivity implements OnSharedPreferenceChangeListener, OnPreferenceChangeListener, OnPreferenceClickListener { // @@ -171,171 +171,5 @@ public class PreferencesActivity extends PreferenceActivity implements return true; } - private void updateSummary(Preference ep) { - if (ep instanceof EditTextPreference) { - updateSummary((EditTextPreference) ep); - } else if (ep instanceof ListPreference) { - updateSummary((ListPreference) ep); - } - } - - /** - * If text set add it to the summary - * - * @param ep - */ - private void updateSummary(EditTextPreference ep) { - String text = ep.getText(); - if (text == null) { - return; - } - - if(isPassword(ep.getEditText())){ - text = text.replaceAll(".", "*"); - } - - setSummary(text, ep); - } - - private boolean isPassword(EditText et){ - if((et.getInputType() & EditorInfo.TYPE_TEXT_VARIATION_PASSWORD) == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD){ - return true; - } - return false; - } - - private void setSummary(CharSequence text, DialogPreference ep){ - CharSequence sm = ep.getSummary(); - String sum; - if (sm != null) { - sum = ep.getSummary().toString(); - sum = substringBeforeLast(sum, - getString(R.string.prefs_current_value)).trim(); - } else { - sum = ""; - } - - if(TextUtils.isEmpty(text)){ - text = getString(R.string.prefs_current_value_not_set); - } - - if (isBlank(sum)) { - sum = getString(R.string.prefs_current_value_template, text); - } else { - sum = sum + " " - + getString(R.string.prefs_current_value_template, text); - } - ep.setSummary(sum); - } - private void updateSummary(ListPreference ep) { - CharSequence text = ep.getEntry(); - - if (text == null) { - return; - } - setSummary(text, ep); - } - - /** - *

- * Gets the substring before the last occurrence of a separator. The - * separator is not returned. - *

- * - *

- * A null string input will return null. An empty - * ("") string input will return the empty string. An empty or - * null separator will return the input string. - *

- * - *
-	 * StringUtils.substringBeforeLast(null, *)      = null
-	 * StringUtils.substringBeforeLast("", *)        = ""
-	 * StringUtils.substringBeforeLast("abcba", "b") = "abc"
-	 * StringUtils.substringBeforeLast("abc", "c")   = "ab"
-	 * StringUtils.substringBeforeLast("a", "a")     = ""
-	 * StringUtils.substringBeforeLast("a", "z")     = "a"
-	 * StringUtils.substringBeforeLast("a", null)    = "a"
-	 * StringUtils.substringBeforeLast("a", "")      = "a"
-	 * 
- * - * @param str - * the String to get a substring from, may be null - * @param separator - * the String to search for, may be null - * @return the substring before the last occurrence of the separator, - * null if null String input - * @since 2.0 - */ - public static String substringBeforeLast(String str, String separator) { - if (isEmpty(str) || isEmpty(separator)) { - return str; - } - int pos = str.lastIndexOf(separator); - if (pos == -1) { - return str; - } - return str.substring(0, pos); - } - - // Empty checks - // ----------------------------------------------------------------------- - /** - *

- * Checks if a String is empty ("") or null. - *

- * - *
-	 * StringUtils.isEmpty(null)      = true
-	 * StringUtils.isEmpty("")        = true
-	 * StringUtils.isEmpty(" ")       = false
-	 * StringUtils.isEmpty("bob")     = false
-	 * StringUtils.isEmpty("  bob  ") = false
-	 * 
- * - *

- * NOTE: This method changed in Lang version 2.0. It no longer trims the - * String. That functionality is available in isBlank(). - *

- * - * @param str - * the String to check, may be null - * @return true if the String is empty or null - */ - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - /** - *

- * Checks if a String is whitespace, empty ("") or null. - *

- * - *
-	 * StringUtils.isBlank(null)      = true
-	 * StringUtils.isBlank("")        = true
-	 * StringUtils.isBlank(" ")       = true
-	 * StringUtils.isBlank("bob")     = false
-	 * StringUtils.isBlank("  bob  ") = false
-	 * 
- * - * @param str - * the String to check, may be null - * @return true if the String is null, empty or whitespace - * @since 2.0 - */ - public static boolean isBlank(String str) { - int strLen; - if (str == null || (strLen = str.length()) == 0) { - return true; - } - for (int i = 0; i < strLen; i++) { - if ((Character.isWhitespace(str.charAt(i)) == false)) { - return false; - } - } - return true; - } - } -- cgit v1.2.3