diff options
author | Andrew Flynn <flynn@google.com> | 2012-05-09 11:28:00 -0700 |
---|---|---|
committer | Andrew Flynn <flynn@google.com> | 2012-05-09 11:28:00 -0700 |
commit | 4497ebf9a2726e2a7dbb7f3c49389308908f8454 (patch) | |
tree | b4264c1332e32be8273873f80b234d640965c201 /src/com/android | |
parent | de0fb8fbf11caac382589ab464b50d528942273a (diff) | |
download | android_packages_apps_Trebuchet-4497ebf9a2726e2a7dbb7f3c49389308908f8454.tar.gz android_packages_apps_Trebuchet-4497ebf9a2726e2a7dbb7f3c49389308908f8454.tar.bz2 android_packages_apps_Trebuchet-4497ebf9a2726e2a7dbb7f3c49389308908f8454.zip |
Fix drag layer
Change-Id: Iac2f53cdd765df9097a5a5a75b37cdacb03fb633
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/launcher2/DragLayer.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java index b31666571..4be1914e0 100644 --- a/src/com/android/launcher2/DragLayer.java +++ b/src/com/android/launcher2/DragLayer.java @@ -462,7 +462,16 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang 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 |