Merge branch 'master' into honeycomb-release
diff --git a/res/drawable-xlarge-mdpi/all_apps_button_focused.png b/res/drawable-xlarge-mdpi/all_apps_button_focused.png
new file mode 100644
index 0000000..a9d5a3f
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/all_apps_button_focused.png
Binary files differ
diff --git a/res/drawable-xlarge/all_apps_button_normal.9.png b/res/drawable-xlarge-mdpi/all_apps_button_normal.9.png
similarity index 100%
rename from res/drawable-xlarge/all_apps_button_normal.9.png
rename to res/drawable-xlarge-mdpi/all_apps_button_normal.9.png
Binary files differ
diff --git a/res/drawable-xlarge/all_apps_button_pressed.9.png b/res/drawable-xlarge-mdpi/all_apps_button_pressed.9.png
similarity index 100%
rename from res/drawable-xlarge/all_apps_button_pressed.9.png
rename to res/drawable-xlarge-mdpi/all_apps_button_pressed.9.png
Binary files differ
diff --git a/res/drawable-xlarge/app_market_generic.png b/res/drawable-xlarge-mdpi/app_market_generic.png
similarity index 100%
rename from res/drawable-xlarge/app_market_generic.png
rename to res/drawable-xlarge-mdpi/app_market_generic.png
Binary files differ
diff --git a/res/drawable-xlarge/configure_button_normal.png b/res/drawable-xlarge-mdpi/configure_button_normal.png
similarity index 100%
rename from res/drawable-xlarge/configure_button_normal.png
rename to res/drawable-xlarge-mdpi/configure_button_normal.png
Binary files differ
diff --git a/res/drawable-xlarge/configure_button_pressed.png b/res/drawable-xlarge-mdpi/configure_button_pressed.png
similarity index 100%
rename from res/drawable-xlarge/configure_button_pressed.png
rename to res/drawable-xlarge-mdpi/configure_button_pressed.png
Binary files differ
diff --git a/res/drawable-xlarge/glow_wallpaper.png b/res/drawable-xlarge-mdpi/glow_wallpaper.png
similarity index 100%
rename from res/drawable-xlarge/glow_wallpaper.png
rename to res/drawable-xlarge-mdpi/glow_wallpaper.png
Binary files differ
diff --git a/res/drawable-xlarge/glow_wallpaper_small.png b/res/drawable-xlarge-mdpi/glow_wallpaper_small.png
similarity index 100%
rename from res/drawable-xlarge/glow_wallpaper_small.png
rename to res/drawable-xlarge-mdpi/glow_wallpaper_small.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/home_screen_bg.9.png b/res/drawable-xlarge-mdpi/home_screen_bg.9.png
new file mode 100644
index 0000000..413e492
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/home_screen_bg.9.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/home_screen_bg_hover.9.png b/res/drawable-xlarge-mdpi/home_screen_bg_hover.9.png
new file mode 100644
index 0000000..73696bf
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/home_screen_bg_hover.9.png
Binary files differ
diff --git a/res/drawable-xlarge/ic_no_applications.png b/res/drawable-xlarge-mdpi/ic_no_applications.png
similarity index 100%
rename from res/drawable-xlarge/ic_no_applications.png
rename to res/drawable-xlarge-mdpi/ic_no_applications.png
Binary files differ
diff --git a/res/drawable-xlarge/info_button.png b/res/drawable-xlarge-mdpi/info_button.png
similarity index 100%
rename from res/drawable-xlarge/info_button.png
rename to res/drawable-xlarge-mdpi/info_button.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/mini_home_screen_bg.9.png b/res/drawable-xlarge-mdpi/mini_home_screen_bg.9.png
new file mode 100644
index 0000000..4602609
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/mini_home_screen_bg.9.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/mini_home_screen_bg_accepts_drops.9.png b/res/drawable-xlarge-mdpi/mini_home_screen_bg_accepts_drops.9.png
new file mode 100644
index 0000000..b1aa98b
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/mini_home_screen_bg_accepts_drops.9.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/mini_home_screen_bg_hover.9.png b/res/drawable-xlarge-mdpi/mini_home_screen_bg_hover.9.png
new file mode 100644
index 0000000..a30e992
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/mini_home_screen_bg_hover.9.png
Binary files differ
diff --git a/res/drawable-xlarge/rotate_button_normal.png b/res/drawable-xlarge-mdpi/rotate_button_normal.png
similarity index 100%
rename from res/drawable-xlarge/rotate_button_normal.png
rename to res/drawable-xlarge-mdpi/rotate_button_normal.png
Binary files differ
diff --git a/res/drawable-xlarge/rotate_button_pressed.png b/res/drawable-xlarge-mdpi/rotate_button_pressed.png
similarity index 100%
rename from res/drawable-xlarge/rotate_button_pressed.png
rename to res/drawable-xlarge-mdpi/rotate_button_pressed.png
Binary files differ
diff --git a/res/drawable-xlarge/search_button_normal.png b/res/drawable-xlarge-mdpi/search_button_normal.png
similarity index 100%
rename from res/drawable-xlarge/search_button_normal.png
rename to res/drawable-xlarge-mdpi/search_button_normal.png
Binary files differ
diff --git a/res/drawable-xlarge/search_button_pressed.png b/res/drawable-xlarge-mdpi/search_button_pressed.png
similarity index 100%
rename from res/drawable-xlarge/search_button_pressed.png
rename to res/drawable-xlarge-mdpi/search_button_pressed.png
Binary files differ
diff --git a/res/drawable-xlarge/trashcan.png b/res/drawable-xlarge-mdpi/trashcan.png
similarity index 100%
rename from res/drawable-xlarge/trashcan.png
rename to res/drawable-xlarge-mdpi/trashcan.png
Binary files differ
diff --git a/res/drawable-xlarge/trashcan_hover.png b/res/drawable-xlarge-mdpi/trashcan_hover.png
similarity index 100%
rename from res/drawable-xlarge/trashcan_hover.png
rename to res/drawable-xlarge-mdpi/trashcan_hover.png
Binary files differ
diff --git a/res/drawable-xlarge/home_screen_bg.9.png b/res/drawable-xlarge/home_screen_bg.9.png
deleted file mode 100644
index d939d5c..0000000
--- a/res/drawable-xlarge/home_screen_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge/home_screen_bg_hover.9.png b/res/drawable-xlarge/home_screen_bg_hover.9.png
deleted file mode 100644
index c85bcab..0000000
--- a/res/drawable-xlarge/home_screen_bg_hover.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge/mini_home_screen_bg.9.png b/res/drawable-xlarge/mini_home_screen_bg.9.png
deleted file mode 100644
index e5b2d72..0000000
--- a/res/drawable-xlarge/mini_home_screen_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge/mini_home_screen_bg_accepts_drops.9.png b/res/drawable-xlarge/mini_home_screen_bg_accepts_drops.9.png
deleted file mode 100644
index 4bd8637..0000000
--- a/res/drawable-xlarge/mini_home_screen_bg_accepts_drops.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge/mini_home_screen_bg_hover.9.png b/res/drawable-xlarge/mini_home_screen_bg_hover.9.png
deleted file mode 100644
index fb0fb63..0000000
--- a/res/drawable-xlarge/mini_home_screen_bg_hover.9.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-xlarge-land/workspace_screen.xml b/res/layout-xlarge-land/workspace_screen.xml
index 38dab82..64de05e 100644
--- a/res/layout-xlarge-land/workspace_screen.xml
+++ b/res/layout-xlarge-land/workspace_screen.xml
@@ -26,7 +26,7 @@
     launcher:cellHeight="@dimen/workspace_cell_height"
     launcher:widthGap="@dimen/workspace_width_gap"
     launcher:heightGap="@dimen/workspace_height_gap"
-    launcher:yAxisStartPadding="40dip"
-    launcher:yAxisEndPadding="40dip"
+    launcher:yAxisStartPadding="25dip"
+    launcher:yAxisEndPadding="25dip"
     launcher:xAxisStartPadding="40dip"
     launcher:xAxisEndPadding="40dip" />
diff --git a/res/layout-xlarge/all_apps_paged_view_application.xml b/res/layout-xlarge/all_apps_paged_view_application.xml
index f687739..48b5712 100644
--- a/res/layout-xlarge/all_apps_paged_view_application.xml
+++ b/res/layout-xlarge/all_apps_paged_view_application.xml
@@ -22,20 +22,10 @@
     launcher:outlineColor="#FF8CD2FF"
     launcher:checkedBlurColor="#FFBBE83C"
     launcher:checkedOutlineColor="#FF8CD2FF"
-    launcher:scaledIconSize="64dp"
 
     android:id="@+id/application_icon"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:gravity="center_horizontal"
-    android:paddingTop="2dip"
 
-    android:textColor="#FFFFFFFF"
-    android:textSize="13sp"
-    android:shadowColor="#FF000000"
-    android:shadowDx="0.0"
-    android:shadowDy="1.0"
-    android:shadowRadius="1.0"
-
-    android:maxLines="2"
-    android:fadingEdge="horizontal" />
+    style="@style/WorkspaceIcon.Portrait" />
diff --git a/res/values-xlarge-land/dimens.xml b/res/values-xlarge-land/dimens.xml
index f8ebb3f..db31cf1 100644
--- a/res/values-xlarge-land/dimens.xml
+++ b/res/values-xlarge-land/dimens.xml
@@ -21,5 +21,5 @@
 
     <!-- Width/height gap overrides for the workspace -->
     <dimen name="workspace_width_gap">16dp</dimen>
-    <dimen name="workspace_height_gap">0dp</dimen>
+    <dimen name="workspace_height_gap">5dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/res/values-xlarge-port/dimens.xml b/res/values-xlarge-port/dimens.xml
index 3117df9..b60635b 100644
--- a/res/values-xlarge-port/dimens.xml
+++ b/res/values-xlarge-port/dimens.xml
@@ -17,5 +17,5 @@
 <resources>
     <!-- Width/height gap overrides for the workspace -->
     <dimen name="workspace_width_gap">0dp</dimen>
-    <dimen name="workspace_height_gap">16dp</dimen>
+    <dimen name="workspace_height_gap">32dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/res/values-xlarge/dimens.xml b/res/values-xlarge/dimens.xml
index a834a2e..aa602be 100644
--- a/res/values-xlarge/dimens.xml
+++ b/res/values-xlarge/dimens.xml
@@ -24,6 +24,9 @@
 
     <!-- The corner radius to draw the external drop icon rounded rect -->
     <dimen name="external_drop_icon_rect_radius">10dp</dimen>
+    
+    <!-- Temporary scaled icon size -->
+    <dimen name="temp_scaled_icon_size">72dp</dimen>
 
     <!-- extra horizontal spacing between mini screen thumbnails ie. in all
          apps and in customization mode -->
diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml
index 59301b9..bf79b4d 100644
--- a/res/values-xlarge/styles.xml
+++ b/res/values-xlarge/styles.xml
@@ -28,12 +28,12 @@
     </style>
 
     <style name="WorkspaceIcon.Portrait">
-        <item name="android:drawablePadding">4dip</item>
+        <item name="android:drawablePadding">0dip</item>
         <item name="android:paddingTop">1dip</item>
     </style>
 
     <style name="WorkspaceIcon.Landscape">
-        <item name="android:drawablePadding">4dip</item>
+        <item name="android:drawablePadding">0dip</item>
         <item name="android:paddingTop">1dip</item>
     </style>
 </resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 6189f1c..5d6773c 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -72,8 +72,6 @@
         <attr name="checkedBlurColor" format="color" />
         <!-- The checked outline color of the holographic outline -->
         <attr name="checkedOutlineColor" format="color" />
-        <!-- The scaled icon dimension -->
-        <attr name="scaledIconSize" format="dimension" />
     </declare-styleable>
 
     <!-- PagedViewWidgetIcon specific attributes. These attributes are used to
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 3c82290..b7491ba 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -85,6 +85,7 @@
     private OnTouchListener mInterceptTouchListener;
 
     private float mBackgroundAlpha;
+    private float mBackgroundAlphaMultiplier = 1.0f;
 
     private Drawable mBackground;
     private Drawable mBackgroundMini;
@@ -348,7 +349,7 @@
                 bg = mHover ? mBackgroundHover : mBackground;
             }
             if (bg != null) {
-                bg.setAlpha((int) (mBackgroundAlpha * 255));
+                bg.setAlpha((int) (mBackgroundAlpha * mBackgroundAlphaMultiplier * 255));
                 bg.setBounds(mBackgroundRect);
                 bg.draw(canvas);
             }
@@ -864,6 +865,10 @@
         return mBackgroundAlpha;
     }
 
+    public void setBackgroundAlphaMultiplier(float multiplier) {
+        mBackgroundAlphaMultiplier = multiplier;
+    }
+
     public void setBackgroundAlpha(float alpha) {
         mBackgroundAlpha = alpha;
         invalidate();
diff --git a/src/com/android/launcher2/InstallWidgetReceiver.java b/src/com/android/launcher2/InstallWidgetReceiver.java
new file mode 100644
index 0000000..e6a9a69
--- /dev/null
+++ b/src/com/android/launcher2/InstallWidgetReceiver.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher2;
+
+
+/**
+ * We will likely flesh this out later, to handle allow external apps to place widgets, but for now,
+ * we just want to expose the action around for checking elsewhere.
+ */
+public class InstallWidgetReceiver {
+    public static final String ACTION_INSTALL_WIDGET =
+            "com.android.launcher.action.INSTALL_WIDGET";
+
+    // Currently not exposed.  Put into Intent when we want to make it public.
+    // TEMP: Should we call this "EXTRA_APPWIDGET_PROVIDER"?
+    public static final String EXTRA_APPWIDGET_COMPONENT =
+        "com.android.launcher.extra.widget.COMPONENT";
+    public static final String EXTRA_APPWIDGET_CONFIGURATION_DATA =
+        "com.android.launcher.extra.widget.CONFIGURATION_DATA";
+}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 346e472..71978fa 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -992,8 +992,12 @@
     View createShortcut(int layoutResId, ViewGroup parent, ShortcutInfo info) {
         TextView favorite = (TextView) mInflater.inflate(layoutResId, parent, false);
 
+        // Temporarily, we are scaling up all shortcuts on the workspace
+        int scaledSize = parent.getResources().getDimensionPixelSize(R.dimen.temp_scaled_icon_size);
+        Bitmap b = Bitmap.createScaledBitmap(info.getIcon(mIconCache), scaledSize, scaledSize, true);
+
         favorite.setCompoundDrawablesWithIntrinsicBounds(null,
-                new FastBitmapDrawable(info.getIcon(mIconCache)),
+                new FastBitmapDrawable(b),
                 null, null);
         favorite.setText(info.title);
         favorite.setTag(info);
@@ -1079,8 +1083,10 @@
         // For now, we don't save the coordinate where we dropped the icon because we're not
         // supporting spring-loaded mini-screens; however, leaving the ability to directly place
         // a widget on the home screen in case we want to add it in the future
-        final int[] touchXY = null;
-        //final int[] touchXY = mAddDropPosition;
+        int[] touchXY = null;
+        if (mAddDropPosition[0] > -1 && mAddDropPosition[1] > -1) {
+            touchXY = mAddDropPosition;
+        }
         boolean findNearestVacantAreaFailed = false;
         boolean foundCellSpan = false;
         if (touchXY != null) {
@@ -1425,7 +1431,7 @@
         mAddDropPosition = null;
     }
 
-    void addAppWidgetFromDrop(ComponentName appWidgetProvider, int screen, int[] position) {
+    void addAppWidgetFromDrop(PendingAddWidgetInfo info, int screen, int[] position) {
         resetAddInfo();
         mAddScreen = screen;
 
@@ -1433,8 +1439,8 @@
         mAddDropPosition = position;
 
         int appWidgetId = getAppWidgetHost().allocateAppWidgetId();
-        AppWidgetManager.getInstance(this).bindAppWidgetId(appWidgetId, appWidgetProvider);
-        addAppWidgetImpl(appWidgetId);
+        AppWidgetManager.getInstance(this).bindAppWidgetId(appWidgetId, info.componentName);
+        addAppWidgetImpl(appWidgetId, info);
     }
 
     private void manageApps() {
@@ -1446,10 +1452,10 @@
         int appWidgetId = data.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
         // TODO: Is this log message meaningful?
         if (LOGD) Log.d(TAG, "dumping extras content=" + data.getExtras());
-        addAppWidgetImpl(appWidgetId);
+        addAppWidgetImpl(appWidgetId, null);
     }
 
-    void addAppWidgetImpl(int appWidgetId) {
+    void addAppWidgetImpl(int appWidgetId, PendingAddWidgetInfo info) {
         AppWidgetProviderInfo appWidget = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
 
         if (appWidget.configure != null) {
@@ -1457,6 +1463,10 @@
             Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
             intent.setComponent(appWidget.configure);
             intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
+            if (info != null) {
+                intent.putExtra(InstallWidgetReceiver.EXTRA_APPWIDGET_CONFIGURATION_DATA,
+                        info.configurationData);
+            }
 
             startActivityForResultSafely(intent, REQUEST_CREATE_APPWIDGET);
         } else {
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 179a5d5..aa259aa 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -52,16 +52,6 @@
 import android.os.SystemClock;
 import android.util.Log;
 
-import java.lang.ref.WeakReference;
-import java.net.URISyntaxException;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-
 import com.android.launcher.R;
 
 /**
@@ -1527,8 +1517,34 @@
     boolean validateShortcutIntent(Intent data) {
         // We don't require Intent.EXTRA_SHORTCUT_ICON, since we can pull a default fallback icon
         return InstallShortcutReceiver.ACTION_INSTALL_SHORTCUT.equals(data.getAction()) &&
-                (data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT) != null) &&
-                (data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME) != null);
+                (data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME) != null) &&
+                (data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT) != null);
+    }
+
+    /**
+     * Ensures that a given widget intent actually has all the fields that we need to create a
+     * proper widget.
+     */
+    boolean validateWidgetIntent(Intent data) {
+        // We don't require Intent.EXTRA_APPWIDGET_CONFIGURATION_DATA, since that will just be
+        // forwarded onto the widget's configuration activity if it exists
+        return InstallWidgetReceiver.ACTION_INSTALL_WIDGET.equals(data.getAction()) &&
+                (data.getStringExtra(InstallWidgetReceiver.EXTRA_APPWIDGET_COMPONENT) != null);
+    }
+
+    /**
+     * Attempts to find an AppWidgetProviderInfo that matches the given component.
+     */
+    AppWidgetProviderInfo findAppWidgetProviderInfoWithComponent(Context context,
+            ComponentName component) {
+        List<AppWidgetProviderInfo> widgets =
+            AppWidgetManager.getInstance(context).getInstalledProviders();
+        for (AppWidgetProviderInfo info : widgets) {
+            if (info.provider.equals(component)) {
+                return info;
+            }
+        }
+        return null;
     }
 
     ShortcutInfo infoFromShortcutIntent(Context context, Intent data, Bitmap fallbackIcon) {
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index be4999d..c59ef80 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -113,7 +113,9 @@
         mHoloOutlineColor = a.getColor(R.styleable.PagedViewIcon_outlineColor, 0);
         mCheckedBlurColor = a.getColor(R.styleable.PagedViewIcon_checkedBlurColor, 0);
         mCheckedOutlineColor = a.getColor(R.styleable.PagedViewIcon_checkedOutlineColor, 0);
-        mScaledIconSize = a.getDimensionPixelSize(R.styleable.PagedViewIcon_scaledIconSize, 64);
+        mScaledIconSize =
+            context.getResources().getDimensionPixelSize(R.dimen.temp_scaled_icon_size);
+
         a.recycle();
 
         if (sHolographicOutlineHelper == null) {
diff --git a/src/com/android/launcher2/PendingAddItemInfo.java b/src/com/android/launcher2/PendingAddItemInfo.java
index 904f512..b7a76f4 100644
--- a/src/com/android/launcher2/PendingAddItemInfo.java
+++ b/src/com/android/launcher2/PendingAddItemInfo.java
@@ -17,6 +17,7 @@
 package com.android.launcher2;
 
 import android.content.ComponentName;
+import android.os.Parcelable;
 
 /**
  * We pass this object with a drag from the customization tray
@@ -31,4 +32,8 @@
 class PendingAddWidgetInfo extends PendingAddItemInfo {
     int minWidth;
     int minHeight;
+
+    // Any configuration data that we want to pass to a configuration activity when
+    // starting up a widget
+    Parcelable configurationData;
 }
\ No newline at end of file
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 07faed1..e37907c 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -39,7 +39,6 @@
 import android.content.res.TypedArray;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
-import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.Rect;
@@ -78,9 +77,9 @@
 
     // These are extra scale factors to apply to the mini home screens
     // so as to achieve the desired transform
-    private static final float EXTRA_SCALE_FACTOR_0 = 0.97f;
+    private static final float EXTRA_SCALE_FACTOR_0 = 0.972f;
     private static final float EXTRA_SCALE_FACTOR_1 = 1.0f;
-    private static final float EXTRA_SCALE_FACTOR_2 = 1.08f;
+    private static final float EXTRA_SCALE_FACTOR_2 = 1.10f;
 
     private static final int BACKGROUND_FADE_OUT_DELAY = 300;
     private static final int BACKGROUND_FADE_OUT_DURATION = 300;
@@ -145,6 +144,7 @@
     private ShrinkPosition mWaitingToShrinkPosition;
 
     private boolean mInScrollArea = false;
+    private boolean mInDragMode = false;
 
     private final HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper();
     private Bitmap mDragOutline = null;
@@ -213,7 +213,6 @@
                 mIsInUnshrinkAnimation = false;
             }
         };
-
         mSnapVelocity = 600;
     }
 
@@ -305,7 +304,6 @@
                 }
             }
         }
-
         return folders;
     }
 
@@ -525,9 +523,9 @@
     protected void screenScrolled(int screenCenter) {
         final int halfScreenSize = getMeasuredWidth() / 2;
         for (int i = 0; i < getChildCount(); i++) {
-            View v = getChildAt(i);
-            if (v != null) {
-                int totalDistance = v.getMeasuredWidth() + mPageSpacing;
+            CellLayout cl = (CellLayout) getChildAt(i);
+            if (cl != null) {
+                int totalDistance = cl.getMeasuredWidth() + mPageSpacing;
                 int delta = screenCenter - (getChildOffset(i) -
                         getRelativeChildOffset(i) + halfScreenSize);
 
@@ -535,8 +533,11 @@
                 scrollProgress = Math.min(scrollProgress, 1.0f);
                 scrollProgress = Math.max(scrollProgress, -1.0f);
 
+                float mult =  mInDragMode ? 1.0f : Math.abs(scrollProgress);
+                cl.setBackgroundAlphaMultiplier(mult);
+
                 float rotation = WORKSPACE_ROTATION * scrollProgress;
-                v.setRotationY(rotation);
+                cl.setRotationY(rotation);
             }
         }
     }
@@ -713,6 +714,9 @@
         mTouchState = TOUCH_STATE_REST;
         mActivePointerId = INVALID_POINTER;
 
+        CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
+        currentPage.setBackgroundAlphaMultiplier(1.0f);
+
         final Resources res = getResources();
         final int screenWidth = getWidth();
         final int screenHeight = getHeight();
@@ -1172,6 +1176,9 @@
             mDragTargetLayout = getCurrentDropLayout();
             mDragTargetLayout.onDragEnter();
             showOutlines();
+            mInDragMode = true;
+            CellLayout cl = (CellLayout) getChildAt(mCurrentPage);
+            cl.setBackgroundAlphaMultiplier(1.0f);
         }
     }
 
@@ -1273,11 +1280,30 @@
             final int itemCount = data.getItemCount();
             for (int i = 0; i < itemCount; ++i) {
                 final Intent intent = data.getItem(i).getIntent();
-                if (intent != null && model.validateShortcutIntent(intent)) {
-                    ShortcutInfo info = model.infoFromShortcutIntent(mContext, intent, data.
-                            getIcon());
-                    onDropExternal(x, y, info, layout);
-                    newDropCount++;
+                if (intent != null) {
+                    Object info = null;
+                    if (model.validateShortcutIntent(intent)) {
+                        info = model.infoFromShortcutIntent(mContext, intent, data.getIcon());
+                    } else if (model.validateWidgetIntent(intent)) {
+                        final ComponentName component = ComponentName.unflattenFromString(
+                            intent.getStringExtra(InstallWidgetReceiver.EXTRA_APPWIDGET_COMPONENT));
+                        final AppWidgetProviderInfo appInfo =
+                            model.findAppWidgetProviderInfoWithComponent(mContext, component);
+
+                        PendingAddWidgetInfo createInfo = new PendingAddWidgetInfo();
+                        createInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
+                        createInfo.componentName = appInfo.provider;
+                        createInfo.minWidth = appInfo.minWidth;
+                        createInfo.minHeight = appInfo.minHeight;
+                        createInfo.configurationData = intent.getParcelableExtra(
+                                InstallWidgetReceiver.EXTRA_APPWIDGET_CONFIGURATION_DATA);
+                        info = createInfo;
+                    }
+
+                    if (info != null) {
+                        onDropExternal(x, y, info, layout);
+                        newDropCount++;
+                    }
                 }
             }
 
@@ -1523,6 +1549,7 @@
         }
         if (!mIsPageMoving) {
             hideOutlines();
+            mInDragMode = false;
         }
         clearAllHovers();
     }
@@ -1543,7 +1570,7 @@
         ItemInfo info = (ItemInfo) dragInfo;
 
         if (cl.findCellForSpan(mTempEstimate, info.spanX, info.spanY)) {
-            onDropExternal(0, 0, dragInfo, cl, false);
+            onDropExternal(-1, -1, dragInfo, cl, false);
             return true;
         }
         mLauncher.showOutOfSpaceMessage();
@@ -1565,7 +1592,7 @@
             touchXY[1] = y;
             switch (info.itemType) {
                 case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
-                    mLauncher.addAppWidgetFromDrop(info.componentName, screen, touchXY);
+                    mLauncher.addAppWidgetFromDrop((PendingAddWidgetInfo) info, screen, touchXY);
                     break;
                 case LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER:
                     mLauncher.addLiveFolderFromDrop(info.componentName, screen, touchXY);