diff options
author | Winson Chung <winsonc@google.com> | 2010-09-10 11:44:42 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2010-09-15 14:45:11 -0700 |
commit | e3193b93ad7bf33e2e45319084a99b9fc986622b (patch) | |
tree | 7d9676014362869b928faefa0a9323d2e8a3edb9 /src/com/android/launcher2/DragController.java | |
parent | 1ff706b8c03063740ca74868fea46fa47d71bb27 (diff) | |
download | android_packages_apps_Trebuchet-e3193b93ad7bf33e2e45319084a99b9fc986622b.tar.gz android_packages_apps_Trebuchet-e3193b93ad7bf33e2e45319084a99b9fc986622b.tar.bz2 android_packages_apps_Trebuchet-e3193b93ad7bf33e2e45319084a99b9fc986622b.zip |
Initital changes for new customization drawer/widget tab design.
Change-Id: I160c8777fe2657ab303acfa20934f2e90f9e953e
Diffstat (limited to 'src/com/android/launcher2/DragController.java')
-rw-r--r-- | src/com/android/launcher2/DragController.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index e18470ab2..7fc905bb5 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -134,7 +134,7 @@ public class DragController { void onDragStart(DragSource source, Object info, int dragAction); /** - * The drag has eneded + * The drag has ended */ void onDragEnd(); } @@ -202,6 +202,35 @@ public class DragController { /** * Starts a drag. * + * @param v The view that is being dragged + * @param bmp The bitmap that represents the view being dragged + * @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} + * @param dragRegion Coordinates within the bitmap b for the position of item being dragged. + * Makes dragging feel more precise, e.g. you can clip out a transparent border + */ + public void startDrag(View v, Bitmap bmp, DragSource source, Object dragInfo, int dragAction, + Rect dragRegion) { + mOriginator = v; + + int[] loc = mCoordinatesTemp; + v.getLocationOnScreen(loc); + int screenX = loc[0]; + int screenY = loc[1]; + + startDrag(bmp, screenX, screenY, 0, 0, bmp.getWidth(), bmp.getHeight(), + source, dragInfo, dragAction, dragRegion); + + if (dragAction == DRAG_ACTION_MOVE) { + v.setVisibility(View.GONE); + } + } + + /** + * Starts a drag. + * * @param b The bitmap to display as the drag image. It will be re-scaled to the * enlarged size. * @param screenX The x position on screen of the left-top of the bitmap. |