Skip to content

Commit 4bb2833

Browse files
author
Gilles Debunne
committed
Restored selectAllOnFocus
Bug introduced in recent refactoring https://android-git.corp.google.com/g/#/c/158896/ Do not move cursor when selectAllOnFocus and focus just happened. The didTouchFocusSelect() condition was not copied over from ArrowKeyMM. Change-Id: Id01d225c436ae3dd97c5d77d5dac5d0690d7de76
1 parent a6b8fe1 commit 4bb2833

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

core/java/android/widget/TextView.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8377,10 +8377,6 @@ public boolean onTouchEvent(MotionEvent event) {
83778377
}
83788378

83798379
if (touchIsFinished && (isTextEditable() || mTextIsSelectable)) {
8380-
// Move cursor
8381-
final int offset = getOffsetForPosition(event.getX(), event.getY());
8382-
Selection.setSelection((Spannable) mText, offset);
8383-
83848380
// Show the IME, except when selecting in read-only text.
83858381
final InputMethodManager imm = InputMethodManager.peekInstance();
83868382
viewClicked(imm);
@@ -8399,6 +8395,9 @@ public boolean onTouchEvent(MotionEvent event) {
83998395
if (isCursorInsideEasyCorrectionSpan()) {
84008396
showSuggestions();
84018397
} else if (hasInsertionController()) {
8398+
// Move cursor
8399+
final int offset = getOffsetForPosition(event.getX(), event.getY());
8400+
Selection.setSelection((Spannable) mText, offset);
84028401
getInsertionController().show();
84038402
}
84048403
}

0 commit comments

Comments
 (0)