diff options
author | Romain Guy <romainguy@android.com> | 2010-03-30 10:54:40 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2010-03-30 10:54:40 -0700 |
commit | 26fe7d27ee69148905496ebb2fd6347bc51f7b87 (patch) | |
tree | 00e6165bdfeb8c4fbda9163c1ec83dc647773342 /core/java/android | |
parent | 5f3445dc609fb3dd64b023c1ba9c1ee3ba95b868 (diff) | |
parent | 8082d5d9ebe29d8cb9755a64e05f4cf89b1cea5c (diff) | |
download | frameworks_base-26fe7d27ee69148905496ebb2fd6347bc51f7b87.zip frameworks_base-26fe7d27ee69148905496ebb2fd6347bc51f7b87.tar.gz frameworks_base-26fe7d27ee69148905496ebb2fd6347bc51f7b87.tar.bz2 |
Merge "Fix last character of password field being visible after rotation"
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/text/method/PasswordTransformationMethod.java | 19 |
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 { |