Merge "Tweaking home transitions" into honeycomb
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 8ed1f46..ef9e3fa 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -24,7 +24,6 @@
 import android.content.res.TypedArray;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
-import android.graphics.Color;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
diff --git a/src/com/android/launcher2/ApplicationInfoDropTarget.java b/src/com/android/launcher2/ApplicationInfoDropTarget.java
index f944022..78a9d2d 100644
--- a/src/com/android/launcher2/ApplicationInfoDropTarget.java
+++ b/src/com/android/launcher2/ApplicationInfoDropTarget.java
@@ -26,7 +26,6 @@
 import android.content.Context;
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffColorFilter;
-import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.View;
 
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 45de630..cf82abb 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -1060,10 +1060,6 @@
         return isVacant;
     }
 
-    private boolean isVacant(int originX, int originY, int spanX, int spanY) {
-        return isVacantIgnoring(originX, originY, spanX, spanY, null);
-    }
-
     public View getChildAt(int x, int y) {
         final int count = getChildCount();
         for (int i = 0; i < count; i++) {
diff --git a/src/com/android/launcher2/DeferredHandler.java b/src/com/android/launcher2/DeferredHandler.java
index 0323c7f..930da56 100644
--- a/src/com/android/launcher2/DeferredHandler.java
+++ b/src/com/android/launcher2/DeferredHandler.java
@@ -31,7 +31,7 @@
  * This class is fifo.
  */
 public class DeferredHandler {
-    private LinkedList<Runnable> mQueue = new LinkedList();
+    private LinkedList<Runnable> mQueue = new LinkedList<Runnable>();
     private MessageQueue mMessageQueue = Looper.myQueue();
     private Impl mHandler = new Impl();
 
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index a8dad7a..433dab8 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -123,6 +123,14 @@
         // The point in our scaled bitmap that the touch events are located
         mRegistrationX = registrationX;
         mRegistrationY = registrationY;
+
+        // Force a measure, because Workspace uses getMeasuredHeight() before the layout pass
+        int ms = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
+        measure(ms, ms);
+    }
+
+    public float getOffsetY() {
+        return mOffsetY;
     }
 
     public void setDragRegion(int left, int top, int width, int height) {
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 86c099e..dd83c78 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.content.res.Resources;
-import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
diff --git a/src/com/android/launcher2/IconCache.java b/src/com/android/launcher2/IconCache.java
index 468645b..2e47adc 100644
--- a/src/com/android/launcher2/IconCache.java
+++ b/src/com/android/launcher2/IconCache.java
@@ -16,8 +16,6 @@
 
 package com.android.launcher2;
 
-import com.android.launcher.R;
-
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.pm.PackageManager;
diff --git a/src/com/android/launcher2/InstallWidgetReceiver.java b/src/com/android/launcher2/InstallWidgetReceiver.java
index 970c6a5..4f6cb8d 100644
--- a/src/com/android/launcher2/InstallWidgetReceiver.java
+++ b/src/com/android/launcher2/InstallWidgetReceiver.java
@@ -184,7 +184,6 @@
 
         @Override
         public void onClick(DialogInterface dialog, int which) {
-            final LauncherModel model = mLauncher.getModel();
             final AppWidgetProviderInfo widgetInfo = mActivities.get(which).widgetInfo;
 
             final PendingAddWidgetInfo createInfo = new PendingAddWidgetInfo(widgetInfo, mMimeType,
diff --git a/src/com/android/launcher2/InterruptibleInOutAnimator.java b/src/com/android/launcher2/InterruptibleInOutAnimator.java
index be2fd04..135fa39 100644
--- a/src/com/android/launcher2/InterruptibleInOutAnimator.java
+++ b/src/com/android/launcher2/InterruptibleInOutAnimator.java
@@ -18,9 +18,7 @@
 
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
 import android.animation.ValueAnimator;
-import android.util.Log;
 
 /**
  * A convenience class for two-way animations, e.g. a fadeIn/fadeOut animation.
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 9b5dac7..d5b218d 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -363,7 +363,6 @@
                         alphaAnim.addListener(new AnimatorListenerAdapter() {
                             @Override
                             public void onAnimationEnd(Animator animation) {
-                                String tag = mHomeCustomizationDrawer.getCurrentTabTag();
                                 mCustomizePagedView.setCustomizationFilter(newType);
 
                                 final float alpha = mCustomizePagedView.getAlpha();
@@ -997,7 +996,6 @@
 
         deleteZone.setLauncher(this);
         deleteZone.setDragController(dragController);
-        int deleteZoneHandleId;
 
         final View allAppsButton = findViewById(R.id.all_apps_button);
         final View divider = findViewById(R.id.divider);
@@ -1074,7 +1072,6 @@
         // reload these every tap; you never know when they might change
         loadHotseats();
         if (index >= 0 && index < mHotseats.length && mHotseats[index] != null) {
-            Intent intent = mHotseats[index];
             startActivitySafely(
                 mHotseats[index],
                 "hotseat"
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index bb59678..1965712 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -17,13 +17,9 @@
 package com.android.launcher2;
 
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.TreeMap;
-import java.util.TreeSet;
 
 import android.content.Context;
 import android.content.res.TypedArray;
-import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Rect;
 import android.os.Parcel;
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index b779a97..70ad997 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -17,14 +17,8 @@
 package com.android.launcher2;
 
 import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
 import android.graphics.Rect;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewDebug;
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 07a59ee..9b83f48 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -33,6 +33,7 @@
 import android.os.Message;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
+import android.view.View;
 import android.widget.Checkable;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -159,8 +160,10 @@
         image.setImageDrawable(preview);
         final TextView name = (TextView) findViewById(R.id.widget_name);
         name.setText(info.label);
+        name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
         final TextView dims = (TextView) findViewById(R.id.widget_dims);
         dims.setText(mContext.getString(R.string.widget_dims_format, cellSpan[0], cellSpan[1]));
+        dims.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
 
         if (createHolographicOutline) {
             mIconCache = cache;
@@ -178,6 +181,7 @@
         image.setImageDrawable(preview);
         TextView name = (TextView) findViewById(R.id.wallpaper_name);
         name.setText(info.loadLabel(packageManager));
+        name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
 
         if (createHolographicOutline) {
             mIconCache = cache;
diff --git a/src/com/android/launcher2/UserFolder.java b/src/com/android/launcher2/UserFolder.java
index d6799f7..b362fbd 100644
--- a/src/com/android/launcher2/UserFolder.java
+++ b/src/com/android/launcher2/UserFolder.java
@@ -1,7 +1,6 @@
 package com.android.launcher2;
 
 import android.content.Context;
-import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index 03a2a52..60f71f5 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -54,12 +54,10 @@
     private static int sIconTextureWidth = -1;
     private static int sIconTextureHeight = -1;
 
-    private static final Paint sPaint = new Paint();
     private static final Paint sBlurPaint = new Paint();
     private static final Paint sGlowColorPressedPaint = new Paint();
     private static final Paint sGlowColorFocusedPaint = new Paint();
     private static final Paint sDisabledPaint = new Paint();
-    private static final Rect sBounds = new Rect();
     private static final Rect sOldBounds = new Rect();
     private static final Canvas sCanvas = new Canvas();
 
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index ef99406..8f9c67e 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -2264,6 +2264,13 @@
                                     dragView.getDragRegionHeight());
                         }
                     }
+                } else if (source == this) {
+                    // When dragging from the workspace, the drag view is slightly bigger than
+                    // the original view, and offset vertically. Adjust to account for this.
+                    final View origView = mDragInfo.cell;
+                    originX += (dragView.getMeasuredWidth() - origView.getWidth()) / 2;
+                    originY += (dragView.getMeasuredHeight() - origView.getHeight()) / 2
+                            + dragView.getOffsetY();
                 }
 
                 if (mDragTargetLayout != null) {