diff options
author | Devin Taylor <devin.taylor@garmin.com> | 2010-03-18 15:35:11 -0500 |
---|---|---|
committer | Garmin Android technology group <android@garmin.com> | 2010-03-26 10:25:08 -0500 |
commit | 8082d5d9ebe29d8cb9755a64e05f4cf89b1cea5c (patch) | |
tree | 55b477086bb0a11b58d27e619a7160d058f59471 /core/java/android/text/method | |
parent | 0d3b202bdedcdd692d96e53303bc5168d39a07e1 (diff) | |
download | frameworks_base-8082d5d9ebe29d8cb9755a64e05f4cf89b1cea5c.zip frameworks_base-8082d5d9ebe29d8cb9755a64e05f4cf89b1cea5c.tar.gz frameworks_base-8082d5d9ebe29d8cb9755a64e05f4cf89b1cea5c.tar.bz2 |
Fix last character of password field being visible after rotation
This is a fix for http://code.google.com/p/android/issues/detail?id=907. Note that
that issue was declined without comment, but the bug (while incredibly minor)
does exist. This can be seen on the facebook app, as well as many third party apps.
Change-Id: I8f1449c47228f5f757a5baf389656e51c817b150
Diffstat (limited to 'core/java/android/text/method')
-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 { |