Fix search bar UI in All Apps
Commit Ifa9fabe3a8236513fad8030c0bd8ed4d27ebd549 improved the look
of the search bar, however it had a few issues and the overall
look did not match Settings or Widget search style.
The following improvements have been made:
- Centered the search bar text vertically inside the search bar
- Fixed poor contrast of the search bar text against the background
- Added back search icon that is always shown, matching Widget search
- Changed paddings to match Widget search
Change-Id: Ia127da05adff45f8860f0870817aaa9fde8e171c
diff --git a/res/drawable/all_apps_search_hint.xml b/res/drawable/all_apps_search_hint.xml
deleted file mode 100644
index a066e98..0000000
--- a/res/drawable/all_apps_search_hint.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@android:color/transparent" android:state_focused="true" />
- <item android:color="?android:attr/textColorSecondary" android:alpha="?android:attr/disabledAlpha" />
-</selector>
\ No newline at end of file
diff --git a/res/drawable/ic_allapps_search.xml b/res/drawable/ic_allapps_search.xml
index 0c3ab78..79c07ce 100644
--- a/res/drawable/ic_allapps_search.xml
+++ b/res/drawable/ic_allapps_search.xml
@@ -20,6 +20,6 @@
android:viewportWidth="24.0"
android:autoMirrored="true">
<path
- android:fillColor="?attr/widgetPickerSearchTextColor"
+ android:fillColor="?attr/allAppsSearchTextColor"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z" />
</vector>
diff --git a/res/layout/search_container_all_apps.xml b/res/layout/search_container_all_apps.xml
index 0ad13d5..56d8ebb 100644
--- a/res/layout/search_container_all_apps.xml
+++ b/res/layout/search_container_all_apps.xml
@@ -17,21 +17,25 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/search_container_all_apps"
android:layout_width="match_parent"
- android:layout_height="@dimen/all_apps_search_bar_field_height"
+ android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="top|center_horizontal"
android:background="@drawable/bg_all_apps_searchbox"
android:focusableInTouchMode="true"
+ android:gravity="center_vertical"
android:hint="@string/all_apps_search_bar_hint"
android:imeOptions="actionSearch|flagNoExtractUi"
android:importantForAutofill="no"
android:inputType="text|textNoSuggestions|textCapWords"
android:maxLines="1"
- android:padding="8dp"
- android:paddingStart="16dp"
+ android:paddingVertical="12dp"
+ android:paddingStart="12dp"
+ android:paddingEnd="0dp"
+ android:drawablePadding="8dp"
+ android:drawableStart="@drawable/ic_allapps_search"
android:saveEnabled="false"
android:scrollHorizontally="true"
android:singleLine="true"
- android:textColor="?android:attr/textColorSecondary"
- android:textColorHint="@drawable/all_apps_search_hint"
- android:textSize="20sp" />
+ android:textColor="?android:attr/textColorPrimary"
+ android:textColorHint="?attr/allAppsSearchTextColor"
+ android:textSize="20sp" />
\ No newline at end of file
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index e4650b2..9b1bcf5 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -21,6 +21,7 @@
<attr name="allAppsScrimColor" format="color" />
<attr name="allappsHeaderProtectionColor" format="color" />
<attr name="allAppsNavBarScrimColor" format="color" />
+ <attr name="allAppsSearchTextColor" format="color"/>
<attr name="allAppsTheme" format="reference" />
<attr name="popupColorPrimary" format="color" />
<attr name="popupColorSecondary" format="color" />
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c41f0e8..3a723eb 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -34,6 +34,7 @@
<item name="allAppsScrimColor">?attr/materialColorSurfaceDim</item>
<item name="allappsHeaderProtectionColor">@color/popup_color_tertiary_light</item>
<item name="allAppsNavBarScrimColor">#66FFFFFF</item>
+ <item name="allAppsSearchTextColor">@color/widget_picker_search_text_color_light</item>
<item name="popupColorPrimary">@color/popup_color_primary_light</item>
<item name="popupColorSecondary">@color/popup_color_secondary_light</item>
<item name="popupColorTertiary">@color/popup_color_tertiary_light</item>
@@ -152,6 +153,7 @@
<item name="android:colorPrimary">#FF212121</item>
<item name="allAppsScrimColor">?attr/materialColorSurfaceDim</item>
<item name="allAppsNavBarScrimColor">#80000000</item>
+ <item name="allAppsSearchTextColor">@color/widget_picker_search_text_color_dark</item>
<item name="popupColorPrimary">@color/popup_color_primary_dark</item>
<item name="popupColorSecondary">@color/popup_color_secondary_dark</item>
<item name="popupColorTertiary">@color/popup_color_tertiary_dark</item>