From 8878a32f26b7e6c287d970950526cd0e6eabb21d Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Mon, 28 Mar 2011 13:18:42 -0700 Subject: [PATCH] Fixing drag icon location on non-xlarge devices Change-Id: I7897f67e145818866a51c6a50d4d3e59674b08b4 --- res/values-xlarge/config.xml | 5 ----- res/values-xlarge/dimens.xml | 5 +++++ res/values/config.xml | 6 ------ res/values/dimens.xml | 5 +++++ src/com/android/launcher2/DragView.java | 4 ++-- src/com/android/launcher2/Workspace.java | 4 ++-- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml index 56c7bc688..b9880e3ea 100644 --- a/res/values-xlarge/config.xml +++ b/res/values-xlarge/config.xml @@ -53,11 +53,6 @@ Should be an even number, for pixel alignment. --> 0 - - 0 - -12 - diff --git a/res/values-xlarge/dimens.xml b/res/values-xlarge/dimens.xml index 2b9769716..fffa0f231 100644 --- a/res/values-xlarge/dimens.xml +++ b/res/values-xlarge/dimens.xml @@ -62,4 +62,9 @@ 0dp + + + 0dp + -12dp diff --git a/res/values/config.xml b/res/values/config.xml index c56a8cec2..ec01fa840 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -12,12 +12,6 @@ Should be an even number, for pixel alignment. --> 40 - - 20 - 20 - 900 diff --git a/res/values/dimens.xml b/res/values/dimens.xml index d6cd3eeb0..e346c6a0e 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -44,4 +44,9 @@ 20dp + + + 0dp + -8dp diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java index 45620b90b..ab997446d 100644 --- a/src/com/android/launcher2/DragView.java +++ b/src/com/android/launcher2/DragView.java @@ -87,8 +87,8 @@ public class DragView extends View { scale.setScale(scaleFactor, scaleFactor); } - final int offsetX = res.getInteger(R.integer.config_dragViewOffsetX); - final int offsetY = res.getInteger(R.integer.config_dragViewOffsetY); + final int offsetX = res.getDimensionPixelSize(R.dimen.dragViewOffsetX); + final int offsetY = res.getDimensionPixelSize(R.dimen.dragViewOffsetY); // Animate the view into the correct position mAnim = ValueAnimator.ofFloat(0.0f, 1.0f); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 92be5dc77..15c164ad7 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -2175,8 +2175,8 @@ public class Workspace extends SmoothPagedView // Based on the position of the drag view, find the top left of the original view int viewX = dragViewX + (dragView.getWidth() - child.getWidth()) / 2; int viewY = dragViewY + (dragView.getHeight() - child.getHeight()) / 2; - viewX += getResources().getInteger(R.integer.config_dragViewOffsetX); - viewY += getResources().getInteger(R.integer.config_dragViewOffsetY); + viewX += getResources().getDimensionPixelSize(R.dimen.dragViewOffsetX); + viewY += getResources().getDimensionPixelSize(R.dimen.dragViewOffsetY); // Set its old pos (in the new parent's coordinates); it will be animated // in animateViewIntoPosition after the next layout pass -- 2.11.0