summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DragLayer.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-11-13 15:47:05 -0800
committerWinson Chung <winsonc@google.com>2013-11-14 11:18:18 -0800
commiteeb5bbc9409978cc2ae52d48380399fcde3d9f85 (patch)
tree6a71c11e8ede1172e4013a49a5807897b28de241 /src/com/android/launcher3/DragLayer.java
parente248b83797e6b6ce128085560ad0c5b900413bf2 (diff)
downloadandroid_packages_apps_Trebuchet-eeb5bbc9409978cc2ae52d48380399fcde3d9f85.tar.gz
android_packages_apps_Trebuchet-eeb5bbc9409978cc2ae52d48380399fcde3d9f85.tar.bz2
android_packages_apps_Trebuchet-eeb5bbc9409978cc2ae52d48380399fcde3d9f85.zip
Use the icon bounds for all calculations.
- Fixes a drag and drop issue when the dynamic grid scales icons down, due to the drawable bounds not being equal to their bitmap sizes. Change-Id: If7c68b51131de7bac3195a2619e22340f7789432
Diffstat (limited to 'src/com/android/launcher3/DragLayer.java')
-rw-r--r--src/com/android/launcher3/DragLayer.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 159d7d992..dc0ba903f 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -522,14 +522,18 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
scale *= childScale;
int toX = coord[0];
int toY = coord[1];
+ float toScale = scale;
if (child instanceof TextView) {
TextView tv = (TextView) child;
+ // Account for the source scale of the icon (ie. from AllApps to Workspace, in which
+ // the workspace may have smaller icon bounds).
+ toScale = scale / dragView.getIntrinsicIconScaleFactor();
// The child may be scaled (always about the center of the view) so to account for it,
// we have to offset the position by the scaled size. Once we do that, we can center
// the drag view about the scaled child view.
- toY += Math.round(scale * tv.getPaddingTop());
- toY -= dragView.getMeasuredHeight() * (1 - scale) / 2;
+ toY += Math.round(toScale * tv.getPaddingTop());
+ toY -= dragView.getMeasuredHeight() * (1 - toScale) / 2;
toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
} else if (child instanceof FolderIcon) {
// Account for holographic blur padding on the drag view
@@ -555,7 +559,7 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
}
}
};
- animateViewIntoPosition(dragView, fromX, fromY, toX, toY, 1, 1, 1, scale, scale,
+ animateViewIntoPosition(dragView, fromX, fromY, toX, toY, 1, 1, 1, toScale, toScale,
onCompleteRunnable, ANIMATION_END_DISAPPEAR, duration, anchorView);
}