diff options
author | Patrick Dubroy <dubroy@google.com> | 2011-01-17 15:29:27 -0800 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2011-01-17 16:44:24 -0800 |
commit | 62bbb3c573fe902940431e4b957c0c4918358d36 (patch) | |
tree | 33459eaa907cdcb274a3b729267bd4ffc809f962 /src/com | |
parent | bb1d1319f202ccda89c03c5b9c972d5d91a04995 (diff) | |
download | packages_apps_trebuchet-62bbb3c573fe902940431e4b957c0c4918358d36.zip packages_apps_trebuchet-62bbb3c573fe902940431e4b957c0c4918358d36.tar.gz packages_apps_trebuchet-62bbb3c573fe902940431e4b957c0c4918358d36.tar.bz2 |
Fix 3099036: Drag visualization appears in wrong spot
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/DragView.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java index a8dad7a..433dab8 100644 --- a/src/com/android/launcher2/DragView.java +++ b/src/com/android/launcher2/DragView.java @@ -123,6 +123,14 @@ public class DragView extends View { // The point in our scaled bitmap that the touch events are located mRegistrationX = registrationX; mRegistrationY = registrationY; + + // Force a measure, because Workspace uses getMeasuredHeight() before the layout pass + int ms = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); + measure(ms, ms); + } + + public float getOffsetY() { + return mOffsetY; } public void setDragRegion(int left, int top, int width, int height) { diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 540b373..2e2c441 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -2257,6 +2257,13 @@ public class Workspace extends SmoothPagedView dragView.getDragRegionHeight()); } } + } else if (source == this) { + // When dragging from the workspace, the drag view is slightly bigger than + // the original view, and offset vertically. Adjust to account for this. + final View origView = mDragInfo.cell; + originX += (dragView.getMeasuredWidth() - origView.getWidth()) / 2; + originY += (dragView.getMeasuredHeight() - origView.getHeight()) / 2 + + dragView.getOffsetY(); } if (mDragTargetLayout != null) { |