diff options
| author | Alan Viverette <alanv@google.com> | 2014-09-07 15:49:49 -0700 |
|---|---|---|
| committer | Alan Viverette <alanv@google.com> | 2014-09-09 13:38:08 -0700 |
| commit | b687788f52e8367a32efbfdbc4738c2cae5804c1 (patch) | |
| tree | ed72fa03c68a1d63e00e25e854567c39eee88a79 /core/java/android/widget/TextView.java | |
| parent | f98fbb710b3092cd2282682cee1dc9cd09ecaa2e (diff) | |
Bring up the IME when TextView receives ACTION_CLICK
Simulates the relevant portions of a DOWN/UP event pair to request focus
and bring up the IME.
BUG: 8213791
Change-Id: Idb32d81552ecbbdefc64686c914eba6d8e28b0b8
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 3e1b674892a1..80ea6ea0fe24 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8423,6 +8423,33 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override public boolean performAccessibilityAction(int action, Bundle arguments) { switch (action) { + case AccessibilityNodeInfo.ACTION_CLICK: { + boolean handled = false; + + // Simulate View.onTouchEvent for an ACTION_UP event. + if (isClickable() || isLongClickable()) { + if (isFocusable() && !isFocused()) { + requestFocus(); + } + + performClick(); + handled = true; + } + + // Simulate TextView.onTouchEvent for an ACTION_UP event. + if ((mMovement != null || onCheckIsTextEditor()) && isEnabled() + && mText instanceof Spannable && mLayout != null + && (isTextEditable() || isTextSelectable()) && isFocused()) { + // Show the IME, except when selecting in read-only text. + final InputMethodManager imm = InputMethodManager.peekInstance(); + viewClicked(imm); + if (!isTextSelectable() && mEditor.mShowSoftInputOnFocus && imm != null) { + handled |= imm.showSoftInput(this, 0); + } + } + + return handled; + } case AccessibilityNodeInfo.ACTION_COPY: { if (isFocused() && canCopy()) { if (onTextContextMenuItem(ID_COPY)) { |
