Merge "Keeping folders synced when applications are uninstalled"
diff --git a/res/drawable-hdpi/apps_customize_bg.png b/res/drawable-hdpi/apps_customize_bg.png
new file mode 100644
index 0000000..81768d7
--- /dev/null
+++ b/res/drawable-hdpi/apps_customize_bg.png
Binary files differ
diff --git a/res/drawable-hdpi/widget_info_bg.9.png b/res/drawable-hdpi/widget_info_bg.9.png
new file mode 100644
index 0000000..217b35c
--- /dev/null
+++ b/res/drawable-hdpi/widget_info_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/apps_customize_bg.png b/res/drawable-mdpi/apps_customize_bg.png
new file mode 100644
index 0000000..81768d7
--- /dev/null
+++ b/res/drawable-mdpi/apps_customize_bg.png
Binary files differ
diff --git a/res/drawable-mdpi/widget_info_bg.9.png b/res/drawable-mdpi/widget_info_bg.9.png
new file mode 100644
index 0000000..7fd1c20
--- /dev/null
+++ b/res/drawable-mdpi/widget_info_bg.9.png
Binary files differ
diff --git a/res/drawable-nodpi/all_apps_bg_gradient.9.png b/res/drawable-nodpi/all_apps_bg_gradient.9.png
deleted file mode 100644
index 3f4b5b5..0000000
--- a/res/drawable-nodpi/all_apps_bg_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 1b8be80..8361d16 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -23,6 +23,7 @@
         <!-- The layout_width of the tab bar gets overriden to align the content
              with the text in the tabs in AppsCustomizeTabHost. -->
         <FrameLayout
+            android:id="@+id/tabs_container"
             android:layout_width="wrap_content"
             android:layout_height="@dimen/qsb_bar_height"
             android:layout_gravity="center_horizontal">
diff --git a/res/layout/apps_customize_widget.xml b/res/layout/apps_customize_widget.xml
index 38973b5..31c3fbe 100644
--- a/res/layout/apps_customize_widget.xml
+++ b/res/layout/apps_customize_widget.xml
@@ -28,58 +28,53 @@
     android:background="@drawable/focusable_view_bg"
     android:focusable="true">
 
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="4dp"
+        android:orientation="vertical"
+        android:background="@drawable/widget_info_bg">
+        <!-- The name of the widget. -->
+        <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+            android:id="@+id/widget_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="0"
+            android:gravity="left|bottom"
+            android:singleLine="true"
+            android:ellipsize="marquee"
+            android:fadingEdge="horizontal"
+
+            android:textColor="#FFBBBBBB"
+            android:textSize="14sp"
+            android:shadowColor="#FF000000"
+            android:shadowDx="0.0"
+            android:shadowDy="1.0"
+            android:shadowRadius="1.0" />
+
+        <!-- The original dimensions of the widget (can't be the same text as above due to different
+             style. -->
+        <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+            android:id="@+id/widget_dims"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="0"
+            android:gravity="left|bottom"
+
+            android:textColor="#FF999999"
+            android:textSize="12sp"
+            android:shadowColor="#99000000"
+            android:shadowDx="0.0"
+            android:shadowDy="1.0"
+            android:shadowRadius="1.0" />
+    </LinearLayout>
+
     <!-- The icon of the widget. -->
     <ImageView
         android:id="@+id/widget_preview"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:paddingBottom="5dp"
         android:adjustViewBounds="true"
         android:scaleType="fitStart" />
-
-    <!-- The divider image.
-         This view is removed in PagedViewWidget.java in the Phone UI. -->
-    <ImageView
-        android:id="@+id/divider"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_weight="0"
-        android:paddingTop="10dp"
-        android:paddingBottom="10dp"
-        android:src="@drawable/widget_divider" />
-
-    <!-- The name of the widget. -->
-    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@+id/widget_name"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_weight="0"
-        android:gravity="left|bottom"
-
-        android:textColor="#FFFFFFFF"
-        android:textSize="14sp"
-        android:shadowColor="#FF000000"
-        android:shadowDx="0.0"
-        android:shadowDy="1.0"
-        android:shadowRadius="1.0"
-
-        android:maxLines="2"
-        android:fadingEdge="horizontal" />
-
-    <!-- The original dimensions of the widget (can't be the same text as above due to different
-         style. -->
-    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@+id/widget_dims"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_weight="0"
-        android:gravity="left|bottom"
-
-        android:textColor="#FF999999"
-        android:textSize="14sp"
-        android:shadowColor="#99000000"
-        android:shadowDx="0.0"
-        android:shadowDy="1.0"
-        android:shadowRadius="1.0" />
 </com.android.launcher2.PagedViewWidget>
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index b00e8c3..4540c15 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -40,7 +40,7 @@
 
 <!-- AppsCustomize -->
     <dimen name="apps_customize_widget_cell_width_gap">30dp</dimen>
-    <dimen name="apps_customize_widget_cell_height_gap">0dp</dimen>
+    <dimen name="apps_customize_widget_cell_height_gap">5dp</dimen>
     <integer name="apps_customize_widget_cell_count_x">3</integer>
     <integer name="apps_customize_widget_cell_count_y">1</integer>
 </resources>
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index 3b18653..8b423dd 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -37,7 +37,7 @@
     <dimen name="all_apps_view_pageLayoutPaddingRight">0dp</dimen>
 
     <dimen name="apps_customize_widget_cell_width_gap">20dp</dimen>
-    <dimen name="apps_customize_widget_cell_height_gap">40dp</dimen>
+    <dimen name="apps_customize_widget_cell_height_gap">10dp</dimen>
     <integer name="apps_customize_widget_cell_count_x">2</integer>
     <integer name="apps_customize_widget_cell_count_y">2</integer>
 </resources>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index da6e7de..e793363 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -43,6 +43,7 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.AccelerateInterpolator;
+import android.widget.GridLayout;
 import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.Toast;
@@ -76,13 +77,14 @@
         doInBackgroundCallback = bgR;
         postExecuteCallback = postR;
     }
-    AsyncTaskPageData(int p, ArrayList<Object> l, int cw, int ch, AsyncTaskCallback bgR,
+    AsyncTaskPageData(int p, ArrayList<Object> l, int cw, int ch, int ccx, AsyncTaskCallback bgR,
             AsyncTaskCallback postR) {
         page = p;
         items = l;
         generatedImages = new ArrayList<Bitmap>();
         cellWidth = cw;
         cellHeight = ch;
+        cellCountX = ccx;
         doInBackgroundCallback = bgR;
         postExecuteCallback = postR;
     }
@@ -92,6 +94,7 @@
     ArrayList<Bitmap> generatedImages;
     int cellWidth;
     int cellHeight;
+    int cellCountX;
     AsyncTaskCallback doInBackgroundCallback;
     AsyncTaskCallback postExecuteCallback;
 }
@@ -155,7 +158,8 @@
     // Content
     private ContentType mContentType;
     private ArrayList<ApplicationInfo> mApps;
-    private List<Object> mWidgets;
+    private ArrayList<Object> mWidgets;
+    private ArrayList<Object> mShortcuts;
 
     // Caching
     private Canvas mCanvas;
@@ -164,9 +168,12 @@
 
     // Dimens
     private int mContentWidth;
+    private int mAppIconSize;
     private int mMaxWidgetSpan, mMinWidgetSpan;
-    private int mWidgetWidthGap, mWidgetHeightGap;
     private int mWidgetCountX, mWidgetCountY;
+    private int mWidgetWidthGap, mWidgetHeightGap;
+    private int mShortcutCountX, mShortcutCountY;
+    private int mShortcutWidthGap, mShortcutHeightGap;
     private final int mWidgetPreviewIconPaddedDimension;
     private final float sWidgetPreviewIconPaddingPercentage = 0.25f;
     private PagedViewCellLayout mWidgetSpacingLayout;
@@ -182,6 +189,7 @@
         mContentType = ContentType.Applications;
         mApps = new ArrayList<ApplicationInfo>();
         mWidgets = new ArrayList<Object>();
+        mShortcuts = new ArrayList<Object>();
         mIconCache = ((LauncherApplication) context.getApplicationContext()).getIconCache();
         mHolographicOutlineHelper = new HolographicOutlineHelper();
         mCanvas = new Canvas();
@@ -190,6 +198,7 @@
         // Save the default widget preview background
         Resources resources = context.getResources();
         mDefaultWidgetBackground = resources.getDrawable(R.drawable.default_widget_preview);
+        mAppIconSize = getResources().getDimensionPixelSize(R.dimen.app_icon_size);
 
         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, 0, 0);
         // TODO-APPS_CUSTOMIZE: remove these unnecessary attrs after
@@ -213,9 +222,8 @@
 
         // The padding on the non-matched dimension for the default widget preview icons
         // (top + bottom)
-        int iconSize = resources.getDimensionPixelSize(R.dimen.app_icon_size);
         mWidgetPreviewIconPaddedDimension =
-            (int) (iconSize * (1 + (2 * sWidgetPreviewIconPaddingPercentage)));
+            (int) (mAppIconSize * (1 + (2 * sWidgetPreviewIconPaddingPercentage)));
     }
 
     @Override
@@ -237,7 +245,9 @@
      * This differs from isDataReady as this is the test done if isDataReady is not set.
      */
     private boolean testDataReady() {
-        return !mApps.isEmpty() && !mWidgets.isEmpty();
+        // We only do this test once, and we default to the Applications page, so we only really
+        // have to wait for there to be apps.
+        return !mApps.isEmpty();
     }
 
     protected void onDataReady(int width, int height) {
@@ -263,6 +273,9 @@
         mCellCountY = mWidgetSpacingLayout.getCellCountY();
         mWidgetCountX = Math.max(1, (int) Math.round(mCellCountX / 2f));
         mWidgetCountY = Math.max(1, (int) Math.round(mCellCountY / 3f));
+        mShortcutCountX = Math.max(1, (int) Math.round(mCellCountX / 2f));
+        mShortcutCountY = Math.max(1, (int) Math.round(mCellCountY / 2f));
+
         mContentWidth = mWidgetSpacingLayout.getContentWidth();
 
         invalidatePageData();
@@ -302,6 +315,7 @@
     public void onPackagesUpdated() {
         // Get the list of widgets and shortcuts
         mWidgets.clear();
+        mShortcuts.clear();
         List<AppWidgetProviderInfo> widgets =
             AppWidgetManager.getInstance(mLauncher).getInstalledProviders();
         Collections.sort(widgets,
@@ -311,7 +325,7 @@
         Collections.sort(shortcuts,
                 new LauncherModel.WidgetAndShortcutNameComparator(mPackageManager));
         mWidgets.addAll(widgets);
-        mWidgets.addAll(shortcuts);
+        mShortcuts.addAll(shortcuts);
 
         // The next layout pass will trigger data-ready if both widgets and apps are set, so request
         // a layout to do this test and invalidate the page data when ready.
@@ -373,11 +387,10 @@
         // Compose the visible rect of the drag image
         Rect dragRect = null;
         if (v instanceof TextView) {
-            int iconSize = getResources().getDimensionPixelSize(R.dimen.app_icon_size);
             int top = v.getPaddingTop();
-            int left = (b.getWidth() - iconSize) / 2;
-            int right = left + iconSize;
-            int bottom = top + iconSize;
+            int left = (b.getWidth() - mAppIconSize) / 2;
+            int right = left + mAppIconSize;
+            int bottom = top + mAppIconSize;
             dragRect = new Rect(left, top, right, bottom);
         }
 
@@ -512,7 +525,7 @@
         // expected page width, so we can actually optimize by hiding all the TextView-based
         // children that are expensive to measure, and let that happen naturally later.
         setVisibilityOnChildren(layout, View.GONE);
-        int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
+        int widthSpec = MeasureSpec.makeMeasureSpec(getPageContentWidth(), MeasureSpec.AT_MOST);
         int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
         layout.setMinimumWidth(getPageContentWidth());
         layout.measure(widthSpec, heightSpec);
@@ -585,7 +598,7 @@
      * Creates and executes a new AsyncTask to load a page of widget previews.
      */
     private void prepareLoadWidgetPreviewsTask(int page, ArrayList<Object> widgets,
-            int cellWidth, int cellHeight) {
+            int cellWidth, int cellHeight, int cellCountX) {
         // Prune all tasks that are no longer needed
         Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
         while (iter.hasNext()) {
@@ -601,7 +614,7 @@
         }
 
         AsyncTaskPageData pageData = new AsyncTaskPageData(page, widgets, cellWidth, cellHeight,
-            new AsyncTaskCallback() {
+            cellCountX, new AsyncTaskCallback() {
                 @Override
                 public void run(AppsCustomizeAsyncTask task, AsyncTaskPageData data) {
                     // Ensure that this task starts running at the correct priority
@@ -730,18 +743,11 @@
             d.setBounds(oldBounds); // Restore the bounds
         }
     }
-    private Bitmap getShortcutPreview(ResolveInfo info, int cellWidth,
-            int cellHeight) {
-        Resources resources = mLauncher.getResources();
-        int iconSize = resources.getDimensionPixelSize(R.dimen.app_icon_size);
-        // We only need to make it wide enough so as not allow the preview to be scaled
-        int expectedWidth = cellWidth;
-        int expectedHeight = mWidgetPreviewIconPaddedDimension;
-
+    private Bitmap getShortcutPreview(ResolveInfo info, int cellWidth, int cellHeight) {
         // Render the icon
-        Bitmap preview = Bitmap.createBitmap(expectedWidth, expectedHeight, Config.ARGB_8888);
+        Bitmap preview = Bitmap.createBitmap(cellWidth, mAppIconSize, Config.ARGB_8888);
         Drawable icon = mIconCache.getFullResIcon(info, mPackageManager);
-        renderDrawableToBitmap(icon, preview, 0, 0, iconSize, iconSize, 1f, 1f);
+        renderDrawableToBitmap(icon, preview, 0, 0, mAppIconSize, mAppIconSize, 1f, 1f);
         return preview;
     }
     private Bitmap getWidgetPreview(AppWidgetProviderInfo info,
@@ -790,7 +796,6 @@
         // Generate a preview image if we couldn't load one
         if (drawable == null) {
             Resources resources = mLauncher.getResources();
-            int iconSize = resources.getDimensionPixelSize(R.dimen.app_icon_size);
 
             // Specify the dimensions of the bitmap
             if (info.minWidth >= info.minHeight) {
@@ -813,8 +818,9 @@
                 if (info.icon > 0) icon = mPackageManager.getDrawable(packageName, info.icon, null);
                 if (icon == null) icon = resources.getDrawable(R.drawable.ic_launcher_application);
 
-                int offset = (int) (iconSize * sWidgetPreviewIconPaddingPercentage);
-                renderDrawableToBitmap(icon, preview, offset, offset, iconSize, iconSize, 1f, 1f);
+                int offset = (int) (mAppIconSize * sWidgetPreviewIconPaddingPercentage);
+                renderDrawableToBitmap(icon, preview, offset, offset,
+                        mAppIconSize, mAppIconSize, 1f, 1f);
             } catch (Resources.NotFoundException e) {}
         }
         return preview;
@@ -822,32 +828,49 @@
     public void syncWidgetPages() {
         // Ensure that we have the right number of pages
         Context context = getContext();
-        int numWidgetsPerPage = mWidgetCountX * mWidgetCountY;
-        int numPages = (int) Math.ceil(mWidgets.size() / (float) numWidgetsPerPage);
-        for (int i = 0; i < numPages; ++i) {
-            PagedViewGridLayout layout = new PagedViewGridLayout(context, mWidgetCountX,
-                    mWidgetCountY);
-            setupPage(layout);
-            addView(layout);
+        int[] countX = { mWidgetCountX, mShortcutCountX };
+        int[] countY = { mWidgetCountY, mShortcutCountY };
+        Object[] collection = { mWidgets, mShortcuts };
+        for (int i = 0; i < 2; ++i) {
+            ArrayList<Object> list = (ArrayList<Object>) collection[i];
+            int numItemsPerPage = countX[i] * countY[i];
+            int numItemPages = (int) Math.ceil(list.size() / (float) numItemsPerPage);
+            for (int j = 0; j < numItemPages; ++j) {
+                PagedViewGridLayout layout = new PagedViewGridLayout(context, countX[i],
+                        countY[i]);
+                setupPage(layout);
+                addView(layout);
+            }
         }
     }
     public void syncWidgetPageItems(int page) {
-        // Calculate the dimensions of each cell we are giving to each widget
-        ArrayList<Object> widgets = new ArrayList<Object>();
-        int cellWidth = ((mWidgetSpacingLayout.getContentWidth()
-                - mPageLayoutPaddingLeft - mPageLayoutPaddingRight
-                - ((mWidgetCountX - 1) * mWidgetWidthGap)) / mWidgetCountX);
-        int cellHeight = ((mWidgetSpacingLayout.getContentHeight()
-                - mPageLayoutPaddingTop - mPageLayoutPaddingBottom
-                - ((mWidgetCountY - 1) * mWidgetHeightGap)) / mWidgetCountY);
+        int[] countX = { mWidgetCountX, mShortcutCountX };
+        int[] countY = { mWidgetCountY, mShortcutCountY };
+        int[] widthGap = { mWidgetWidthGap, mWidgetWidthGap };
+        int[] heightGap = { mWidgetHeightGap, mWidgetHeightGap };
+        int[] numItemsPerPage = { mWidgetCountX * mWidgetCountY,
+                mShortcutCountX * mShortcutCountY };
+        Object[] collection = { mWidgets, mShortcuts };
+        int contentWidth = mWidgetSpacingLayout.getContentWidth();
+        int contentHeight = mWidgetSpacingLayout.getContentHeight();
+        int numWidgetPages = (int) Math.ceil(mWidgets.size() / (float) numItemsPerPage[0]);
+        int[] offsets = { page * numItemsPerPage[0], (page - numWidgetPages) * numItemsPerPage[1] };
+        int index = (page < numWidgetPages ? 0 : 1);
 
-        int numWidgetsPerPage = mWidgetCountX * mWidgetCountY;
-        int offset = page * numWidgetsPerPage;
-        for (int i = offset; i < Math.min(offset + numWidgetsPerPage, mWidgets.size()); ++i) {
-            widgets.add(mWidgets.get(i));
+        // Calculate the dimensions of each cell we are giving to each widget
+        ArrayList<Object> list = (ArrayList<Object>) collection[index];
+        ArrayList<Object> items = new ArrayList<Object>();
+        int cellWidth = ((contentWidth - mPageLayoutPaddingLeft - mPageLayoutPaddingRight
+                - ((countX[index] - 1) * widthGap[index])) / countX[index]);
+        int cellHeight = ((contentHeight - mPageLayoutPaddingTop - mPageLayoutPaddingBottom
+                - ((countY[index] - 1) * heightGap[index])) / countY[index]);
+
+        int offset = offsets[index];
+        for (int i = offset; i < Math.min(offset + numItemsPerPage[index], list.size()); ++i) {
+            items.add(list.get(i));
         }
 
-        prepareLoadWidgetPreviewsTask(page, widgets, cellWidth, cellHeight);
+        prepareLoadWidgetPreviewsTask(page, items, cellWidth, cellHeight, countX[index]);
     }
     private void onSyncWidgetPageItems(AsyncTaskPageData data) {
         int page = data.page;
@@ -858,6 +881,7 @@
         int count = items.size();
         int cellWidth = data.cellWidth;
         int cellHeight = data.cellHeight;
+        int cellCountX = data.cellCountX;
         for (int i = 0; i < count; ++i) {
             Object rawInfo = items.get(i);
             PendingAddItemInfo createItemInfo = null;
@@ -890,12 +914,15 @@
             widget.setOnTouchListener(this);
 
             // Layout each widget
-            int ix = i % mWidgetCountX;
-            int iy = i / mWidgetCountX;
-            PagedViewGridLayout.LayoutParams lp = new PagedViewGridLayout.LayoutParams(cellWidth,
-                    cellHeight);
-            lp.leftMargin = (ix * cellWidth) + (ix * mWidgetWidthGap);
-            lp.topMargin = (iy * cellHeight) + (iy * mWidgetHeightGap);
+            int ix = i % cellCountX;
+            int iy = i / cellCountX;
+            GridLayout.LayoutParams lp = new GridLayout.LayoutParams(
+                    new GridLayout.Group(iy, 1, GridLayout.LEFT),
+                    new GridLayout.Group(ix, 1, GridLayout.TOP));
+            lp.width = cellWidth;
+            lp.height = cellHeight;
+            if (ix > 0) lp.leftMargin = mWidgetWidthGap;
+            if (iy > 0) lp.topMargin = mWidgetHeightGap;
             layout.addView(widget, lp);
         }
 
@@ -1083,9 +1110,10 @@
         // TODO: Dump information related to current list of Applications, Widgets, etc.
         ApplicationInfo.dumpApplicationInfoList(LOG_TAG, "mApps", mApps);
         dumpAppWidgetProviderInfoList(LOG_TAG, "mWidgets", mWidgets);
+        dumpAppWidgetProviderInfoList(LOG_TAG, "mShortcuts", mShortcuts);
     }
     private void dumpAppWidgetProviderInfoList(String tag, String label,
-            List<Object> list) {
+            ArrayList<Object> list) {
         Log.d(tag, label + " size=" + list.size());
         for (Object i: list) {
             if (i instanceof AppWidgetProviderInfo) {
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 87c154b..587a3eb 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -39,9 +39,11 @@
 
     private static final String APPS_TAB_TAG = "APPS";
     private static final String WIDGETS_TAB_TAG = "WIDGETS";
+    private static final int sTabBarFadeInDuration = 150;
 
     private final LayoutInflater mLayoutInflater;
     private ViewGroup mTabs;
+    private ViewGroup mTabsContainer;
     private AppsCustomizePagedView mAppsCustomizePane;
 
     public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
@@ -67,10 +69,12 @@
         // Setup the tab host
         setup();
 
+        final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
         final TabWidget tabs = (TabWidget) findViewById(com.android.internal.R.id.tabs);
         final AppsCustomizePagedView appsCustomizePane = (AppsCustomizePagedView)
                 findViewById(R.id.apps_customize_pane_content);
         mTabs = tabs;
+        mTabsContainer = tabsContainer;
         mAppsCustomizePane = appsCustomizePane;
         if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();
 
@@ -98,6 +102,9 @@
         lastTab.setOnKeyListener(keyListener);
         View shopButton = findViewById(R.id.market_button);
         shopButton.setOnKeyListener(keyListener);
+
+        // Hide the tab bar until we measure
+        mTabsContainer.setAlpha(0f);
     }
 
     @Override
@@ -107,9 +114,15 @@
 
         // Set the width of the tab list to the content width
         if (remeasureTabWidth) {
-            mTabs.getLayoutParams().width = mAppsCustomizePane.getPageContentWidth();
-            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+            int contentWidth = mAppsCustomizePane.getPageContentWidth();
+            if (contentWidth > 0) {
+                // Set the width and show the tab bar (if we have a loading graphic, we can switch
+                // it off here)
+                mTabs.getLayoutParams().width = contentWidth;
+                mTabsContainer.animate().alpha(1f).setDuration(sTabBarFadeInDuration);
+            }
         }
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
     }
 
     @Override
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index f65f458..3f4a47c 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2864,7 +2864,10 @@
             AddAdapter.ListItem item = (AddAdapter.ListItem) mAdapter.getItem(which);
             switch (item.actionTag) {
                 case AddAdapter.ITEM_SHORTCUT: {
-                    pickShortcut();
+                    if (mAppsCustomizeTabHost != null) {
+                        mAppsCustomizeTabHost.selectWidgetsTab();
+                    }
+                    showAllApps(true);
                     break;
                 }
                 case AddAdapter.ITEM_APPLICATION: {
diff --git a/src/com/android/launcher2/PagedViewGridLayout.java b/src/com/android/launcher2/PagedViewGridLayout.java
index c6d39fd..a2ab763 100644
--- a/src/com/android/launcher2/PagedViewGridLayout.java
+++ b/src/com/android/launcher2/PagedViewGridLayout.java
@@ -19,14 +19,13 @@
 import android.content.Context;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.View.MeasureSpec;
 import android.widget.FrameLayout;
-import android.widget.LinearLayout;
+import android.widget.GridLayout;
 
 /**
  * The grid based layout used strictly for the widget/wallpaper tab of the AppsCustomize pane
  */
-public class PagedViewGridLayout extends FrameLayout implements Page {
+public class PagedViewGridLayout extends GridLayout implements Page {
     static final String TAG = "PagedViewGridLayout";
 
     private int mCellCountX;
@@ -36,6 +35,7 @@
         super(context, null, 0);
         mCellCountX = cellCountX;
         mCellCountY = cellCountY;
+        setColumnCount(mCellCountX);
     }
 
     int getCellCountX() {
@@ -50,9 +50,9 @@
         // offset of each page to scroll to before it updates the actual size of each page
         // (which can change depending on the content if the contents aren't a fixed size).
         // We work around this by having a minimum size on each widget page).
-        int widthSpecSize = Math.max(getSuggestedMinimumWidth(),
+        int widthSpecSize = Math.min(getSuggestedMinimumWidth(),
                 MeasureSpec.getSize(widthMeasureSpec));
-        int widthSpecMode = MeasureSpec.AT_MOST;
+        int widthSpecMode = MeasureSpec.EXACTLY;
         super.onMeasure(MeasureSpec.makeMeasureSpec(widthSpecSize, widthSpecMode),
                 heightMeasureSpec);
     }
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index d6f6656..365965d 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -112,11 +112,6 @@
         final TextView dims = (TextView) findViewById(R.id.widget_dims);
         dims.setText(String.format(mDimensionsFormatString, cellSpan[0], cellSpan[1]));
         dims.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
-        
-        // Hide the divider in the Phone UI.
-        if (!LauncherApplication.isScreenLarge()) {
-            findViewById(R.id.divider).setVisibility(View.GONE);
-        }
     }
 
     public void applyFromResolveInfo(PackageManager pm, ResolveInfo info,
@@ -133,11 +128,6 @@
             dims.setText(String.format(mDimensionsFormatString, 1, 1));
             dims.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
         }
-        
-        // Hide the divider in the Phone UI.
-        if (!LauncherApplication.isScreenLarge()) {
-            findViewById(R.id.divider).setVisibility(View.GONE);
-        }
     }
 
     public void setHolographicOutline(Bitmap holoOutline) {
@@ -184,7 +174,8 @@
             mPaint.setAlpha(mHolographicAlpha);
             canvas.save();
             canvas.scale(mTmpScaleRect.right, mTmpScaleRect.bottom);
-            canvas.drawBitmap(mHolographicOutline, 0, 0, mPaint);
+            canvas.drawBitmap(mHolographicOutline, mPreviewImageView.getLeft(),
+                    mPreviewImageView.getTop(), mPaint);
             canvas.restore();
         }
     }
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b24014b..7fa96fb 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -323,7 +323,7 @@
 
         try {
             final Resources res = getResources();
-            mBackground = res.getDrawable(R.drawable.all_apps_bg_gradient);
+            mBackground = res.getDrawable(R.drawable.apps_customize_bg);
         } catch (Resources.NotFoundException e) {
             // In this case, we will skip drawing background protection
         }
@@ -2549,7 +2549,12 @@
         if (!mIsSmall) {
             mDragTargetLayout = getCurrentDropLayout();
             mDragTargetLayout.onDragEnter();
-            showOutlines();
+
+            // Because we don't have space in the Phone UI (the CellLayouts run to the edge) we
+            // don't need to show the outlines
+            if (!LauncherApplication.isScreenLarge()) {
+                showOutlines();
+            }
         }
     }