Merge "Ensure prediction bar is visible when intercepting touch events. " into ub-launcher3-burnaby
diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml
index d75d6cd..67b69ca 100644
--- a/res/layout/user_folder.xml
+++ b/res/layout/user_folder.xml
@@ -38,6 +38,9 @@
             android:id="@+id/folder_content"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
+            android:paddingLeft="4dp"
+            android:paddingRight="4dp"
+            android:paddingTop="4dp"
             launcher:pageIndicator="@+id/folder_page_indicator" />
     </FrameLayout>
 
diff --git a/res/layout/widget_cell.xml b/res/layout/widget_cell.xml
index a85f0aa..500cf10 100644
--- a/res/layout/widget_cell.xml
+++ b/res/layout/widget_cell.xml
@@ -44,7 +44,7 @@
             android:ellipsize="end"
             android:fadingEdge="horizontal"
             android:textColor="@color/widgets_view_item_text_color"
-            android:textSize="16sp"
+            android:textSize="14sp"
             android:textAlignment="viewStart"
             android:fontFamily="sans-serif-condensed"
             android:shadowRadius="2.0"
@@ -61,7 +61,7 @@
             android:layout_weight="0"
             android:gravity="start"
             android:textColor="@color/widgets_view_item_text_color"
-            android:textSize="16sp"
+            android:textSize="14sp"
             android:textAlignment="viewStart"
             android:fontFamily="sans-serif-condensed"
             android:shadowRadius="2.0"
diff --git a/res/layout/widgets_list_row_view.xml b/res/layout/widgets_list_row_view.xml
index be62ee9..dc1bcce 100644
--- a/res/layout/widgets_list_row_view.xml
+++ b/res/layout/widgets_list_row_view.xml
@@ -41,7 +41,7 @@
         android:paddingTop="@dimen/widget_section_vertical_padding"
         android:singleLine="true"
         android:textColor="@color/widgets_view_section_text_color"
-        android:textSize="20sp"
+        android:textSize="16sp"
         launcher:customShadows="false"
         launcher:deferShadowGeneration="true"
         launcher:iconDisplay="widget_section"
diff --git a/src/com/android/launcher3/AppsContainerView.java b/src/com/android/launcher3/AppsContainerView.java
index 8629138..8709101 100644
--- a/src/com/android/launcher3/AppsContainerView.java
+++ b/src/com/android/launcher3/AppsContainerView.java
@@ -396,6 +396,7 @@
                 inset, 0, inset, 0);
         mContentView.setBackground(background);
         mAppsRecyclerView.updateBackgroundPadding(background);
+        mAdapter.updateBackgroundPadding(background);
         getRevealView().setBackground(background.getConstantState().newDrawable());
     }
 
diff --git a/src/com/android/launcher3/AppsGridAdapter.java b/src/com/android/launcher3/AppsGridAdapter.java
index dfbfa01..d5a411e 100644
--- a/src/com/android/launcher3/AppsGridAdapter.java
+++ b/src/com/android/launcher3/AppsGridAdapter.java
@@ -6,6 +6,7 @@
 import android.graphics.Paint;
 import android.graphics.PointF;
 import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
 import android.os.Handler;
 import android.support.v7.widget.GridLayoutManager;
 import android.support.v7.widget.RecyclerView;
@@ -112,9 +113,9 @@
 
                 if (shouldDrawItemDivider(holder, items) && !hasDrawnPredictedAppsDivider) {
                     // Draw the divider under the predicted apps
-                    parent.getBackground().getPadding(mTmpBounds);
                     int top = child.getTop() + child.getHeight();
-                    c.drawLine(mTmpBounds.left, top, parent.getWidth() - mTmpBounds.right, top,
+                    c.drawLine(mBackgroundPadding.left, top,
+                            parent.getWidth() - mBackgroundPadding.right, top,
                             mPredictedAppsDividerPaint);
                     hasDrawnPredictedAppsDivider = true;
 
@@ -265,6 +266,7 @@
     private View.OnTouchListener mTouchListener;
     private View.OnClickListener mIconClickListener;
     private View.OnLongClickListener mIconLongClickListener;
+    @Thunk final Rect mBackgroundPadding = new Rect();
     @Thunk int mPredictionBarHeight;
     @Thunk int mAppsPerRow;
     @Thunk boolean mIsRtl;
@@ -341,6 +343,14 @@
     }
 
     /**
+     * Notifies the adapter of the background padding so that it can draw things correctly in the
+     * item decorator.
+     */
+    public void updateBackgroundPadding(Drawable background) {
+        background.getPadding(mBackgroundPadding);
+    }
+
+    /**
      * Returns the grid layout manager.
      */
     public GridLayoutManager getLayoutManager() {
diff --git a/src/com/android/launcher3/FolderPagedView.java b/src/com/android/launcher3/FolderPagedView.java
index 94c016d..de30b60 100644
--- a/src/com/android/launcher3/FolderPagedView.java
+++ b/src/com/android/launcher3/FolderPagedView.java
@@ -237,13 +237,13 @@
         page.setInvertIfRtl(true);
         page.setGridSize(mGridCountX, mGridCountY);
 
-        LayoutParams lp = generateDefaultLayoutParams();
-        lp.isFullScreenPage = true;
-        addView(page, -1, lp);
+        addView(page, -1, generateDefaultLayoutParams());
         return page;
     }
 
     public void setFixedSize(int width, int height) {
+        width -= (getPaddingLeft() + getPaddingRight());
+        height -= (getPaddingTop() + getPaddingBottom());
         for (int i = getChildCount() - 1; i >= 0; i --) {
             ((CellLayout) getChildAt(i)).setFixedSize(width, height);
         }
@@ -339,11 +339,13 @@
     }
 
     public int getDesiredWidth() {
-        return getPageCount() > 0 ? getPageAt(0).getDesiredWidth() : 0;
+        return getPageCount() > 0 ?
+                (getPageAt(0).getDesiredWidth() + getPaddingLeft() + getPaddingRight()) : 0;
     }
 
     public int getDesiredHeight()  {
-        return  getPageCount() > 0 ? getPageAt(0).getDesiredHeight() : 0;
+        return  getPageCount() > 0 ?
+                (getPageAt(0).getDesiredHeight() + getPaddingTop() + getPaddingBottom()) : 0;
     }
 
     public int getItemCount() {
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 2ed490b..554a975 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -912,7 +912,8 @@
                     pageGap = getPaddingRight();
                 }
 
-                childLeft += childWidth + pageGap;
+                childLeft += childWidth + pageGap
+                        + (lp.isFullScreenPage ? 0 : (getPaddingLeft() + getPaddingRight()));
             }
         }