summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-04-06 14:33:24 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-04-06 14:33:24 -0700
commitf1b256f5198d12952302ef2b6214a79927918866 (patch)
treef675f307e41a67c84583a6228e5642f775f7d1ff
parentd8b9b511821a06d86b3ffaab0d71ee9ce3834678 (diff)
parent71ab21a02a31948302b62bcbef72d3994034a855 (diff)
downloadframeworks_base-f1b256f5198d12952302ef2b6214a79927918866.zip
frameworks_base-f1b256f5198d12952302ef2b6214a79927918866.tar.gz
frameworks_base-f1b256f5198d12952302ef2b6214a79927918866.tar.bz2
Merge "Fix last character of password field being visible after rotation" into froyo
-rw-r--r--core/java/android/text/method/PasswordTransformationMethod.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/core/java/android/text/method/PasswordTransformationMethod.java b/core/java/android/text/method/PasswordTransformationMethod.java
index fad4f64..b769b76 100644
--- a/core/java/android/text/method/PasswordTransformationMethod.java
+++ b/core/java/android/text/method/PasswordTransformationMethod.java
@@ -51,6 +51,8 @@ implements TransformationMethod, TextWatcher
sp.removeSpan(vr[i]);
}
+ removeVisibleSpans(sp);
+
sp.setSpan(new ViewReference(view), 0, 0,
Spannable.SPAN_POINT_POINT);
}
@@ -100,10 +102,7 @@ implements TransformationMethod, TextWatcher
int pref = TextKeyListener.getInstance().getPrefs(v.getContext());
if ((pref & TextKeyListener.SHOW_PASSWORD) != 0) {
if (count > 0) {
- Visible[] old = sp.getSpans(0, sp.length(), Visible.class);
- for (int i = 0; i < old.length; i++) {
- sp.removeSpan(old[i]);
- }
+ removeVisibleSpans(sp);
if (count == 1) {
sp.setSpan(new Visible(sp, this), start, start + count,
@@ -125,14 +124,18 @@ implements TransformationMethod, TextWatcher
if (sourceText instanceof Spannable) {
Spannable sp = (Spannable) sourceText;
- Visible[] old = sp.getSpans(0, sp.length(), Visible.class);
- for (int i = 0; i < old.length; i++) {
- sp.removeSpan(old[i]);
- }
+ removeVisibleSpans(sp);
}
}
}
+ private static void removeVisibleSpans(Spannable sp) {
+ Visible[] old = sp.getSpans(0, sp.length(), Visible.class);
+ for (int i = 0; i < old.length; i++) {
+ sp.removeSpan(old[i]);
+ }
+ }
+
private static class PasswordCharSequence
implements CharSequence, GetChars
{