Update dropdown colors and list readability for SearchView.

Dismiss IME on launching suggestion.
This commit is contained in:
Amith Yamasani
2010-10-20 10:06:08 -07:00
parent 4f5f7c9683
commit b1818e83f4
8 changed files with 74 additions and 11 deletions

View File

@@ -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.
}
/**

View File

@@ -717,6 +717,7 @@ public class SearchView extends LinearLayout {
if (mOnSuggestionListener == null
|| !mOnSuggestionListener.onSuggestionClicked(position)) {
launchSuggestion(position, KeyEvent.KEYCODE_UNKNOWN, null);
setImeVisibility(false);
dismissSuggestions();
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F0A0A0A0"/>
<stroke android:width="2dp" color="#A00080FF"/>
<padding android:left="5dp" android:top="0dp"
android:right="5dp" android:bottom="1dp" />
</shape>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F0FFFFFF"/>
<stroke android:width="1dp" color="#A00080FF"/>
<padding android:left="5dp" android:top="0dp"
android:right="5dp" android:bottom="1dp" />
</shape>

View File

@@ -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"
/>
<!-- TODO: Use the generic dialog close drawable -->

View File

@@ -570,6 +570,9 @@
<!-- Drawable for group button backgrounds -->
<attr name="groupButtonBackground" format="reference" />
<!-- SearchView dropdown background -->
<attr name="searchDropdownBackground" format="reference" />
</declare-styleable>
<!-- **************************************************************** -->

View File

@@ -769,22 +769,22 @@
<!-- @hide -->
<style name="TextAppearance.SearchResult">
<item name="android:textStyle">normal</item>
<item name="android:textColor">?textColorPrimaryInverse</item>
<item name="android:textColorHint">?textColorHintInverse</item>
<style name="TextAppearance.SearchResult">
<item name="android:textStyle">normal</item>
<item name="android:textColor">?textColorPrimaryInverse</item>
<item name="android:textColorHint">?textColorHintInverse</item>
</style>
<!-- @hide -->
<style name="TextAppearance.SearchResult.Title">
<style name="TextAppearance.SearchResult.Title">
<item name="android:textSize">16sp</item>
</style>
</style>
<!-- @hide -->
<style name="TextAppearance.SearchResult.Subtitle">
<item name="android:textSize">13sp</item>
<item name="android:textColor">?textColorSecondaryInverse</item>
</style>
<style name="TextAppearance.SearchResult.Subtitle">
<item name="android:textSize">13sp</item>
<item name="android:textColor">?textColorSecondaryInverse</item>
</style>
<style name="TextAppearance.WindowTitle">
<item name="android:textColor">#fff</item>
@@ -1187,6 +1187,8 @@
</style>
<style name="TextAppearance.Holo.Light.SearchResult" parent="TextAppearance.Holo.SearchResult">
<item name="android:textColor">?textColorPrimary</item>
<item name="android:textColorHint">?textColorHint</item>
</style>
<style name="TextAppearance.Holo.Light.SearchResult.Title">

View File

@@ -252,6 +252,9 @@
<item name="dividerVertical">@drawable/divider_vertical_dark</item>
<item name="buttonGroupStyle">@android:style/Widget.ButtonGroup</item>
<!-- SearchView attributes -->
<item name="searchDropdownBackground">@android:drawable/search_dropdown_dark</item>
</style>
<!-- Variant of the default (dark) theme with no title bar -->
@@ -320,6 +323,8 @@
<item name="actionModeCutDrawable">@android:drawable/ic_menu_cut_light</item>
<item name="actionModeCopyDrawable">@android:drawable/ic_menu_copy_light</item>
<item name="actionModePasteDrawable">@android:drawable/ic_menu_paste_light</item>
<!-- SearchView attributes -->
<item name="searchDropdownBackground">@android:drawable/search_dropdown_light</item>
</style>
<!-- Variant of the light theme with no title bar -->
@@ -852,6 +857,9 @@
<item name="dividerVertical">@drawable/divider_vertical_holo_dark</item>
<item name="buttonGroupStyle">@android:style/Widget.Holo.ButtonGroup</item>
<!-- SearchView attributes -->
<item name="searchDropdownBackground">@android:drawable/search_dropdown_dark</item>
</style>
<!-- New Honeycomb holographic theme. Light version. The widgets in the
@@ -1082,6 +1090,9 @@
<item name="dividerVertical">@drawable/divider_vertical_holo_light</item>
<item name="buttonGroupStyle">@android:style/Widget.Holo.Light.ButtonGroup</item>
<!-- SearchView attributes -->
<item name="searchDropdownBackground">@android:drawable/search_dropdown_light</item>
</style>
<!-- Development legacy name; if you're using this, switch. -->