Fixing crash happening when password toggle is clicked without the edit text having focus in TalkBack mode.

PiperOrigin-RevId: 286590576
(cherry picked from commit 8ed0ab79647374eef3d6b6d2270a00a4f0645803)
This commit is contained in:
leticiars 2019-12-20 12:22:41 -05:00 committed by ikim24
parent c6812b2cd5
commit d5b2d818c3

View File

@ -99,7 +99,9 @@ class PasswordToggleEndIconDelegate extends EndIconDelegate {
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
// And restore the cursor position
editText.setSelection(selection);
if (selection >= 0) {
editText.setSelection(selection);
}
}
});
textInputLayout.addOnEditTextAttachedListener(onEditTextAttachedListener);