summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/DragController.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/DragController.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/DragController.java')
-rw-r--r--src/com/android/launcher2/DragController.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index cb4509b21..5ca1e1c5d 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -73,10 +73,10 @@ public class DragController {
private boolean mDragging;
/** X coordinate of the down event. */
- private float mMotionDownX;
+ private int mMotionDownX;
/** Y coordinate of the down event. */
- private float mMotionDownY;
+ private int mMotionDownY;
/** Info about the screen for clamping. */
private DisplayMetrics mDisplayMetrics = new DisplayMetrics();
@@ -85,10 +85,10 @@ public class DragController {
private View mOriginator;
/** X offset from the upper-left corner of the cell to where we touched. */
- private float mTouchOffsetX;
+ private int mTouchOffsetX;
/** Y offset from the upper-left corner of the cell to where we touched. */
- private float mTouchOffsetY;
+ private int mTouchOffsetY;
/** the area at the edge of the screen that makes the workspace go left
* or right while you're dragging.
@@ -289,13 +289,14 @@ public class DragController {
listener.onDragStart(source, dragInfo, dragAction);
}
- int registrationX = ((int)mMotionDownX) - screenX;
- int registrationY = ((int)mMotionDownY) - screenY;
+ final int registrationX = ((int)mMotionDownX) - screenX;
+ final int registrationY = ((int)mMotionDownY) - screenY;
final int dragRegionLeft = dragRegion == null ? 0 : dragRegion.left;
final int dragRegionTop = dragRegion == null ? 0 : dragRegion.top;
- mTouchOffsetX = mMotionDownX - screenX - dragRegionLeft;
- mTouchOffsetY = mMotionDownY - screenY - dragRegionTop;
+
+ mTouchOffsetX = mMotionDownX - (screenX + dragRegionLeft);
+ mTouchOffsetY = mMotionDownY - (screenY + dragRegionTop);
mDragging = true;
mDragSource = source;
@@ -314,8 +315,7 @@ public class DragController {
});
if (dragRegion != null) {
- dragView.setDragRegion(dragRegionLeft, dragRegion.top,
- dragRegion.right - dragRegionLeft, dragRegion.bottom - dragRegionTop);
+ dragView.setDragRegion(new Rect(dragRegion));
}
dragView.show(mWindowToken, (int)mMotionDownX, (int)mMotionDownY);