summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/AllAppsPagedView.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-04-15 12:07:39 -0700
committerAdam Cohen <adamcohen@google.com>2011-04-15 13:29:26 -0700
commite3e27a854f3eca363d3c5ce353d19de475272d87 (patch)
tree5a627c3aa3869bd2c97e7945b0b19be9966b6fb3 /src/com/android/launcher2/AllAppsPagedView.java
parentdf0353815c629fc678824b07a234b89a1ff94208 (diff)
downloadandroid_packages_apps_Trebuchet-e3e27a854f3eca363d3c5ce353d19de475272d87.tar.gz
android_packages_apps_Trebuchet-e3e27a854f3eca363d3c5ce353d19de475272d87.tar.bz2
android_packages_apps_Trebuchet-e3e27a854f3eca363d3c5ce353d19de475272d87.zip
Cleaning up drag and drop visulization and drop location determination
-Visualization and drop location always match now -Improved the location determination/visualization for widgets in spring loaded mode -Simplified and fixed some other discrepencies Change-Id: I4b46f415a547e4df778c70a8b87f341a909d10c1
Diffstat (limited to 'src/com/android/launcher2/AllAppsPagedView.java')
-rw-r--r--src/com/android/launcher2/AllAppsPagedView.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 3924c5752..1f38d8d6e 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -24,6 +24,7 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -285,6 +286,16 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
c.translate((v.getWidth() - icon.getIntrinsicWidth()) / 2, v.getPaddingTop());
icon.draw(c);
+ Rect dragRect = null;
+ if (v instanceof TextView) {
+ int iconSize = getResources().getDimensionPixelSize(R.dimen.app_icon_size);
+ int top = v.getPaddingTop();
+ int left = (b.getWidth() - iconSize) / 2;
+ int right = left + iconSize;
+ int bottom = top + iconSize;
+ dragRect = new Rect(left, top, right, bottom);
+ }
+
// We toggle the checked state _after_ we create the view for the drag in case toggling the
// checked state changes the view's look
if (v instanceof Checkable) {
@@ -304,7 +315,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
// Start the drag
mLauncher.lockScreenOrientation();
mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b);
- mDragController.startDrag(v, b, this, app, DragController.DRAG_ACTION_COPY, null);
+ mDragController.startDrag(v, b, this, app, DragController.DRAG_ACTION_COPY, dragRect);
b.recycle();
return true;
}