summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/DragView.java
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2010-09-17 15:00:07 -0700
committerMichael Jurka <mikejurka@google.com>2010-09-24 15:28:20 -0700
commit0280c3be4d9f8fc6fdf015b7ecd276eb26f76f2d (patch)
treeffebcc83e7c161dac612463d15882f9b83e6f591 /src/com/android/launcher2/DragView.java
parent513b8c94fb1dc3af246fcc8a7f8c0dd593d86cbd (diff)
downloadandroid_packages_apps_Trebuchet-0280c3be4d9f8fc6fdf015b7ecd276eb26f76f2d.tar.gz
android_packages_apps_Trebuchet-0280c3be4d9f8fc6fdf015b7ecd276eb26f76f2d.tar.bz2
android_packages_apps_Trebuchet-0280c3be4d9f8fc6fdf015b7ecd276eb26f76f2d.zip
Adding support for drag and drop of folders and shortcuts.
also: - Long press on empty space on workspace now brings up customization tray - Fixed: while dragging, items appeared to be dropping on folders two cells to the right - Fixed: Disabling drops on folders when the workspace is shrunken - Fixed: account for scaling of dragged items when checking if they overlap with shrunken workspace screens - Making folder icons dimmable to match shortcuts and widgets - When deciding with shrunken workspace screen we're dragging to, we now use the closest screen rather than the one that has been overlapped the most - Refactored drag/add mechanism, removing array of occupied cells from CellInfo - Removed dead code/variables
Diffstat (limited to 'src/com/android/launcher2/DragView.java')
-rw-r--r--src/com/android/launcher2/DragView.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index 41e76f0e1..d14f5f756 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -76,8 +76,7 @@ public class DragView extends View implements TweenCallback {
scale.setScale(scaleFactor, scaleFactor);
mBitmap = Bitmap.createBitmap(bitmap, left, top, width, height, scale, true);
- mDragRegionWidth = width;
- mDragRegionHeight = height;
+ setDragRegion(0, 0, width, height);
// The point in our scaled bitmap that the touch events are located
mRegistrationX = registrationX + (DRAG_SCALE / 2);
@@ -91,6 +90,22 @@ public class DragView extends View implements TweenCallback {
mDragRegionHeight = height;
}
+ public int getScaledDragRegionXOffset() {
+ return -(int)((mScale - 1.0f) * mDragRegionWidth / 2);
+ }
+
+ public int getScaledDragRegionWidth() {
+ return (int)(mScale * mDragRegionWidth);
+ }
+
+ public int getScaledDragRegionYOffset() {
+ return -(int)((mScale - 1.0f) * mDragRegionHeight / 2);
+ }
+
+ public int getScaledDragRegionHeight() {
+ return (int)(mScale * mDragRegionWidth);
+ }
+
public int getDragRegionLeft() {
return mDragRegionLeft;
}