summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Flynn <flynn@google.com>2012-05-09 13:35:33 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-09 13:35:33 -0700
commit966182f222da8da1fed2ce1f3945fae3d3d488d0 (patch)
tree0a752a906258a30b151e3c7eb107b1e2511fc35e /src
parentf1961269be954960ebe597ad39fc30246c6270fa (diff)
parent4497ebf9a2726e2a7dbb7f3c49389308908f8454 (diff)
downloadandroid_packages_apps_Trebuchet-966182f222da8da1fed2ce1f3945fae3d3d488d0.tar.gz
android_packages_apps_Trebuchet-966182f222da8da1fed2ce1f3945fae3d3d488d0.tar.bz2
android_packages_apps_Trebuchet-966182f222da8da1fed2ce1f3945fae3d3d488d0.zip
Merge "Fix drag layer" into jb-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/DragLayer.java11
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