summaryrefslogtreecommitdiff
path: root/vdrmanager/src/de
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2011-11-04 01:32:49 +0100
committerlado <herrlado@gmail.com>2011-11-04 01:32:49 +0100
commit9a88af8e4103483f7eda54f4bf61280017c1e817 (patch)
tree70c8824a4a9d386d41aa747130654a031aec0c21 /vdrmanager/src/de
parent5b06f5244f0712a2df74fe22f18999bc952f041c (diff)
downloadvdr-manager-9a88af8e4103483f7eda54f4bf61280017c1e817.tar.gz
vdr-manager-9a88af8e4103483f7eda54f4bf61280017c1e817.tar.bz2
streamdev auth
Diffstat (limited to 'vdrmanager/src/de')
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java168
1 files changed, 1 insertions, 167 deletions
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);
- }
-
- /**
- * <p>
- * Gets the substring before the last occurrence of a separator. The
- * separator is not returned.
- * </p>
- *
- * <p>
- * A <code>null</code> string input will return <code>null</code>. An empty
- * ("") string input will return the empty string. An empty or
- * <code>null</code> separator will return the input string.
- * </p>
- *
- * <pre>
- * 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"
- * </pre>
- *
- * @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,
- * <code>null</code> 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
- // -----------------------------------------------------------------------
- /**
- * <p>
- * Checks if a String is empty ("") or null.
- * </p>
- *
- * <pre>
- * StringUtils.isEmpty(null) = true
- * StringUtils.isEmpty("") = true
- * StringUtils.isEmpty(" ") = false
- * StringUtils.isEmpty("bob") = false
- * StringUtils.isEmpty(" bob ") = false
- * </pre>
- *
- * <p>
- * NOTE: This method changed in Lang version 2.0. It no longer trims the
- * String. That functionality is available in isBlank().
- * </p>
- *
- * @param str
- * the String to check, may be null
- * @return <code>true</code> if the String is empty or null
- */
- public static boolean isEmpty(String str) {
- return str == null || str.length() == 0;
- }
-
- /**
- * <p>
- * Checks if a String is whitespace, empty ("") or null.
- * </p>
- *
- * <pre>
- * StringUtils.isBlank(null) = true
- * StringUtils.isBlank("") = true
- * StringUtils.isBlank(" ") = true
- * StringUtils.isBlank("bob") = false
- * StringUtils.isBlank(" bob ") = false
- * </pre>
- *
- * @param str
- * the String to check, may be null
- * @return <code>true</code> 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;
- }
-
}