updated Workspace thumbnail behavior

- in All Apps mode, fade thumbnails completely
- while dragging, have thumbnails re-appear
- while dragging, give screen thumbnails that can accept drops a different appearance (green outline instead of blue)

Change-Id: I72ddf8a0f1947d35ef11514b7d4eea9ae5eee6e2
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 369f0d2..d4a12fb 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -78,6 +78,8 @@
     private Drawable mBackgroundMini;
     private Drawable mBackgroundMiniHover;
     private Drawable mBackgroundHover;
+    private Drawable mBackgroundMiniAcceptsDrops;
+    private boolean mAcceptsDrops;
 
     // If we're actively dragging something over this screen, mHover is true
     private boolean mHover = false;
@@ -155,6 +157,9 @@
             mBackgroundMiniHover.setFilterBitmap(true);
             mBackgroundHover = res.getDrawable(R.drawable.home_screen_bg_hover);
             mBackgroundHover.setFilterBitmap(true);
+            mBackgroundMiniAcceptsDrops = res.getDrawable(
+                    R.drawable.mini_home_screen_bg_accepts_drops);
+            mBackgroundMiniAcceptsDrops.setFilterBitmap(true);
         }
 
         // Initialize the data structures used for the drag visualization.
@@ -202,9 +207,9 @@
 
     public void setHover(boolean value) {
         if (mHover != value) {
+            mHover = value;
             invalidate();
         }
-        mHover = value;
     }
 
     public void drawChildren(Canvas canvas) {
@@ -213,10 +218,15 @@
 
     @Override
     protected void onDraw(Canvas canvas) {
+        // When we're large, we are either drawn in a "hover" state (ie when dragging an item to
+        // a neighboring page) or with just a normal background (if backgroundAlpha > 0.0f)
+        // When we're small, we are either drawn normally or in the "accepts drops" state (during
+        // a drag). However, we also drag the mini hover background *over* one of those two
+        // backgrounds
         if (mBackgroundAlpha > 0.0f) {
             Drawable bg;
             if (getScaleX() < 0.5f) {
-                bg = mHover ? mBackgroundMiniHover : mBackgroundMini;
+                bg = mAcceptsDrops ? mBackgroundMiniAcceptsDrops : mBackgroundMini;
             } else {
                 bg = mHover ? mBackgroundHover : mBackground;
             }
@@ -224,6 +234,10 @@
                 bg.setAlpha((int) (mBackgroundAlpha * 255));
                 bg.draw(canvas);
             }
+            if (mHover && getScaleX() < 0.5f) {
+                mBackgroundMiniHover.setAlpha((int) (mBackgroundAlpha * 255));
+                mBackgroundMiniHover.draw(canvas);
+            }
         }
 
         if (mCrosshairsVisibility > 0.0f) {
@@ -330,6 +344,16 @@
         }
         return false;
     }
+    public void setAcceptsDrops(boolean acceptsDrops) {
+        if (mAcceptsDrops != acceptsDrops) {
+            mAcceptsDrops = acceptsDrops;
+            invalidate();
+        }
+    }
+
+    public boolean getAcceptsDrops() {
+        return mAcceptsDrops;
+    }
 
     @Override
     public void removeAllViews() {
@@ -643,6 +667,9 @@
         if (mBackgroundMini != null) {
             mBackgroundMini.setBounds(0, 0, w, h);
         }
+        if (mBackgroundMiniAcceptsDrops != null) {
+            mBackgroundMiniAcceptsDrops.setBounds(0, 0, w, h);
+        }
     }
 
     @Override