Fixing drop target padding for the trash bin and all apps.

Change-Id: I65e0af4b52ce26037c77b8120d51226be27efb90
diff --git a/src/com/android/launcher2/ApplicationInfoDropTarget.java b/src/com/android/launcher2/ApplicationInfoDropTarget.java
index 2ee3501..7c81c1a 100644
--- a/src/com/android/launcher2/ApplicationInfoDropTarget.java
+++ b/src/com/android/launcher2/ApplicationInfoDropTarget.java
@@ -26,6 +26,7 @@
 import android.content.Context;
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffColorFilter;
+import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.View;
 
@@ -51,6 +52,12 @@
         // Set the hover paint colour
         int colour = getContext().getResources().getColor(R.color.app_info_filter);
         mHoverPaint.setColorFilter(new PorterDuffColorFilter(colour, PorterDuff.Mode.SRC_ATOP));
+
+        // For the application info drop target, we just ignore the left padding since we don't want
+        // to overlap with the delete zone padding
+        int tb = getResources().getDimensionPixelSize(R.dimen.delete_zone_vertical_drag_padding);
+        int lr = getResources().getDimensionPixelSize(R.dimen.delete_zone_horizontal_drag_padding);
+        setDragPadding(tb, lr, tb, 0);
     }
 
     public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
diff --git a/src/com/android/launcher2/DeleteZone.java b/src/com/android/launcher2/DeleteZone.java
index b044ea8..773bc6b 100644
--- a/src/com/android/launcher2/DeleteZone.java
+++ b/src/com/android/launcher2/DeleteZone.java
@@ -59,15 +59,16 @@
     public DeleteZone(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
 
-        mOuterDragPadding = getResources().getDimensionPixelSize(R.dimen.delete_zone_size);
-        mInnerDragPadding = getResources().getDimensionPixelSize(R.dimen.delete_zone_padding);
-
         final int srcColor = context.getResources().getColor(R.color.delete_color_filter);
         mHoverPaint.setColorFilter(new PorterDuffColorFilter(srcColor, PorterDuff.Mode.SRC_ATOP));
 
         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DeleteZone, defStyle, 0);
         mOrientation = a.getInt(R.styleable.DeleteZone_direction, ORIENTATION_HORIZONTAL);
         a.recycle();
+
+        int tb = getResources().getDimensionPixelSize(R.dimen.delete_zone_vertical_drag_padding);
+        int lr = getResources().getDimensionPixelSize(R.dimen.delete_zone_horizontal_drag_padding);
+        setDragPadding(tb, lr, tb, lr);
     }
 
     @Override
diff --git a/src/com/android/launcher2/IconDropTarget.java b/src/com/android/launcher2/IconDropTarget.java
index 5b375c3..ec08c1e 100644
--- a/src/com/android/launcher2/IconDropTarget.java
+++ b/src/com/android/launcher2/IconDropTarget.java
@@ -16,18 +16,17 @@
 
 package com.android.launcher2;
 
-import android.content.ComponentName;
+import com.android.launcher.R;
+
 import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
 import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
 import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.View;
 import android.widget.ImageView;
 
-import com.android.launcher.R;
-
 /**
  * Implements a DropTarget which allows applications to be dropped on it,
  * in order to launch the application info for that app.
@@ -51,9 +50,8 @@
     /** The paint applied to the drag view on hover */
     protected final Paint mHoverPaint = new Paint();
 
-    /** Drag zone padding */
-    protected int mInnerDragPadding;
-    protected int mOuterDragPadding;
+    /** Drag zone padding [T, R, B, L] */
+    protected final int mDragPadding[] = new int[4];
 
     public IconDropTarget(Context context, AttributeSet attrs) {
         this(context, attrs, 0);
@@ -64,6 +62,13 @@
         mDragAndDropEnabled = true;
     }
 
+    protected void setDragPadding(int t, int r, int b, int l) {
+        mDragPadding[0] = t;
+        mDragPadding[1] = r;
+        mDragPadding[2] = b;
+        mDragPadding[3] = l;
+    }
+
     void setLauncher(Launcher launcher) {
         mLauncher = launcher;
     }
@@ -121,10 +126,10 @@
     public void getHitRect(Rect outRect) {
         super.getHitRect(outRect);
         if (LauncherApplication.isScreenXLarge()) {
-            outRect.top -= mOuterDragPadding;
-            outRect.left -= mInnerDragPadding;
-            outRect.bottom += mOuterDragPadding;
-            outRect.right += mOuterDragPadding;
+            outRect.top -= mDragPadding[0];
+            outRect.right += mDragPadding[1];
+            outRect.bottom += mDragPadding[2];
+            outRect.left -= mDragPadding[3];
         }
     }