From ad57431f497fc555f8a58a7890073997883bf85f Mon Sep 17 00:00:00 2001
From: Vadim Tryshev
* View objects that receive a DragEvent call {@link #getAction()}, which returns
@@ -161,8 +161,8 @@ public class DragEvent implements Parcelable {
* event when they are added or becoming visible.
*
- * A View only receives further drag events if it returns {@code true} in response to
- * ACTION_DRAG_STARTED.
+ * A View only receives further drag events for the drag operation if it returns {@code true}
+ * in response to ACTION_DRAG_STARTED.
*
* A View receives an {@link #ACTION_DRAG_ENTERED} event before receiving any
@@ -355,9 +356,10 @@ public class DragEvent implements Parcelable {
/**
* Returns the {@link android.content.ClipData} object sent to the system as part of the call
* to
- * {@link android.view.View#startDrag(ClipData,View.DragShadowBuilder,Object,int) startDrag()}.
+ * {@link android.view.View#startDragAndDrop(ClipData,View.DragShadowBuilder,Object,int)
+ * startDragAndDrop()}.
* This method only returns valid data if the event action is {@link #ACTION_DROP}.
- * @return The ClipData sent to the system by startDrag().
+ * @return The ClipData sent to the system by startDragAndDrop().
*/
public ClipData getClipData() {
return mClipData;
@@ -366,12 +368,14 @@ public class DragEvent implements Parcelable {
/**
* Returns the {@link android.content.ClipDescription} object contained in the
* {@link android.content.ClipData} object sent to the system as part of the call to
- * {@link android.view.View#startDrag(ClipData,View.DragShadowBuilder,Object,int) startDrag()}.
+ * {@link android.view.View#startDragAndDrop(ClipData,View.DragShadowBuilder,Object,int)
+ * startDragAndDrop()}.
* The drag handler or listener for a View can use the metadata in this object to decide if the
* View can accept the dragged View object's data.
*
* This method returns valid data for all event actions except for {@link #ACTION_DRAG_ENDED}.
- * @return The ClipDescription that was part of the ClipData sent to the system by startDrag().
+ * @return The ClipDescription that was part of the ClipData sent to the system by
+ * startDragAndDrop().
*/
public ClipDescription getClipDescription() {
return mClipDescription;
@@ -384,7 +388,8 @@ public class DragEvent implements Parcelable {
/**
* Returns the local state object sent to the system as part of the call to
- * {@link android.view.View#startDrag(ClipData,View.DragShadowBuilder,Object,int) startDrag()}.
+ * {@link android.view.View#startDragAndDrop(ClipData,View.DragShadowBuilder,Object,int)
+ * startDragAndDrop()}.
* The object is intended to provide local information about the drag and drop operation. For
* example, it can indicate whether the drag and drop operation is a copy or a move.
*
@@ -394,7 +399,7 @@ public class DragEvent implements Parcelable {
*
* This method returns valid data for all event actions except for {@link #ACTION_DRAG_ENDED}.
*
+ * For all other events, the return value is ignored. + *
*/ public boolean onDragEvent(DragEvent event) { return false; diff --git a/docs/html/guide/topics/ui/drag-drop.jd b/docs/html/guide/topics/ui/drag-drop.jd index 4a87cd4938cbc..bae3fe663800e 100644 --- a/docs/html/guide/topics/ui/drag-drop.jd +++ b/docs/html/guide/topics/ui/drag-drop.jd @@ -157,19 +157,22 @@ DraggableDot.java inThe system first responds by calling back to your application to get a drag shadow. It then displays the drag shadow on the device. @@ -199,12 +204,13 @@ DraggableDot.java
@@ -297,7 +304,8 @@ DraggableDot.java
in table 2. It is also described in detail with the event for which it is valid in the section @@ -316,8 +324,9 @@ DraggableDot.java in {@link android.view.DragEvent#ACTION_DRAG_EXITED}@@ -751,7 +762,9 @@ imageView.setOnLongClickListener(new View.OnLongClickListener() { {@link android.view.DragEvent#ACTION_DRAG_LOCATION}: Once the listener receives an {@link android.view.DragEvent#ACTION_DRAG_ENTERED} event, and before it receives an A{@link android.view.DragEvent#ACTION_DRAG_EXITED} event, it receives a new - {@link android.view.DragEvent#ACTION_DRAG_LOCATION} event every time the touch point moves. + {@link android.view.DragEvent#ACTION_DRAG_LOCATION} event immediately after the + {@link android.view.DragEvent#ACTION_DRAG_ENTERED} event, and then every time the touch + point moves. The {@link android.view.DragEvent#getX()} and {@link android.view.DragEvent#getY()} methods return the X and Y coordinates of the touch point. @@ -769,9 +782,9 @@ imageView.setOnLongClickListener(new View.OnLongClickListener() {
- When the user releases the drag shadow on a View in the application, and that View previously + When the user releases the drag shadow on a View in the application, but not on its descendant + view that can accept the data, and that View previously reported that it could accept the content being dragged, the system dispatches a drag event to that View with the action type {@link android.view.DragEvent#ACTION_DROP}. The listener should do the following: @@ -800,8 +813,8 @@ imageView.setOnLongClickListener(new View.OnLongClickListener() {
true to the system.
-