diff options
author | Patrick Dubroy <dubroy@google.com> | 2010-09-27 11:15:43 -0700 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2010-09-29 11:14:28 -0700 |
commit | de7658b5e02ae10010e44fcf8d9c5814f54d9eb0 (patch) | |
tree | 211fe8fc0219dbf99f883138fd2df57d06a5aab7 /src/com/android/launcher2/DragView.java | |
parent | 5c1f9f1de66cef31ba646b7e9ec7ae5634ca3691 (diff) | |
download | android_packages_apps_Trebuchet-de7658b5e02ae10010e44fcf8d9c5814f54d9eb0.tar.gz android_packages_apps_Trebuchet-de7658b5e02ae10010e44fcf8d9c5814f54d9eb0.tar.bz2 android_packages_apps_Trebuchet-de7658b5e02ae10010e44fcf8d9c5814f54d9eb0.zip |
Show crosshairs when dragging items around the workspace.
Diffstat (limited to 'src/com/android/launcher2/DragView.java')
-rw-r--r-- | src/com/android/launcher2/DragView.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java index d14f5f756..ca0e7b443 100644 --- a/src/com/android/launcher2/DragView.java +++ b/src/com/android/launcher2/DragView.java @@ -17,7 +17,10 @@ package com.android.launcher2; +import com.android.launcher.R; + import android.content.Context; +import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Matrix; @@ -31,9 +34,6 @@ import android.view.WindowManager; import android.view.WindowManagerImpl; public class DragView extends View implements TweenCallback { - // Number of pixels to add to the dragged item for scaling. Should be even for pixel alignment. - private static final int DRAG_SCALE = 40; - private Bitmap mBitmap; private Paint mPaint; private int mRegistrationX; @@ -66,21 +66,24 @@ public class DragView extends View implements TweenCallback { int left, int top, int width, int height) { super(context); + final Resources res = getResources(); + final int dragScale = res.getInteger(R.integer.config_dragViewExtraPixels); + mWindowManager = WindowManagerImpl.getDefault(); mTween = new SymmetricalLinearTween(false, 110 /*ms duration*/, this); Matrix scale = new Matrix(); float scaleFactor = width; - scaleFactor = mScale = (scaleFactor + DRAG_SCALE) / scaleFactor; + scaleFactor = mScale = (scaleFactor + dragScale) / scaleFactor; scale.setScale(scaleFactor, scaleFactor); mBitmap = Bitmap.createBitmap(bitmap, left, top, width, height, scale, true); setDragRegion(0, 0, width, height); // The point in our scaled bitmap that the touch events are located - mRegistrationX = registrationX + (DRAG_SCALE / 2); - mRegistrationY = registrationY + (DRAG_SCALE / 2); + mRegistrationX = registrationX + res.getInteger(R.integer.config_dragViewOffsetX); + mRegistrationY = registrationY + res.getInteger(R.integer.config_dragViewOffsetY); } public void setDragRegion(int left, int top, int width, int height) { |