summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2011-01-17 16:57:49 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-17 16:57:49 -0800
commit1d8ad0dd3b295b35e7fc9944eb298150b4fa4a99 (patch)
tree78aca106d272e58fd2c4ea8cc744d2144534202c
parent8bc22687b4418b8a3982dc18553e0375287e6217 (diff)
parent62bbb3c573fe902940431e4b957c0c4918358d36 (diff)
downloadandroid_packages_apps_Trebuchet-1d8ad0dd3b295b35e7fc9944eb298150b4fa4a99.tar.gz
android_packages_apps_Trebuchet-1d8ad0dd3b295b35e7fc9944eb298150b4fa4a99.tar.bz2
android_packages_apps_Trebuchet-1d8ad0dd3b295b35e7fc9944eb298150b4fa4a99.zip
Merge "Fix 3099036: Drag visualization appears in wrong spot" into honeycomb
-rw-r--r--src/com/android/launcher2/DragView.java8
-rw-r--r--src/com/android/launcher2/Workspace.java7
2 files changed, 15 insertions, 0 deletions
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index a8dad7a48..433dab8c6 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 7ed19b991..a25db39a3 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -2259,6 +2259,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) {