diff options
Diffstat (limited to 'src/com/android/launcher/DropTarget.java')
-rw-r--r-- | src/com/android/launcher/DropTarget.java | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/com/android/launcher/DropTarget.java b/src/com/android/launcher/DropTarget.java index 812908906..4835323d8 100644 --- a/src/com/android/launcher/DropTarget.java +++ b/src/com/android/launcher/DropTarget.java @@ -16,6 +16,8 @@ package com.android.launcher; +import android.graphics.Rect; + /** * Interface defining an object that can receive a drag. * @@ -42,18 +44,38 @@ public interface DropTarget { void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo); /** - * Indicates whether a drop action can occur at the specified location. The method - * {@link #onDrop(DragSource, int, int, int, int, Object)} will be invoked on this - * drop target only if this method returns true. - * + * Check if a drop action can occur at, or near, the requested location. + * This may be called repeatedly during a drag, so any calls should return + * quickly. + * * @param source DragSource where the drag started * @param x X coordinate of the drop location * @param y Y coordinate of the drop location - * @param xOffset Horizontal offset with the object being dragged where the original touch happened - * @param yOffset Vertical offset with the object being dragged where the original touch happened + * @param xOffset Horizontal offset with the object being dragged where the + * original touch happened + * @param yOffset Vertical offset with the object being dragged where the + * original touch happened * @param dragInfo Data associated with the object being dragged - * - * return True if the drop is accepted, false otherwise. + * @return True if the drop will be accepted, false otherwise. */ boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo); + + /** + * Estimate the surface area where this object would land if dropped at the + * given location. + * + * @param source DragSource where the drag started + * @param x X coordinate of the drop location + * @param y Y coordinate of the drop location + * @param xOffset Horizontal offset with the object being dragged where the + * original touch happened + * @param yOffset Vertical offset with the object being dragged where the + * original touch happened + * @param dragInfo Data associated with the object being dragged + * @param recycle {@link Rect} object to be possibly recycled. + * @return Estimated area that would be occupied if object was dropped at + * the given location. Should return null if no estimate is found, + * or if this target doesn't provide estimations. + */ + Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo, Rect recycle); } |