From b4569fb17fada4fdc43e4f4dbfbc79bb097a1f74 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Fri, 8 Jul 2011 15:25:39 -0700 Subject: SearchView behavioral and visual changes Align text suggestions and search string. Close button only clears the field. Back button clears focus, hides dropdown and keyboard. Tweaked SearchDialog's use of SearchView to follow above patterns. Fixed other little bugs. Change-Id: I9d34c2ebe2b1b2ca887220894c19a26809db85f6 --- core/java/android/app/SearchDialog.java | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'core/java/android/app/SearchDialog.java') diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 42eda0212e01..8e2d360b5637 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -168,6 +168,7 @@ public class SearchDialog extends Dialog { SearchBar searchBar = (SearchBar) findViewById(com.android.internal.R.id.search_bar); searchBar.setSearchDialog(this); mSearchView = (SearchView) findViewById(com.android.internal.R.id.search_view); + mSearchView.setIconified(false); mSearchView.setOnCloseListener(mOnCloseListener); mSearchView.setOnQueryTextListener(mOnQueryChangeListener); mSearchView.setOnSuggestionListener(mOnSuggestionSelectionListener); @@ -632,31 +633,6 @@ public class SearchDialog extends Dialog { mSearchDialog = searchDialog; } - /** - * Overrides the handling of the back key to move back to the previous - * sources or dismiss the search dialog, instead of dismissing the input - * method. - */ - @Override - public boolean dispatchKeyEventPreIme(KeyEvent event) { - if (DBG) - Log.d(LOG_TAG, "onKeyPreIme(" + event + ")"); - if (mSearchDialog != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK) { - KeyEvent.DispatcherState state = getKeyDispatcherState(); - if (state != null) { - if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { - state.startTracking(event, this); - return true; - } else if (event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled() - && state.isTracking(event)) { - mSearchDialog.onBackPressed(); - return true; - } - } - } - return super.dispatchKeyEventPreIme(event); - } - /** * Don't allow action modes in a SearchBar, it looks silly. */ -- cgit v1.2.3