diff options
author | Danny Lin <danny@kdrag0n.dev> | 2021-10-10 03:40:52 -0700 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-05-06 14:30:30 +0800 |
commit | a75e84926a94be113614d7a2cf297db5d7eafc68 (patch) | |
tree | 7be84a4702dc7c00728d6fada3bc90c8e04adce0 | |
parent | a9b03fab3057cb48df924a16406b4a6b41328d9e (diff) |
Launcher3: Improve search bar UI in All Apps
This is similar to, but not exactly the same as, Pixel stock:
- Background color with contrast in light mode
- Round, flat search bar surface with color matching the header
background
- Solid rounded background when positioned at the beginning of the list
- Subtle placeholder text (medium weight) without icon
- Same font size as Settings search bar
Change-Id: Ifa9fabe3a8236513fad8030c0bd8ed4d27ebd549
-rw-r--r-- | res/drawable/all_apps_search_hint.xml | 4 | ||||
-rw-r--r-- | res/drawable/bg_all_apps_searchbox.xml | 6 | ||||
-rw-r--r-- | res/layout/search_container_all_apps.xml | 6 | ||||
-rw-r--r-- | res/layout/secondary_launcher.xml | 7 | ||||
-rw-r--r-- | res/values-v31/colors.xml | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsContainerView.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java | 1 |
7 files changed, 13 insertions, 14 deletions
diff --git a/res/drawable/all_apps_search_hint.xml b/res/drawable/all_apps_search_hint.xml index b2ff7a428e..c0e6811bb9 100644 --- a/res/drawable/all_apps_search_hint.xml +++ b/res/drawable/all_apps_search_hint.xml @@ -16,5 +16,5 @@ --> <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/colorAccent"/> -</selector>
\ No newline at end of file + <item android:color="?android:attr/textColorSecondary" android:alpha="?android:attr/disabledAlpha" /> +</selector> diff --git a/res/drawable/bg_all_apps_searchbox.xml b/res/drawable/bg_all_apps_searchbox.xml index c3249279af..2d02238f1b 100644 --- a/res/drawable/bg_all_apps_searchbox.xml +++ b/res/drawable/bg_all_apps_searchbox.xml @@ -14,6 +14,6 @@ limitations under the License. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="?attr/popupColorPrimary" /> - <corners android:radius="2dp" /> -</shape>
\ No newline at end of file + <solid android:color="?attr/allappsHeaderProtectionColor" /> + <corners android:radius="58dp" /> +</shape> diff --git a/res/layout/search_container_all_apps.xml b/res/layout/search_container_all_apps.xml index e1646ba43e..5ebf9c8cf8 100644 --- a/res/layout/search_container_all_apps.xml +++ b/res/layout/search_container_all_apps.xml @@ -21,17 +21,17 @@ android:layout_centerHorizontal="true" android:layout_gravity="top|center_horizontal" android:background="@drawable/bg_all_apps_searchbox" - android:elevation="1dp" + android:elevation="0dp" android:focusableInTouchMode="true" - android:gravity="center" android:hint="@string/all_apps_search_bar_hint" android:imeOptions="actionSearch|flagNoExtractUi" android:inputType="text|textNoSuggestions|textCapWords" android:maxLines="1" android:padding="8dp" + android:paddingStart="16dp" android:saveEnabled="false" android:scrollHorizontally="true" android:singleLine="true" android:textColor="?android:attr/textColorSecondary" android:textColorHint="@drawable/all_apps_search_hint" - android:textSize="16sp" />
\ No newline at end of file + android:textSize="20sp" /> diff --git a/res/layout/secondary_launcher.xml b/res/layout/secondary_launcher.xml index b15a320bba..131de0011d 100644 --- a/res/layout/secondary_launcher.xml +++ b/res/layout/secondary_launcher.xml @@ -105,9 +105,8 @@ android:layout_centerHorizontal="true" android:layout_gravity="top|center_horizontal" android:background="@drawable/bg_all_apps_searchbox" - android:elevation="1dp" + android:elevation="0dp" android:focusableInTouchMode="true" - android:gravity="center" android:hint="@string/all_apps_search_bar_hint" android:imeOptions="actionSearch|flagNoExtractUi" android:inputType="text|textNoSuggestions|textCapWords" @@ -118,8 +117,8 @@ android:singleLine="true" android:textColor="?android:attr/textColorSecondary" android:textColorHint="@drawable/all_apps_search_hint" - android:textSize="16sp" /> + android:textSize="20sp" /> <include layout="@layout/all_apps_fast_scroller" /> </com.android.launcher3.allapps.AllAppsContainerView> -</com.android.launcher3.secondarydisplay.SecondaryDragLayer>
\ No newline at end of file +</com.android.launcher3.secondarydisplay.SecondaryDragLayer> diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml index 7bbdbd18fa..85a66783f2 100644 --- a/res/values-v31/colors.xml +++ b/res/values-v31/colors.xml @@ -19,7 +19,7 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> <color name="popup_color_primary_light">@android:color/system_accent2_50</color> <color name="popup_color_secondary_light">@android:color/system_neutral2_100</color> - <color name="popup_color_tertiary_light">@android:color/system_neutral2_300</color> + <color name="popup_color_tertiary_light">@android:color/system_neutral2_100</color> <color name="popup_color_neutral_dark">@android:color/system_neutral1_1000</color> <color name="popup_color_primary_dark">@android:color/system_neutral2_800</color> <color name="popup_color_secondary_dark">@android:color/system_neutral1_900</color> diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 3ba6ea4de9..a796d13931 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -760,6 +760,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo if (headerColor != mHeaderColor || mTabsProtectionAlpha != tabsAlpha) { mHeaderColor = headerColor; mTabsProtectionAlpha = tabsAlpha; + getSearchView().setBackgroundResource(R.drawable.bg_all_apps_searchbox); invalidateHeader(); } if (mSearchUiManager.getEditText() != null) { diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java index 4c5a9e64c9..77ed7962ac 100644 --- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java @@ -79,7 +79,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText mSearchQueryBuilder = new SpannableStringBuilder(); Selection.setSelection(mSearchQueryBuilder, 0); - setHint(prefixTextWithIcon(getContext(), R.drawable.ic_allapps_search, getHint())); mContentOverlap = getResources().getDimensionPixelSize(R.dimen.all_apps_search_bar_field_height) / 2; |