Merge "Fixing issue where drag icons/holographic bg included the text labels." into honeycomb
diff --git a/res/drawable-xlarge-nodpi/glowy_hex.jpg b/res/drawable-xlarge-nodpi/glowy_hex.jpg
index 8729fe1..7d7cdbb 100644
--- a/res/drawable-xlarge-nodpi/glowy_hex.jpg
+++ b/res/drawable-xlarge-nodpi/glowy_hex.jpg
Binary files differ
diff --git a/res/drawable-xlarge-nodpi/glowy_hex_small.jpg b/res/drawable-xlarge-nodpi/glowy_hex_small.jpg
index 6ac58bd..bde365d 100644
--- a/res/drawable-xlarge-nodpi/glowy_hex_small.jpg
+++ b/res/drawable-xlarge-nodpi/glowy_hex_small.jpg
Binary files differ
diff --git a/src/com/android/launcher2/CellLayoutChildren.java b/src/com/android/launcher2/CellLayoutChildren.java
index 76a6900..0d0a339 100644
--- a/src/com/android/launcher2/CellLayoutChildren.java
+++ b/src/com/android/launcher2/CellLayoutChildren.java
@@ -45,6 +45,9 @@
         super(context);
         mWallpaperManager = WallpaperManager.getInstance(context);
         setLayerType(LAYER_TYPE_HARDWARE, null);
+
+        // Disable multitouch for the workspace
+        setMotionEventSplittingEnabled(false);
     }
 
     public void setCellDimensions(int cellWidth, int cellHeight,
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index b418a79..a9dd7e3 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -40,6 +40,9 @@
      */
     public DragLayer(Context context, AttributeSet attrs) {
         super(context, attrs);
+
+        // Disable multitouch across the workspace/all apps/customize tray
+        setMotionEventSplittingEnabled(false);
     }
 
     public void setDragController(DragController controller) {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 2c9ab1f..c9f2f6c 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -568,33 +568,35 @@
 
     @Override
     protected void determineScrollingStart(MotionEvent ev) {
-        float deltaX = Math.abs(ev.getX() - mXDown);
-        float deltaY = Math.abs(ev.getY() - mYDown);
+        if (!mIsSmall && !mIsInUnshrinkAnimation) {
+            float deltaX = Math.abs(ev.getX() - mXDown);
+            float deltaY = Math.abs(ev.getY() - mYDown);
 
-        if (Float.compare(deltaX, 0f) == 0) return;
+            if (Float.compare(deltaX, 0f) == 0) return;
 
-        float slope = deltaY / deltaX;
-        float theta = (float) Math.atan(slope);
+            float slope = deltaY / deltaX;
+            float theta = (float) Math.atan(slope);
 
-        if (deltaX > mTouchSlop || deltaY > mTouchSlop) {
-            cancelCurrentPageLongPress();
-        }
+            if (deltaX > mTouchSlop || deltaY > mTouchSlop) {
+                cancelCurrentPageLongPress();
+            }
 
-        if (theta > MAX_SWIPE_ANGLE) {
-            // Above MAX_SWIPE_ANGLE, we don't want to ever start scrolling the workspace
-            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 results
-            // in vertically scrolling widgets to more easily. The higher the angle, the
-            // more we increase touch slop.
-            theta -= START_DAMPING_TOUCH_SLOP_ANGLE;
-            float extraRatio = (float)
-                    Math.sqrt((theta / (MAX_SWIPE_ANGLE - START_DAMPING_TOUCH_SLOP_ANGLE)));
-            super.determineScrollingStart(ev, 1 + TOUCH_SLOP_DAMPING_FACTOR * extraRatio);
-        } else {
-            // Below START_DAMPING_TOUCH_SLOP_ANGLE, we don't do anything special
-            super.determineScrollingStart(ev);
+            if (theta > MAX_SWIPE_ANGLE) {
+                // Above MAX_SWIPE_ANGLE, we don't want to ever start scrolling the workspace
+                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 
+                // results in vertically scrolling widgets to more easily. The higher the angle, the
+                // more we increase touch slop.
+                theta -= START_DAMPING_TOUCH_SLOP_ANGLE;
+                float extraRatio = (float)
+                        Math.sqrt((theta / (MAX_SWIPE_ANGLE - START_DAMPING_TOUCH_SLOP_ANGLE)));
+                super.determineScrollingStart(ev, 1 + TOUCH_SLOP_DAMPING_FACTOR * extraRatio);
+            } else {
+                // Below START_DAMPING_TOUCH_SLOP_ANGLE, we don't do anything special
+                super.determineScrollingStart(ev);
+            }
         }
     }
 
@@ -1433,7 +1435,7 @@
 
             oldAlphas[i] = cl.getAlpha();
             newAlphas[i] = finalAlpha;
-            if (animated && !(oldAlphas[i] == 0f && newAlphas[i] == 0f)) {
+            if (animated) {
                 oldXs[i] = cl.getX();
                 oldYs[i] = cl.getY();
                 oldScaleXs[i] = cl.getScaleX();
@@ -1454,7 +1456,7 @@
                 cl.setBackgroundAlpha(finalAlpha);
                 cl.setAlpha(finalAlpha);
                 cl.setRotationY(rotation);
-                if (!animated) mShrinkAnimationListener.onAnimationEnd(null);
+                mShrinkAnimationListener.onAnimationEnd(null);
             }
             // increment newX for the next screen
             x += scaledPageWidth + extraScaledSpacing;
@@ -1512,7 +1514,6 @@
                     setVerticalWallpaperOffset(
                             a * oldVerticalWallpaperOffset + b * newVerticalWallpaperOffset);
                     for (int i = 0; i < screenCount; i++) {
-                        if (oldAlphas[i] == 0f && newAlphas[i] == 0f) continue;
                         final CellLayout cl = (CellLayout) getChildAt(i);
                         cl.fastInvalidate();
                         cl.setFastX(a * oldXs[i] + b * newXs[i]);
@@ -1622,6 +1623,9 @@
                 case BOTTOM_HIDDEN:
                 case BOTTOM_VISIBLE:
                 case SPRING_LOADED:
+                    if (state != ShrinkState.TOP) {
+                        cl.setIsDefaultDropTarget(false);
+                    }
                     if (!isDragHappening) {
                         // even if a drag isn't happening, we don't want to show a screen as
                         // accepting drops if it doesn't have at least one free cell
@@ -1763,7 +1767,7 @@
 
                 oldAlphas[i] = cl.getAlpha();
                 newAlphas[i] = finalAlphaValue;
-                if (animated && !(oldAlphas[i] == 0f && newAlphas[i] == 0f)) {
+                if (animated) {
                     oldTranslationXs[i] = cl.getTranslationX();
                     oldTranslationYs[i] = cl.getTranslationY();
                     oldScaleXs[i] = cl.getScaleX();
@@ -1788,7 +1792,7 @@
                     cl.setBackgroundAlphaMultiplier(finalAlphaMultiplierValue);
                     cl.setAlpha(finalAlphaValue);
                     cl.setRotationY(rotation);
-                    if (!animated) mUnshrinkAnimationListener.onAnimationEnd(null);
+                    mUnshrinkAnimationListener.onAnimationEnd(null);
                 }
             }
             Display display = mLauncher.getWindowManager().getDefaultDisplay();
@@ -1840,7 +1844,6 @@
                         setVerticalWallpaperOffset(
                                 a * oldVerticalWallpaperOffset + b * newVerticalWallpaperOffset);
                         for (int i = 0; i < screenCount; i++) {
-                            if (oldAlphas[i] == 0f && newAlphas[i] == 0f) continue;
                             final CellLayout cl = (CellLayout) getChildAt(i);
                             cl.fastInvalidate();
                             cl.setFastTranslationX(
@@ -1867,7 +1870,6 @@
                         final float b = (Float) animation.getAnimatedValue();
                         final float a = 1f - b;
                         for (int i = 0; i < screenCount; i++) {
-                            if (oldAlphas[i] == 0f && newAlphas[i] == 0f) continue;
                             final CellLayout cl = (CellLayout) getChildAt(i);
                             cl.setFastRotationY(a * oldRotationYs[i] + b * newRotationYs[i]);
                         }
@@ -2180,11 +2182,13 @@
             originY = (int)mTempOriginXY[1];
         }
 
-        // When you drag to a particular screen, make that the new current/default screen, so any
-        // subsequent taps add items to that screen
-        int dragTargetIndex = indexOfChild(mDragTargetLayout);
-        if (mCurrentPage != dragTargetIndex && (mIsSmall || mIsInUnshrinkAnimation)) {
-            scrollToNewPageWithoutMovingPages(dragTargetIndex);
+        // When you are in customization mode and drag to a particular screen, make that the
+        // new current/default screen, so any subsequent taps add items to that screen
+        if (!mLauncher.isAllAppsVisible()) {
+            int dragTargetIndex = indexOfChild(mDragTargetLayout);
+            if (mCurrentPage != dragTargetIndex && (mIsSmall || mIsInUnshrinkAnimation)) {
+                scrollToNewPageWithoutMovingPages(dragTargetIndex);
+            }
         }
 
         if (source != this) {