From b059d90691e3ecd2d9843b537e9a08db983586e7 Mon Sep 17 00:00:00 2001 From: Mike LeBeau Date: Fri, 8 May 2009 18:38:45 -0700 Subject: [PATCH] Make in-app search have a different background resource which looks like a slide-out drawer, to provide app context and because it is not full-screen. Also fix a problem where bringing up global search sometimes still did not size the dropdown correctly, because the keyboard was not yet showing. --- core/java/android/app/SearchDialog.java | 13 ++++++++++++- .../search_dropdown_background_apps.9.png | Bin 0 -> 412 bytes 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 core/res/res/drawable/search_dropdown_background_apps.9.png diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 0aa5975d7faf5..a1748434a5e70 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -325,6 +325,14 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // show the dialog. this will call onStart(). if (!isShowing()) { + // First make sure the keyboard is showing (if needed), so that we get the right height + // for the dropdown to respect the IME. + if (getContext().getResources().getConfiguration().hardKeyboardHidden == + Configuration.HARDKEYBOARDHIDDEN_YES) { + InputMethodManager inputManager = (InputMethodManager) + getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + inputManager.showSoftInputUnchecked(0, null); + } show(); } @@ -528,13 +536,16 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mSearchAutoComplete.setDropDownAnimationStyle(0); // no animation mSearchAutoComplete.setThreshold(mSearchable.getSuggestThreshold()); - // TODO: Use different dropdown background resource for in-app search. if (mGlobalSearchMode) { mSearchAutoComplete.setDropDownAlwaysVisible(true); // fill space until results come in mSearchAutoComplete.setDropDownDismissedOnCompletion(false); + mSearchAutoComplete.setDropDownBackgroundResource( + com.android.internal.R.drawable.search_dropdown_background); } else { mSearchAutoComplete.setDropDownAlwaysVisible(false); mSearchAutoComplete.setDropDownDismissedOnCompletion(true); + mSearchAutoComplete.setDropDownBackgroundResource( + com.android.internal.R.drawable.search_dropdown_background_apps); } // attach the suggestions adapter, if suggestions are available diff --git a/core/res/res/drawable/search_dropdown_background_apps.9.png b/core/res/res/drawable/search_dropdown_background_apps.9.png new file mode 100644 index 0000000000000000000000000000000000000000..56b697d97b8e738ffa2aed8fc1c8dc4f5e87eb9a GIT binary patch literal 412 zcmV;N0b~A&P)H&&`nyp=%OtsB%oMGlm0}f-wP8cG9xpje()kQ^UgDW-;9iN zZs`VNjO?6g`(7Q$q<4!*D$Ks55t6_hh(@jkiV$ z+a$G&;fi|Rb=^S+(6;R!eiQglUDwY#@TO^A;5UKq@;qPaz_Tp7hhM&ax}kkh%zWRE zX!fssAkYpU{1OIN!OuxoQ54-)RrMwVqaN+>!7t?~;MlH9(%kdBMVh8}MNvEgT9)M# z%BV-X@Yyns>fyp?DmwbOuvj|jg7isxC#^{voGA`e#&HJD>Tv8x+TzlR?fMdB4Dca* zMo(@(qp*rI(gdkZ`WAzBe-lFs{$Jq?{dII9swd=EfB^vP;RTt9xj$n70000