Merge "Add a scrim underneath the top section of search & recommendation UI" into sc-dev
diff --git a/res/drawable/bg_widgets_picker_handle.xml b/res/drawable/bg_widgets_picker_handle.xml
new file mode 100644
index 0000000..68681a6
--- /dev/null
+++ b/res/drawable/bg_widgets_picker_handle.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape android:shape="rectangle">
+            <solid android:color="?android:attr/colorBackground" />
+            <padding android:top="16dp"/>
+        </shape>
+    </item>
+    <item android:gravity="center">
+        <shape android:shape="rectangle">
+            <solid android:color="?android:attr/textColorSecondary" />
+            <size android:width="48dp" android:height="2dp" />
+        </shape>
+    </item>
+</layer-list>
\ 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 ce7a682..a89f85f 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">
+
     <View
         android:id="@+id/collapse_handle"
-        android:layout_width="48dp"
-        android:layout_height="2dp"
-        android:layout_marginTop="16dp"
-        android:elevation="2dp"
-        android:layout_gravity="center_horizontal"
-        android:background="?android:attr/textColorSecondary"/>
+        android:layout_width="match_parent"
+        android:layout_height="18dp"
+        android:elevation="0.1dp"
+        android:background="@drawable/bg_widgets_picker_handle"/>
+
     <TextView
         android:id="@+id/title"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:textSize="24sp"
-        android:layout_marginTop="16dp"
+        android:layout_marginTop="24dp"
         android:textColor="?android:attr/textColorSecondary"
         android:text="@string/widget_button_text"/>
-    <include layout="@layout/widgets_search_bar"/>
+
+    <FrameLayout
+        android:id="@+id/search_bar_container"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:elevation="0.1dp"
+        android:background="?android:attr/colorBackground"
+        android:paddingBottom="8dp"
+        android:clipToPadding="false">
+        <include layout="@layout/widgets_search_bar" />
+    </FrameLayout>
 
     <com.android.launcher3.widget.picker.WidgetsRecommendationTableLayout
         android:id="@+id/recommended_widget_table"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:layout_marginHorizontal="16dp"
+        android:layout_marginTop="8dp"
         android:background="@drawable/widgets_recommendation_background"
         android:paddingVertical="@dimen/recommended_widgets_table_vertical_padding"
-        android:layout_marginTop="16dp"
-        android:visibility="gone"/>
+        android:visibility="gone" />
 </com.android.launcher3.widget.picker.SearchAndRecommendationsView>
diff --git a/res/layout/widgets_search_bar.xml b/res/layout/widgets_search_bar.xml
index 2467156..6a4bb4d 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">
 
     <com.android.launcher3.ExtendedEditText
         android:id="@+id/widgets_search_bar_edit_text"
diff --git a/src/com/android/launcher3/widget/picker/SearchAndRecommendationsScrollController.java b/src/com/android/launcher3/widget/picker/SearchAndRecommendationsScrollController.java
index 317fd03..34346ab 100644
--- a/src/com/android/launcher3/widget/picker/SearchAndRecommendationsScrollController.java
+++ b/src/com/android/launcher3/widget/picker/SearchAndRecommendationsScrollController.java
@@ -101,7 +101,7 @@
         mCurrentRecyclerView.setOnContentChangeListener(mOnContentChangeListener);
         mViewHolder.mHeaderTitle.setTranslationY(0);
         mViewHolder.mRecommendedWidgetsTable.setTranslationY(0);
-        mViewHolder.mSearchBar.setTranslationY(0);
+        mViewHolder.mSearchBarContainer.setTranslationY(0);
 
         if (mHasWorkProfile) {
             mPrimaryWorkTabsView.setTranslationY(0);
@@ -120,7 +120,7 @@
         mCollapsibleHeightForRecommendation =
                 measureHeightWithVerticalMargins(mViewHolder.mHeaderTitle)
                         + measureHeightWithVerticalMargins(mViewHolder.mCollapseHandle)
-                        + measureHeightWithVerticalMargins((View) mViewHolder.mSearchBar)
+                        + measureHeightWithVerticalMargins((View) mViewHolder.mSearchBarContainer)
                         + measureHeightWithVerticalMargins(mViewHolder.mRecommendedWidgetsTable);
 
         int topContainerHeight = measureHeightWithVerticalMargins(mViewHolder.mContainer);
@@ -243,7 +243,7 @@
 
         if (mCollapsibleHeightForSearch > 0) {
             int searchYDisplacement = Math.max(-recyclerViewYOffset, -mCollapsibleHeightForSearch);
-            mViewHolder.mSearchBar.setTranslationY(searchYDisplacement);
+            mViewHolder.mSearchBarContainer.setTranslationY(searchYDisplacement);
         }
 
         if (mHasWorkProfile && mCollapsibleHeightForTabs > 0) {
@@ -255,7 +255,7 @@
     /** 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 0ea50e6..e44acc3 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -713,6 +713,7 @@
     final class SearchAndRecommendationViewHolder {
         final SearchAndRecommendationsView mContainer;
         final View mCollapseHandle;
+        final View mSearchBarContainer;
         final WidgetsSearchBar mSearchBar;
         final TextView mHeaderTitle;
         final WidgetsRecommendationTableLayout mRecommendedWidgetsTable;
@@ -721,6 +722,7 @@
                 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);