Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1b256f5 authored by Kenny Root's avatar Kenny Root Committed by Android (Google) Code Review
Browse files

Merge "Fix last character of password field being visible after rotation" into froyo

parents d8b9b511 71ab21a0
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -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,13 +124,17 @@ implements TransformationMethod, TextWatcher
            if (sourceText instanceof Spannable) {
                Spannable sp = (Spannable) sourceText;

                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