diff options
| author | Jeff Brown <jeffbrown@google.com> | 2010-12-13 10:36:51 -0800 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2010-12-17 18:51:04 -0800 |
| commit | 4e6319b73c85082e18d1c532b86336ddd1f8cfaa (patch) | |
| tree | 89ebeabfe87f4486c574a93f6c0ad839e4526eff /core/java/android/widget/SearchView.java | |
| parent | 12d81c49a015ed8d5ef7af2d854eee1e80472219 (diff) | |
Add initial support for TAB navigation.
Bug: 3286652
Change-Id: I813a0318b3b8d9c9bc791ea6a2427be11c08de00
Diffstat (limited to 'core/java/android/widget/SearchView.java')
| -rw-r--r-- | core/java/android/widget/SearchView.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index dcd58b0986f1..3bf5af33f0ee 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -623,14 +623,16 @@ public class SearchView extends LinearLayout { // If there is text in the query box, handle enter, and action keys // The search key is handled by the dialog's onKeyDown(). - if (!mQueryTextView.isEmpty()) { - if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) { - v.cancelLongPress(); - - // Launch as a regular search. - launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, mQueryTextView.getText() - .toString()); - return true; + if (!mQueryTextView.isEmpty() && event.hasNoModifiers()) { + if (event.getAction() == KeyEvent.ACTION_UP) { + if (keyCode == KeyEvent.KEYCODE_ENTER) { + v.cancelLongPress(); + + // Launch as a regular search. + launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, mQueryTextView.getText() + .toString()); + return true; + } } if (event.getAction() == KeyEvent.ACTION_DOWN) { SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode); @@ -658,11 +660,11 @@ public class SearchView extends LinearLayout { if (mSuggestionsAdapter == null) { return false; } - if (event.getAction() == KeyEvent.ACTION_DOWN) { - + if (event.getAction() == KeyEvent.ACTION_DOWN && event.hasNoModifiers()) { // First, check for enter or search (both of which we'll treat as a // "click") - if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_SEARCH) { + if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_SEARCH + || keyCode == KeyEvent.KEYCODE_TAB) { int position = mQueryTextView.getListSelection(); return onItemClicked(position, KeyEvent.KEYCODE_UNKNOWN, null); } |
