resolve merge conflicts of a6194d3d92 to ub-launcher3-calgary

Change-Id: I29b3c3bb2c070e34c78c62b8f9086e6f3c8bd277
diff --git a/res/layout/widgets_view.xml b/res/layout/widgets_view.xml
index cc513ab..410d1be 100644
--- a/res/layout/widgets_view.xml
+++ b/res/layout/widgets_view.xml
@@ -34,13 +34,20 @@
         android:elevation="2dp"
         android:visibility="invisible" />
 
-    <com.android.launcher3.widget.WidgetsRecyclerView
+    <FrameLayout
         android:id="@+id/main_content"
-        android:theme="@style/CustomOverscroll.Dark"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
         android:layout_gravity="center"
         android:elevation="15dp"
-        android:visibility="gone" />
+        android:visibility="gone"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+        <com.android.launcher3.widget.WidgetsRecyclerView
+            android:id="@+id/widgets_list_view"
+            android:theme="@style/CustomOverscroll.Dark"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+    </FrameLayout>
+
 
 </com.android.launcher3.widget.WidgetsContainerView>
\ No newline at end of file
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java
index 5ba41ad..bd41992 100644
--- a/src/com/android/launcher3/BaseContainerView.java
+++ b/src/com/android/launcher3/BaseContainerView.java
@@ -140,6 +140,10 @@
         mRevealView.setBackground(background.getConstantState().newDrawable());
         mContent.setBackground(background);
 
+        // We let the content have a intent background, but still have full width.
+        // This allows the scroll bar to be used responsive outside the background bounds as well.
+        mContent.setPadding(0, 0, 0, 0);
+
         Rect bgPadding = new Rect();
         background.getPadding(bgPadding);
         onUpdateBgPadding(padding, bgPadding);
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 920e954..6bcbb61 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -371,11 +371,6 @@
         mAdapter.updateBackgroundPadding(bgPadding);
         mElevationController.updateBackgroundPadding(bgPadding);
 
-        // Hack: We are going to let the recycler view take the full width, so reset the padding on
-        // the container to zero after setting the background and apply the top-bottom padding to
-        // the content view instead so that the launcher transition clips correctly.
-        getContentView().setPadding(0, 0, 0, 0);
-
         // Pad the recycler view by the background padding plus the start margin (for the section
         // names)
         int maxScrollBarWidth = mAppsRecyclerView.getMaxScrollbarWidth();
diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java
index 9a0c50b..a87c932 100644
--- a/src/com/android/launcher3/widget/WidgetsContainerView.java
+++ b/src/com/android/launcher3/widget/WidgetsContainerView.java
@@ -64,7 +64,7 @@
     private IconCache mIconCache;
 
     /* Recycler view related member variables */
-    private WidgetsRecyclerView mView;
+    private WidgetsRecyclerView mRecyclerView;
     private WidgetsListAdapter mAdapter;
 
     /* Touch handling related member variables. */
@@ -73,8 +73,6 @@
     /* Rendering related. */
     private WidgetPreviewLoader mWidgetPreviewLoader;
 
-    private Rect mPadding = new Rect();
-
     public WidgetsContainerView(Context context) {
         this(context, null);
     }
@@ -97,11 +95,11 @@
     @Override
     protected void onFinishInflate() {
         super.onFinishInflate();
-        mView = (WidgetsRecyclerView) getContentView();
-        mView.setAdapter(mAdapter);
+        mRecyclerView = (WidgetsRecyclerView) getContentView().findViewById(R.id.widgets_list_view);
+        mRecyclerView.setAdapter(mAdapter);
 
         // This extends the layout space so that preloading happen for the {@link RecyclerView}
-        mView.setLayoutManager(new LinearLayoutManager(getContext()) {
+        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()) {
             @Override
             protected int getExtraLayoutSpace(State state) {
                 DeviceProfile grid = mLauncher.getDeviceProfile();
@@ -109,8 +107,6 @@
                         + grid.availableHeightPx * PRELOAD_SCREEN_HEIGHT_MULTIPLE;
             }
         });
-        mPadding.set(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
-                getPaddingBottom());
     }
 
     //
@@ -118,7 +114,7 @@
     //
 
     public void scrollToTop() {
-        mView.scrollToPosition(0);
+        mRecyclerView.scrollToPosition(0);
     }
 
     //
@@ -330,14 +326,14 @@
     //
     @Override
     protected void onUpdateBgPadding(Rect padding, Rect bgPadding) {
-        mView.updateBackgroundPadding(bgPadding);
+        mRecyclerView.updateBackgroundPadding(bgPadding);
     }
 
     /**
      * Initialize the widget data model.
      */
     public void addWidgets(WidgetsModel model) {
-        mView.setWidgets(model);
+        mRecyclerView.setWidgets(model);
         mAdapter.setWidgetsModel(model);
         mAdapter.notifyDataSetChanged();
     }