diff options
author | Michael Jurka <mikejurka@google.com> | 2010-08-19 13:52:27 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2010-08-23 15:49:58 -0700 |
commit | a63c452f5bd491ba9b28c332ccedc6c6c7e2f3cc (patch) | |
tree | e2b3859a545fb54e91dc98b26f90697af032b6e4 /src/com/android/launcher2/DragView.java | |
parent | 01f0ed4126be412c8c4352026dad3b2a49832267 (diff) | |
download | android_packages_apps_Trebuchet-a63c452f5bd491ba9b28c332ccedc6c6c7e2f3cc.tar.gz android_packages_apps_Trebuchet-a63c452f5bd491ba9b28c332ccedc6c6c7e2f3cc.tar.bz2 android_packages_apps_Trebuchet-a63c452f5bd491ba9b28c332ccedc6c6c7e2f3cc.zip |
added support for dragging widgets and app icons to mini screens
- gave mini screens a rounded rect background
- mini screens change color when dragged over
- added a way to specify the active region of dragged items, to allow for clipping of whitespace at borders
- fixed: feedback while dragging was often one cell off
- fixed: bug when adding to almost-full screen
- removed unused classes
Change-Id: I2fbd2aaaee6831b288cca8dec75e7b446068e8d1
Diffstat (limited to 'src/com/android/launcher2/DragView.java')
-rw-r--r-- | src/com/android/launcher2/DragView.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java index bae592cb0..41e76f0e1 100644 --- a/src/com/android/launcher2/DragView.java +++ b/src/com/android/launcher2/DragView.java @@ -39,6 +39,11 @@ public class DragView extends View implements TweenCallback { private int mRegistrationX; private int mRegistrationY; + private int mDragRegionLeft = 0; + private int mDragRegionTop = 0; + private int mDragRegionWidth; + private int mDragRegionHeight; + SymmetricalLinearTween mTween; private float mScale; private float mAnimationScale = 1.0f; @@ -71,12 +76,37 @@ public class DragView extends View implements TweenCallback { scale.setScale(scaleFactor, scaleFactor); mBitmap = Bitmap.createBitmap(bitmap, left, top, width, height, scale, true); + mDragRegionWidth = width; + mDragRegionHeight = height; // The point in our scaled bitmap that the touch events are located mRegistrationX = registrationX + (DRAG_SCALE / 2); mRegistrationY = registrationY + (DRAG_SCALE / 2); } + public void setDragRegion(int left, int top, int width, int height) { + mDragRegionLeft = left; + mDragRegionTop = top; + mDragRegionWidth = width; + mDragRegionHeight = height; + } + + public int getDragRegionLeft() { + return mDragRegionLeft; + } + + public int getDragRegionTop() { + return mDragRegionTop; + } + + public int getDragRegionWidth() { + return mDragRegionWidth; + } + + public int getDragRegionHeight() { + return mDragRegionHeight; + } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(mBitmap.getWidth(), mBitmap.getHeight()); |