Only show collapse handle when the bottom widgets picker is scrollable

Test: Go to contact bottom widgets picker. No collapse handle is
      shown because the content isn't scrollable. Go to Google calendar
      bottom widget picker. Collapse handle is hown because the content
      is scrollable.
Bug: 185134663
Change-Id: Ic6109c055a072aa1cf3521f829833fd5f4cece0f
diff --git a/res/layout/widgets_bottom_sheet_content.xml b/res/layout/widgets_bottom_sheet_content.xml
index a9d523a..85c6488 100644
--- a/res/layout/widgets_bottom_sheet_content.xml
+++ b/res/layout/widgets_bottom_sheet_content.xml
@@ -15,10 +15,12 @@
 -->
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
     <View
+        android:id="@+id/collapse_handle"
         android:layout_width="48dp"
         android:layout_height="2dp"
         android:layout_gravity="center_horizontal"
         android:layout_marginBottom="16dp"
+        android:visibility="gone"
         android:background="?android:attr/textColorSecondary"/>
     <TextView
         style="@style/TextHeadline"
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index f18b63e..995ac47 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -118,6 +118,7 @@
             ViewGroup.LayoutParams layoutParams = widgetsTableScrollView.getLayoutParams();
             layoutParams.height = mMaxTableHeight;
             widgetsTableScrollView.setLayoutParams(layoutParams);
+            findViewById(R.id.collapse_handle).setVisibility(VISIBLE);
         }
     }