diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index dc498a4..ad39541 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -176,6 +176,7 @@
         // The translate of scrollX and scrollY is necessary when drawing TextViews, because
         // they set scrollX and scrollY to large values to achieve centered text
         destCanvas.save();
+        destCanvas.scale(getScaleX(), getScaleY(), getWidth() / 2, getHeight() / 2);
         destCanvas.translate(-getScrollX() + padding / 2, -getScrollY() + padding / 2);
         destCanvas.clipRect(clipRect, Op.REPLACE);
         draw(destCanvas);
@@ -286,6 +287,14 @@
                 canvas.translate(-scrollX, -scrollY);
             }
         }
+
+        // If text is transparent, don't draw any shadow
+        if (getCurrentTextColor() == android.R.color.transparent) {
+            getPaint().clearShadowLayer();
+            super.draw(canvas);
+            return;
+        }
+
         // We enhance the shadow by drawing the shadow twice
         getPaint().setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
         super.draw(canvas);
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 8aae809..a6c2c5f 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -28,6 +28,7 @@
 import android.content.res.TypedArray;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
+import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.Point;
 import android.graphics.PointF;
@@ -135,6 +136,9 @@
     private TimeInterpolator mEaseOutInterpolator;
     private CellLayoutChildren mChildren;
 
+    private boolean mIsHotseat = false;
+    private final int mBubbleScalePercent;
+
     public CellLayout(Context context) {
         this(context, null);
     }
@@ -180,6 +184,8 @@
         mNormalBackground.setFilterBitmap(true);
         mActiveGlowBackground.setFilterBitmap(true);
 
+        mBubbleScalePercent = res.getInteger(R.integer.app_icon_hotseat_scale_percent);
+
         // Initialize the data structures used for the drag visualization.
 
         mCrosshairsDrawable = res.getDrawable(R.drawable.gardening_crosshairs);
@@ -492,6 +498,25 @@
 
     @Override
     protected void dispatchDraw(Canvas canvas) {
+        // Debug drawing for hit space
+        if (false) {
+            final Rect frame = mRect;
+            for (int i = mChildren.getChildCount() - 1; i >= 0; i--) {
+                final View child = mChildren.getChildAt(i);
+                final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+
+                if ((child.getVisibility() == VISIBLE || child.getAnimation() != null) &&
+                        lp.isLockedToGrid) {
+                    child.getHitRect(frame);
+                    frame.offset(mPaddingLeft, mPaddingTop);
+
+                    Paint p = new Paint();
+                    p.setColor(Color.GREEN);
+                    canvas.drawRect(frame, p);
+                }
+            }
+        }
+
         super.dispatchDraw(canvas);
         if (mForegroundAlpha > 0) {
             mOverScrollForegroundDrawable.setBounds(mForegroundRect);
@@ -554,10 +579,55 @@
         return mCountY;
     }
 
+    public void setIsHotseat(boolean isHotseat) {
+        mIsHotseat = isHotseat;
+    }
+
     public boolean addViewToCellLayout(
             View child, int index, int childId, LayoutParams params, boolean markCells) {
+        return addViewToCellLayout(child, index, childId, params, markCells, false);
+    }
+
+    public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params,
+            boolean markCells, boolean allApps) {
         final LayoutParams lp = params;
 
+        // Hotseat icons - scale down and remove text
+        // Don't scale the all apps button
+        // scale percent set to -1 means do not scale
+        // Only scale BubbleTextViews
+        if (child instanceof BubbleTextView) {
+            BubbleTextView bubbleChild = (BubbleTextView) child;
+
+            if (mIsHotseat && !allApps && mBubbleScalePercent >= 0) {
+                // If we haven't measured the child yet, do it now
+                // (this happens if we're being dropped from all-apps
+                if ((bubbleChild.getMeasuredWidth() | bubbleChild.getMeasuredHeight()) == 0) {
+                    getChildrenLayout().measureChild(bubbleChild);
+                }
+                int measuredWidth = bubbleChild.getMeasuredWidth();
+                int measuredHeight = bubbleChild.getMeasuredHeight();
+
+                float bubbleScale = mBubbleScalePercent / 100f;
+                bubbleChild.setPivotX(0);
+                bubbleChild.setPivotY(0);
+                bubbleChild.setScaleX(bubbleScale);
+                bubbleChild.setScaleY(bubbleScale);
+                bubbleChild.setTranslationX(measuredWidth * (1 - bubbleScale) / 2);
+                bubbleChild.setTranslationY(measuredHeight * (1 - bubbleScale) / 2);
+
+                bubbleChild.setTextColor(android.R.color.transparent);
+            } else {
+                bubbleChild.setScaleX(1f);
+                bubbleChild.setScaleY(1f);
+                bubbleChild.setTranslationX(0f);
+                bubbleChild.setTranslationY(0f);
+
+                bubbleChild.setTextColor(
+                        getResources().getColor(R.color.workspace_icon_text_color));
+            }
+        }
+
         // Generate an id for each view, this assumes we have at most 256x256 cells
         // per workspace screen
         if (lp.cellX >= 0 && lp.cellX <= mCountX - 1 && lp.cellY >= 0 && lp.cellY <= mCountY - 1) {
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java
index f7fa380..add62c0 100644
--- a/src/com/android/launcher2/Hotseat.java
+++ b/src/com/android/launcher2/Hotseat.java
@@ -29,13 +29,13 @@
 
 public class Hotseat extends FrameLayout {
     private static final String TAG = "Hotseat";
-    private static final int sAllAppsButtonRank = 2; // In the middle of the dock
 
     private Launcher mLauncher;
     private CellLayout mContent;
 
     private int mCellCountX;
     private int mCellCountY;
+    private int mAllAppsButtonRank;
     private boolean mIsLandscape;
 
     public Hotseat(Context context) {
@@ -53,6 +53,7 @@
                 R.styleable.Hotseat, defStyle, 0);
         mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, -1);
         mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, -1);
+        mAllAppsButtonRank = context.getResources().getInteger(R.integer.hotseat_all_apps_index);
         mIsLandscape = context.getResources().getConfiguration().orientation ==
             Configuration.ORIENTATION_LANDSCAPE;
     }
@@ -77,8 +78,8 @@
     int getCellYFromOrder(int rank) {
         return mIsLandscape ? (mContent.getCountY() - (rank + 1)) : 0;
     }
-    public static boolean isAllAppsButtonRank(int rank) {
-        return rank == sAllAppsButtonRank;
+    public boolean isAllAppsButtonRank(int rank) {
+        return rank == mAllAppsButtonRank;
     }
 
     @Override
@@ -88,6 +89,7 @@
         if (mCellCountY < 0) mCellCountY = LauncherModel.getCellCountY();
         mContent = (CellLayout) findViewById(R.id.layout);
         mContent.setGridSize(mCellCountX, mCellCountY);
+        mContent.setIsHotseat(true);
 
         resetLayout();
     }
@@ -126,9 +128,9 @@
 
         // Note: We do this to ensure that the hotseat is always laid out in the orientation of
         // the hotseat in order regardless of which orientation they were added
-        int x = getCellXFromOrder(sAllAppsButtonRank);
-        int y = getCellYFromOrder(sAllAppsButtonRank);
+        int x = getCellXFromOrder(mAllAppsButtonRank);
+        int y = getCellYFromOrder(mAllAppsButtonRank);
         mContent.addViewToCellLayout(allAppsButton, -1, 0, new CellLayout.LayoutParams(x,y,1,1),
-                true);
+                true, true);
     }
 }
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 8e074b5..63fb12c 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2129,6 +2129,10 @@
         return (mState == State.APPS_CUSTOMIZE);
     }
 
+    public boolean isAllAppsButtonRank(int rank) {
+        return mHotseat.isAllAppsButtonRank(rank);
+    }
+
     // AllAppsView.Watcher
     public void zoomed(float zoom) {
         if (zoom == 1.0f) {
diff --git a/src/com/android/launcher2/LauncherApplication.java b/src/com/android/launcher2/LauncherApplication.java
index 9936ca6..29c93be 100644
--- a/src/com/android/launcher2/LauncherApplication.java
+++ b/src/com/android/launcher2/LauncherApplication.java
@@ -26,6 +26,8 @@
 import android.database.ContentObserver;
 import android.os.Handler;
 
+import com.android.launcher.R;
+
 import java.lang.ref.WeakReference;
 
 public class LauncherApplication extends Application {
@@ -40,10 +42,7 @@
         super.onCreate();
 
         // set sIsScreenXLarge and sScreenDensity *before* creating icon cache
-        final int screenSize = getResources().getConfiguration().screenLayout &
-                Configuration.SCREENLAYOUT_SIZE_MASK;
-        sIsScreenLarge = screenSize == Configuration.SCREENLAYOUT_SIZE_LARGE ||
-            screenSize == Configuration.SCREENLAYOUT_SIZE_XLARGE;
+        sIsScreenLarge = getResources().getBoolean(R.bool.is_large_screen);
         sScreenDensity = getResources().getDisplayMetrics().density;
 
         mIconCache = new IconCache(this);
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 7da55db..159ddb0 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -138,6 +138,7 @@
         public void bindAppsRemoved(ArrayList<ApplicationInfo> apps, boolean permanent);
         public void bindPackagesUpdated();
         public boolean isAllAppsVisible();
+        public boolean isAllAppsButtonRank(int rank);
         public void bindSearchablesChanged();
     }
 
@@ -920,7 +921,7 @@
             int containerIndex = item.screen;
             if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
                 // Return early if we detect that an item is under the hotseat button
-                if (Hotseat.isAllAppsButtonRank(item.screen)) {
+                if (mCallbacks == null || mCallbacks.get().isAllAppsButtonRank(item.screen)) {
                     return false;
                 }
 
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index a01cc47..de9a9b2 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -706,6 +706,8 @@
             ContentValues values = new ContentValues();
 
             PackageManager packageManager = mContext.getPackageManager();
+            int allAppsButtonRank =
+                    mContext.getResources().getInteger(R.integer.hotseat_all_apps_index);
             int i = 0;
             try {
                 XmlResourceParser parser = mContext.getResources().getXml(workspaceResourceId);
@@ -739,8 +741,8 @@
                     // If we are adding to the hotseat, the screen is used as the position in the
                     // hotseat. This screen can't be at position 0 because AllApps is in the
                     // zeroth position.
-                    if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
-                            Hotseat.isAllAppsButtonRank(Integer.valueOf(screen))) {
+                    if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT
+                            && Integer.valueOf(screen) == allAppsButtonRank) {
                         throw new RuntimeException("Invalid screen position for hotseat item");
                     }
 
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index d7562a9..0387011 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -113,7 +113,6 @@
             }
             int sourceWidth = icon.getIntrinsicWidth();
             int sourceHeight = icon.getIntrinsicHeight();
-
             if (sourceWidth > 0 && sourceHeight > 0) {
                 // There are intrinsic sizes.
                 if (width < sourceWidth || height < sourceHeight) {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 7ba3950..a6a1ed5 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -658,7 +658,7 @@
                 return;
             } else if (theta > START_DAMPING_TOUCH_SLOP_ANGLE) {
                 // Above START_DAMPING_TOUCH_SLOP_ANGLE and below MAX_SWIPE_ANGLE, we want to
-                // increase the touch slop to make it harder to begin scrolling the workspace. This 
+                // increase the touch slop to make it harder to begin scrolling the workspace. This
                 // results in vertically scrolling widgets to more easily. The higher the angle, the
                 // more we increase touch slop.
                 theta -= START_DAMPING_TOUCH_SLOP_ANGLE;
@@ -1444,7 +1444,7 @@
      * This interpolator emulates the rate at which the perceived scale of an object changes
      * as its distance from a camera increases. When this interpolator is applied to a scale
      * animation on a view, it evokes the sense that the object is shrinking due to moving away
-     * from the camera. 
+     * from the camera.
      */
     static class ZInterpolator implements TimeInterpolator {
         private float focalLength;
@@ -1621,7 +1621,7 @@
             setLayoutScale(1.0f);
         }
 
-        final int duration = zoomIn ? 
+        final int duration = zoomIn ?
                 getResources().getInteger(R.integer.config_workspaceUnshrinkTime) :
                 getResources().getInteger(R.integer.config_appsCustomizeWorkspaceShrinkTime);
         for (int i = 0; i < getChildCount(); i++) {
@@ -2056,7 +2056,7 @@
                 // is full
                 if (mTargetCell != null && mLauncher.isHotseatLayout(mDragTargetLayout)) {
                     Hotseat hotseat = mLauncher.getHotseat();
-                    if (Hotseat.isAllAppsButtonRank(
+                    if (hotseat.isAllAppsButtonRank(
                             hotseat.getOrderInHotseat(mTargetCell[0], mTargetCell[1]))) {
                         return false;
                     }
@@ -3043,6 +3043,7 @@
             CellLayout.LayoutParams lp = (CellLayout.LayoutParams) view.getLayoutParams();
             cellLayout.getChildrenLayout().measureChild(view);
 
+
             LauncherModel.addOrMoveItemInDatabase(mLauncher, info, container, screen,
                     lp.cellX, lp.cellY);
 
