Layout tweaks in Launcher

-Removed All apps and Configure toolbar buttons
from Customization Drawer, removed Configure
button from All apps and added Market icon
to All apps
-Changed spacing of CellLayouts when scrolling
-Modified gap spacing in workspace layout
-Made workspace invisible in All apps but touching
the place where the workspace was takes you back
to workspace

Change-Id: I6e2579bfebeb8f1f80fdae07da442f6d399abe33
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index d4dffe6..fb8b7d6 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -349,11 +349,16 @@
             throw new IllegalStateException("Workspace can only be used in EXACTLY mode.");
         }
 
+        /* Allow the height to be set as WRAP_CONTENT. This allows the particular case
+         * of the All apps view on XLarge displays to not take up more space then it needs. Width
+         * is still not allowed to be set as WRAP_CONTENT since many parts of the code expect
+         * each page to have the same width.
+         */
         final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
-        final int heightSize = MeasureSpec.getSize(heightMeasureSpec);
-        if (heightMode != MeasureSpec.EXACTLY) {
-            throw new IllegalStateException("Workspace can only be used in EXACTLY mode.");
-        }
+        int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+        int maxChildHeight = 0;
+
+        final int verticalPadding = mPaddingTop + mPaddingBottom;
 
         // The children are given the same width and height as the workspace
         // unless they were set to WRAP_CONTENT
@@ -380,9 +385,14 @@
             final int childWidthMeasureSpec =
                 MeasureSpec.makeMeasureSpec(widthSize, childWidthMode);
             final int childHeightMeasureSpec =
-                MeasureSpec.makeMeasureSpec(heightSize, childHeightMode);
+                MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode);
 
             child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
+            maxChildHeight = Math.max(maxChildHeight, child.getMeasuredHeight());
+        }
+
+        if (heightMode == MeasureSpec.AT_MOST) {
+            heightSize = maxChildHeight + verticalPadding;
         }
 
         setMeasuredDimension(widthSize, heightSize);
@@ -399,6 +409,7 @@
             mFirstLayout = false;
         }
 
+        final int verticalPadding = mPaddingTop + mPaddingBottom;
         final int childCount = getChildCount();
         int childLeft = 0;
         if (childCount > 0) {
@@ -409,10 +420,13 @@
             final View child = getChildAt(i);
             if (child.getVisibility() != View.GONE) {
                 final int childWidth = child.getMeasuredWidth();
-                final int childHeight = (mCenterPagesVertically ?
-                        (getMeasuredHeight() - child.getMeasuredHeight()) / 2 : 0);
-                child.layout(childLeft, childHeight,
-                        childLeft + childWidth, childHeight + child.getMeasuredHeight());
+                final int childHeight = child.getMeasuredHeight();
+                int childTop = mPaddingTop;
+                if (mCenterPagesVertically) {
+                    childTop += ((getMeasuredHeight() - verticalPadding) - childHeight) / 2;
+                }
+                child.layout(childLeft, childTop,
+                        childLeft + childWidth, childTop + childHeight);
                 childLeft += childWidth + mPageSpacing;
             }
         }