Fixing a couple bugs, allapps clicks and weird crash

-> issue 5021897 (when this was fixed, exposed more bugginess that is now fixed)
-> issue 5038392

Change-Id: I49a4e9fca154f75ea22ad2c462641747536102ce
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index 1c75e47..386cb55 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -41,6 +41,7 @@
 
     private Rect mDragRegion = null;
     private DragLayer mDragLayer = null;
+    private boolean mHasDrawn = false;
 
     ValueAnimator mAnim;
     private float mOffsetX = 0.0f;
@@ -49,13 +50,6 @@
     private DragLayer.LayoutParams mLayoutParams;
 
     /**
-     * A callback to be called the first time this view is drawn.
-     * This allows the originator of the drag to dim or hide the original view as soon
-     * as the DragView is drawn.
-     */
-    private Runnable mOnDrawRunnable = null;
-
-    /**
      * Construct the drag view.
      * <p>
      * The registration point is the point inside our view that the touch events should
@@ -125,10 +119,6 @@
         return mOffsetY;
     }
 
-    public void setOnDrawRunnable(Runnable r) {
-        mOnDrawRunnable = r;
-    }
-
     public int getDragRegionLeft() {
         return mDragRegion.left;
     }
@@ -168,14 +158,7 @@
             canvas.drawRect(0, 0, getWidth(), getHeight(), p);
         }
 
-        // Call the callback if we haven't already been detached
-        if (getParent() != null) {
-            if (mOnDrawRunnable != null) {
-                mOnDrawRunnable.run();
-                mOnDrawRunnable = null;
-            }
-        }
-
+        mHasDrawn = true;
         canvas.drawBitmap(mBitmap, 0.0f, 0.0f, mPaint);
     }
 
@@ -184,6 +167,10 @@
         invalidate();
     }
 
+    public boolean hasDrawn() {
+        return mHasDrawn;
+    }
+
     @Override
     public void setAlpha(float alpha) {
         super.setAlpha(alpha);