From b1818e83f4a81bc4e4e30b99bb48830415be731b Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Wed, 20 Oct 2010 10:06:08 -0700 Subject: [PATCH] Update dropdown colors and list readability for SearchView. Dismiss IME on launching suggestion. --- core/java/android/widget/ListPopupWindow.java | 2 ++ core/java/android/widget/SearchView.java | 1 + .../res/res/drawable/search_dropdown_dark.xml | 22 +++++++++++++++++++ .../res/drawable/search_dropdown_light.xml | 22 +++++++++++++++++++ core/res/res/layout/search_view.xml | 2 +- core/res/res/values/attrs.xml | 3 +++ core/res/res/values/styles.xml | 22 ++++++++++--------- core/res/res/values/themes.xml | 11 ++++++++++ 8 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 core/res/res/drawable/search_dropdown_dark.xml create mode 100644 core/res/res/drawable/search_dropdown_light.xml diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java index 8b21612301f6a..d98f316b6ac61 100644 --- a/core/java/android/widget/ListPopupWindow.java +++ b/core/java/android/widget/ListPopupWindow.java @@ -1119,6 +1119,8 @@ public class ListPopupWindow { public DropDownListView(Context context, boolean hijackFocus) { super(context, null, com.android.internal.R.attr.dropDownListViewStyle); mHijackFocus = hijackFocus; + // TODO: Add an API to control this + setCacheColorHint(0); // Transparent, since the background drawable could be anything. } /** diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index 847651c337ec4..1d36b49297fea 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -717,6 +717,7 @@ public class SearchView extends LinearLayout { if (mOnSuggestionListener == null || !mOnSuggestionListener.onSuggestionClicked(position)) { launchSuggestion(position, KeyEvent.KEYCODE_UNKNOWN, null); + setImeVisibility(false); dismissSuggestions(); } } diff --git a/core/res/res/drawable/search_dropdown_dark.xml b/core/res/res/drawable/search_dropdown_dark.xml new file mode 100644 index 0000000000000..26284187a792c --- /dev/null +++ b/core/res/res/drawable/search_dropdown_dark.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/core/res/res/drawable/search_dropdown_light.xml b/core/res/res/drawable/search_dropdown_light.xml new file mode 100644 index 0000000000000..0d00c58788a29 --- /dev/null +++ b/core/res/res/drawable/search_dropdown_light.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/core/res/res/layout/search_view.xml b/core/res/res/layout/search_view.xml index b5d917df9bfc9..0fd9a7733bf4d 100644 --- a/core/res/res/layout/search_view.xml +++ b/core/res/res/layout/search_view.xml @@ -91,7 +91,7 @@ android:dropDownAnchor="@id/search_edit_frame" android:dropDownVerticalOffset="0dip" android:dropDownHorizontalOffset="0dip" - android:popupBackground="@android:drawable/search_dropdown_background" + android:popupBackground="?android:attr/searchDropdownBackground" /> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 663f24764828f..3f4635a569d74 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -570,6 +570,9 @@ + + + diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index d180ed5c316a6..5e77ee1bb8bc0 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -769,22 +769,22 @@ - - + - + @@ -320,6 +323,8 @@ @android:drawable/ic_menu_cut_light @android:drawable/ic_menu_copy_light @android:drawable/ic_menu_paste_light + + @android:drawable/search_dropdown_light @@ -852,6 +857,9 @@ @drawable/divider_vertical_holo_dark @android:style/Widget.Holo.ButtonGroup + + + @android:drawable/search_dropdown_dark + @android:drawable/search_dropdown_light