Adding fling-to-delete.

- Also fixing issue where the drop target icon changes color slower than the text.

Change-Id: I0bfa59da5d202016342f1c3de419ebcafd81ff6f
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index 3090e8f..5636f99 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -51,6 +51,7 @@
     ValueAnimator mAnim;
     private float mOffsetX = 0.0f;
     private float mOffsetY = 0.0f;
+    private float mInitialScale = 1f;
 
     /**
      * Construct the drag view.
@@ -67,6 +68,7 @@
             int left, int top, int width, int height, final float initialScale) {
         super(launcher);
         mDragLayer = launcher.getDragLayer();
+        mInitialScale = initialScale;
 
         final Resources res = getResources();
         final float offsetX = res.getDimensionPixelSize(R.dimen.dragViewOffsetX);
@@ -151,6 +153,14 @@
         return mDragRegion;
     }
 
+    public float getInitialScale() {
+        return mInitialScale;
+    }
+
+    public void updateInitialScaleToCurrentScale() {
+        mInitialScale = getScaleX();
+    }
+
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         setMeasuredDimension(mBitmap.getWidth(), mBitmap.getHeight());
@@ -233,6 +243,11 @@
      */
     public void show(int touchX, int touchY) {
         mDragLayer.addView(this);
+
+        // Enable hw-layers on this view
+        setLayerType(View.LAYER_TYPE_HARDWARE, null);
+
+        // Start the pick-up animation
         DragLayer.LayoutParams lp = new DragLayer.LayoutParams(0, 0);
         lp.width = mBitmap.getWidth();
         lp.height = mBitmap.getHeight();
@@ -267,6 +282,9 @@
 
     void remove() {
         if (getParent() != null) {
+            // Disable hw-layers on this view
+            setLayerType(View.LAYER_TYPE_NONE, null);
+
             mDragLayer.removeView(DragView.this);
         }
     }