diff options
| author | 2012-01-25 15:26:47 -0800 | |
|---|---|---|
| committer | 2012-01-25 15:38:27 -0800 | |
| commit | 868121f29601657baeecff541ef6096257fa082c (patch) | |
| tree | 1b0e6ea273ad7c132eb3966b22ae7a8cb2f82afa | |
| parent | 61bd33968f5df9e67b60ef75e271ad6f4a7702a1 (diff) | |
Handle tap and move cursor before showing suggestions
Otherwise the suggestions do not correspond to the tapped location.
Change-Id: Id0bd87931e73513ca7e50c6212a17b0fc7d6179d
| -rw-r--r-- | core/java/android/widget/TextView.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 9fb26ae7455d..946eb7610251 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8396,6 +8396,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener boolean selectAllGotFocus = mSelectAllOnFocus && didTouchFocusSelect(); hideControllers(); if (!selectAllGotFocus && mText.length() > 0) { + // Move cursor + final int offset = getOffsetForPosition(event.getX(), event.getY()); + Selection.setSelection((Spannable) mText, offset); if (mSpellChecker != null) { // When the cursor moves, the word that was typed may need spell check mSpellChecker.onSelectionChanged(); @@ -8412,9 +8415,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener postDelayed(mShowSuggestionRunnable, ViewConfiguration.getDoubleTapTimeout()); } else if (hasInsertionController()) { - // Move cursor - final int offset = getOffsetForPosition(event.getX(), event.getY()); - Selection.setSelection((Spannable) mText, offset); getInsertionController().show(); } } |