diff options
| author | Yuichiro Hanada <yhanada@google.com> | 2020-05-13 20:50:56 +0900 |
|---|---|---|
| committer | Yuichiro Hanada <yhanada@google.com> | 2020-05-13 21:26:36 +0900 |
| commit | 93ec9b85e5f673b2b83f56dcc370ec414e4c5cb9 (patch) | |
| tree | 1c7fba6e5c22d12e39e171a08666be2460cf05e6 /core/java/android/widget/TextView.java | |
| parent | 1ecd4528fb3c07af3279428e1131909ad640b27d (diff) | |
Revert tab key behavior on multiline EditTexts.
This CL reverts ag/10267783 effectively.
ag/10267783 makes tab key insert \t character on multiline text fields,
however, it broke the existing apps which depends on the previous
behavior.
Bug: 154290658
Test: manual - Tab key on multiline text fields advance focus
Test: atest TextViewTest#testKeyNavigation
Change-Id: I9836ce29321ca789bce6636514ce9a8dbf923ada
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 29914aababe3..226f57976ec8 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8315,23 +8315,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return false; } - /** - * Returns true if pressing TAB in this field advances focus instead - * of inserting the character. Insert tabs only in multi-line editors. - */ - private boolean shouldAdvanceFocusOnTab() { - if (getKeyListener() != null && !mSingleLine && mEditor != null - && (mEditor.mInputType & EditorInfo.TYPE_MASK_CLASS) - == EditorInfo.TYPE_CLASS_TEXT) { - int multilineFlags = EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE - | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE; - if ((mEditor.mInputType & multilineFlags) != 0) { - return false; - } - } - return true; - } - private boolean isDirectionalNavigationKey(int keyCode) { switch(keyCode) { case KeyEvent.KEYCODE_DPAD_UP: @@ -8400,9 +8383,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener case KeyEvent.KEYCODE_TAB: if (event.hasNoModifiers() || event.hasModifiers(KeyEvent.META_SHIFT_ON)) { - if (shouldAdvanceFocusOnTab()) { - return KEY_EVENT_NOT_HANDLED; - } + // Tab is used to move focus. + return KEY_EVENT_NOT_HANDLED; } break; |
