commit | c3bf39400912a65f0629a6cf2bf1760c54ae5d4e | [log] [tgz] |
---|---|---|
author | Anushree Ganjam <ganjam@google.com> | Wed Nov 15 13:31:26 2023 -0800 |
committer | Anushree Ganjam <ganjam@google.com> | Wed Nov 15 13:31:26 2023 -0800 |
tree | 809b2173c3464879352530c1d086340e13a8e804 | |
parent | 07e2e433115a3abec50cacb049836a527ff5c126 [diff] |
Move the cursor to the end of the text in edit text. Before fix: https://b.corp.google.com/issues/301625831#comment9 After fix: https://b.corp.google.com/issues/301625831#comment10 Bug: 301625831 Test: Manual Flag: NA, Fixing for hardware keyboard. Change-Id: I817836a0a76b8677eb65c65720f436882fe6431f
diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java index 8ff030e..cc9dced 100644 --- a/src/com/android/launcher3/ExtendedEditText.java +++ b/src/com/android/launcher3/ExtendedEditText.java
@@ -153,6 +153,15 @@ } } + @Override + public void setText(CharSequence text, BufferType type) { + super.setText(text, type); + // With hardware keyboard, there is a possibility that the user types before edit + // text is visible during the transition. + // So move the cursor to the end of the text. + setSelection(getText().length()); + } + /** * This method should be preferred to {@link #setOnFocusChangeListener(OnFocusChangeListener)}, * as it allows for multiple listeners from different sources.