diff options
| author | Gilles Debunne <debunne@google.com> | 2011-02-08 18:21:01 -0800 |
|---|---|---|
| committer | Gilles Debunne <debunne@google.com> | 2011-02-09 16:54:18 -0800 |
| commit | a4a5758b5f51834f7555ec909e8188c432fc5dc4 (patch) | |
| tree | 4161a526d9b6a1ce65f33a46e8ff616354a2e4bd /core/java/android/widget/AutoCompleteTextView.java | |
| parent | 63c9809e84a1df7105e606ecdfe3107616fc4705 (diff) | |
The tab key completes text in AutoCompleteTextView.
Bug 3330651.
The first item in the list is not selected by default. From discussions
in other related bugs, there does not seem to be an agreement on this.
Supporting the actual token separator has also been punted. This would
require a new method in the Tokenizer, which could be ill-defined for
exotic tokenizer, plus typing a comma (for instance) to achieve a
completion is not a common pattern.
Change-Id: I30baf62077c412256175f871d21f4841e104f212
Diffstat (limited to 'core/java/android/widget/AutoCompleteTextView.java')
| -rw-r--r-- | core/java/android/widget/AutoCompleteTextView.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index e8ce4e97237d..09add5ed9065 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -648,6 +648,12 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe return true; } } + + if (isPopupShowing() && keyCode == KeyEvent.KEYCODE_TAB && event.hasNoModifiers()) { + performCompletion(); + return true; + } + return super.onKeyUp(keyCode, event); } @@ -666,6 +672,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe } } + if (isPopupShowing() && keyCode == KeyEvent.KEYCODE_TAB && event.hasNoModifiers()) { + return true; + } + mLastKeyCode = keyCode; boolean handled = super.onKeyDown(keyCode, event); mLastKeyCode = KeyEvent.KEYCODE_UNKNOWN; |
