Merge "More work to ensure that the wallpaper is visible before transitions take place. (Bug 6445085)" into jb-dev
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index b316665..4be1914 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -462,7 +462,16 @@
float scale = getDescendantCoordRelativeToSelf((View) child.getParent(), coord);
int toX = coord[0];
int toY = coord[1];
- if (child instanceof FolderIcon) {
+ if (child instanceof TextView) {
+ TextView tv = (TextView) child;
+
+ // 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;
+ toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
+ } else if (child instanceof FolderIcon) {
// Account for holographic blur padding on the drag view
toY -= Workspace.DRAG_BITMAP_PADDING / 2;
// Center in the x coordinate about the target's drawable