From 3503e6fa25299324c4edd273dd70f1763b468e24 Mon Sep 17 00:00:00 2001 From: Steven Ng Date: Fri, 14 May 2021 16:56:37 +0100 Subject: [PATCH] Add a scrim underneath the top section of search & recommendation UI Test: In the full widgets picker, scroll up. Recommended widgets are not visible behind the search bar when they overlap. Bug: 188021019 Change-Id: I13144ad534c74393bb1b12c651e734bb8bee0bc2 --- res/drawable/bg_widgets_picker_handle.xml | 29 +++++++++++++++ ..._full_sheet_search_and_recommendations.xml | 35 ++++++++++++------- res/layout/widgets_search_bar.xml | 7 ++-- ...rchAndRecommendationsScrollController.java | 8 ++--- .../widget/picker/WidgetsFullSheet.java | 2 ++ 5 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 res/drawable/bg_widgets_picker_handle.xml diff --git a/res/drawable/bg_widgets_picker_handle.xml b/res/drawable/bg_widgets_picker_handle.xml new file mode 100644 index 0000000000..68681a684d --- /dev/null +++ b/res/drawable/bg_widgets_picker_handle.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/widgets_full_sheet_search_and_recommendations.xml b/res/layout/widgets_full_sheet_search_and_recommendations.xml index ce7a682376..a89f85f695 100644 --- a/res/layout/widgets_full_sheet_search_and_recommendations.xml +++ b/res/layout/widgets_full_sheet_search_and_recommendations.xml @@ -18,35 +18,44 @@ android:id="@+id/search_and_recommendations_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingHorizontal="16dp" android:layout_marginBottom="16dp" - android:orientation="vertical" - android:clipToPadding="false"> + android:orientation="vertical"> + + android:layout_width="match_parent" + android:layout_height="18dp" + android:elevation="0.1dp" + android:background="@drawable/bg_widgets_picker_handle"/> + - + + + + + android:visibility="gone" /> diff --git a/res/layout/widgets_search_bar.xml b/res/layout/widgets_search_bar.xml index 24671565ee..6a4bb4d2d0 100644 --- a/res/layout/widgets_search_bar.xml +++ b/res/layout/widgets_search_bar.xml @@ -5,10 +5,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:layout_marginTop="16dp" - android:layout_marginBottom="1dp" - android:background="@drawable/bg_widgets_searchbox" - android:elevation="2dp"> + android:layout_marginTop="24dp" + android:layout_marginHorizontal="16dp" + android:background="@drawable/bg_widgets_searchbox"> 0) { int searchYDisplacement = Math.max(-recyclerViewYOffset, -mCollapsibleHeightForSearch); - mViewHolder.mSearchBar.setTranslationY(searchYDisplacement); + mViewHolder.mSearchBarContainer.setTranslationY(searchYDisplacement); } if (mHasWorkProfile && mCollapsibleHeightForTabs > 0) { @@ -255,7 +255,7 @@ final class SearchAndRecommendationsScrollController implements /** Resets any previous view translation. */ public void reset() { mViewHolder.mHeaderTitle.setTranslationY(0); - mViewHolder.mSearchBar.setTranslationY(0); + mViewHolder.mSearchBarContainer.setTranslationY(0); if (mHasWorkProfile) { mPrimaryWorkTabsView.setTranslationY(0); } diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java index 4d8c1ca2ab..08ef1a0077 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java +++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java @@ -711,6 +711,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet final class SearchAndRecommendationViewHolder { final SearchAndRecommendationsView mContainer; final View mCollapseHandle; + final View mSearchBarContainer; final WidgetsSearchBar mSearchBar; final TextView mHeaderTitle; final WidgetsRecommendationTableLayout mRecommendedWidgetsTable; @@ -719,6 +720,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet SearchAndRecommendationsView searchAndRecommendationContainer) { mContainer = searchAndRecommendationContainer; mCollapseHandle = mContainer.findViewById(R.id.collapse_handle); + mSearchBarContainer = mContainer.findViewById(R.id.search_bar_container); mSearchBar = mContainer.findViewById(R.id.widgets_search_bar); mHeaderTitle = mContainer.findViewById(R.id.title); mRecommendedWidgetsTable = mContainer.findViewById(R.id.recommended_widget_table);