diff options
author | Patrick Dubroy <dubroy@google.com> | 2011-02-18 14:35:21 -0800 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2011-02-18 20:03:59 -0800 |
commit | 5f445425606b2c27276a79e9e871cf7f67b1b719 (patch) | |
tree | 51e130898b544bdc098fb67f32a6dfcdbb1c9150 /src/com/android/launcher2/DragController.java | |
parent | a88b213087ea46060bbbebbae52e069b873f3097 (diff) | |
download | android_packages_apps_Trebuchet-5f445425606b2c27276a79e9e871cf7f67b1b719.tar.gz android_packages_apps_Trebuchet-5f445425606b2c27276a79e9e871cf7f67b1b719.tar.bz2 android_packages_apps_Trebuchet-5f445425606b2c27276a79e9e871cf7f67b1b719.zip |
Add missing animations when dragging from customize.
- Fix 3453751: Moon landing on canceled drag from customize
- Fix 3453595: Use home screen "consume" animation when dragging and dropping
Change-Id: Ia6a83c2d7a8f24c3ce02811547a35a7022d245f6
Diffstat (limited to 'src/com/android/launcher2/DragController.java')
-rw-r--r-- | src/com/android/launcher2/DragController.java | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index 45b359dc5..e54669718 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -205,9 +205,7 @@ public class DragController { int screenX = loc[0]; int screenY = loc[1]; - startDrag(b, screenX, screenY, 0, 0, b.getWidth(), b.getHeight(), - source, dragInfo, dragAction, dragRegion); - + startDrag(b, screenX, screenY, source, dragInfo, dragAction, dragRegion); b.recycle(); if (dragAction == DRAG_ACTION_MOVE) { @@ -236,8 +234,7 @@ public class DragController { int screenX = loc[0]; int screenY = loc[1]; - startDrag(bmp, screenX, screenY, 0, 0, bmp.getWidth(), bmp.getHeight(), - source, dragInfo, dragAction, dragRegion); + startDrag(bmp, screenX, screenY, source, dragInfo, dragAction, dragRegion); if (dragAction == DRAG_ACTION_MOVE) { v.setVisibility(View.GONE); @@ -251,20 +248,14 @@ public class DragController { * enlarged size. * @param screenX The x position on screen of the left-top of the bitmap. * @param screenY The y position on screen of the left-top of the bitmap. - * @param textureLeft The left edge of the region inside b to use. - * @param textureTop The top edge of the region inside b to use. - * @param textureWidth The width of the region inside b to use. - * @param textureHeight The height of the region inside b to use. * @param source An object representing where the drag originated * @param dragInfo The data associated with the object that is being dragged * @param dragAction The drag action: either {@link #DRAG_ACTION_MOVE} or * {@link #DRAG_ACTION_COPY} */ public void startDrag(Bitmap b, int screenX, int screenY, - int textureLeft, int textureTop, int textureWidth, int textureHeight, DragSource source, Object dragInfo, int dragAction) { - startDrag(b, screenX, screenY, textureLeft, textureTop, textureWidth, textureHeight, - source, dragInfo, dragAction, null); + startDrag(b, screenX, screenY, source, dragInfo, dragAction, null); } /** @@ -274,10 +265,6 @@ public class DragController { * enlarged size. * @param screenX The x position on screen of the left-top of the bitmap. * @param screenY The y position on screen of the left-top of the bitmap. - * @param textureLeft The left edge of the region inside b to use. - * @param textureTop The top edge of the region inside b to use. - * @param textureWidth The width of the region inside b to use. - * @param textureHeight The height of the region inside b to use. * @param source An object representing where the drag originated * @param dragInfo The data associated with the object that is being dragged * @param dragAction The drag action: either {@link #DRAG_ACTION_MOVE} or @@ -286,7 +273,6 @@ public class DragController { * Makes dragging feel more precise, e.g. you can clip out a transparent border */ public void startDrag(Bitmap b, int screenX, int screenY, - int textureLeft, int textureTop, int textureWidth, int textureHeight, DragSource source, Object dragInfo, int dragAction, Rect dragRegion) { if (PROFILE_DRAWING_DURING_DRAG) { android.os.Debug.startMethodTracing("Launcher"); @@ -318,7 +304,7 @@ public class DragController { mVibrator.vibrate(VIBRATE_DURATION); DragView dragView = mDragView = new DragView(mContext, b, registrationX, registrationY, - textureLeft, textureTop, textureWidth, textureHeight); + 0, 0, b.getWidth(), b.getHeight()); final DragSource dragSource = source; dragView.setOnDrawRunnable(new Runnable() { @@ -400,7 +386,7 @@ public class DragController { public void cancelDrag() { if (mDragging) { // Should we also be calling onDragExit() here? - mDragSource.onDropCompleted(null, false); + mDragSource.onDropCompleted(null, mDragInfo, false); } endDrag(); } @@ -596,14 +582,14 @@ public class DragController { (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo)) { dropTarget.onDrop(mDragSource, coordinates[0], coordinates[1], (int) mTouchOffsetX, (int) mTouchOffsetY, mDragView, mDragInfo); - mDragSource.onDropCompleted((View) dropTarget, true); + mDragSource.onDropCompleted((View) dropTarget, mDragInfo, true); return true; } else { - mDragSource.onDropCompleted((View) dropTarget, false); + mDragSource.onDropCompleted((View) dropTarget, mDragInfo, false); return true; } } else { - mDragSource.onDropCompleted(null, false); + mDragSource.onDropCompleted(null, mDragInfo, false); } return false; } @@ -716,6 +702,10 @@ public class DragController { mDeleteRegion = region; } + DragView getDragView() { + return mDragView; + } + private class ScrollRunnable implements Runnable { private int mDirection; |