Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e311034e authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev
Browse files

Add View.startDragAndDrop and deprecate View.startDrag

This in preparation to adding a new method to cancel an
ongoing drag. This method cannot be called cancelDrag,
stopDrag or endDrag because these names are already
taken by View-derived classes in the framework or in
important apps.

Change-Id: Ie21a778c3253b2d526c0c1bcc423c374ca70ee01
parent dd311b25
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -36756,7 +36756,8 @@ package android.view {
    method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback);
    method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback, int);
    method public void startAnimation(android.view.animation.Animation);
    method public final boolean startDrag(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int);
    method public final deprecated boolean startDrag(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int);
    method public final boolean startDragAndDrop(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int);
    method public boolean startNestedScroll(int);
    method public void stopNestedScroll();
    method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
+2 −1
Original line number Diff line number Diff line
@@ -39079,7 +39079,8 @@ package android.view {
    method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback);
    method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback, int);
    method public void startAnimation(android.view.animation.Animation);
    method public final boolean startDrag(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int);
    method public final deprecated boolean startDrag(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int);
    method public final boolean startDragAndDrop(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int);
    method public boolean startNestedScroll(int);
    method public void stopNestedScroll();
    method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
+19 −8
Original line number Diff line number Diff line
@@ -3696,7 +3696,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    /**
     * Flag indicating that a drag can cross window boundaries.  When
     * {@link #startDrag(ClipData, DragShadowBuilder, Object, int)} is called
     * {@link #startDragAndDrop(ClipData, DragShadowBuilder, Object, int)} is called
     * with this flag set, all visible applications will be able to participate
     * in the drag operation and receive the dragged content.
     *
@@ -3741,7 +3741,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    /**
     * Flag indicating that the drag shadow will be opaque.  When
     * {@link #startDrag(ClipData, DragShadowBuilder, Object, int)} is called
     * {@link #startDragAndDrop(ClipData, DragShadowBuilder, Object, int)} is called
     * with this flag set, the drag shadow will be opaque, otherwise, it will be semitransparent.
     */
    public static final int DRAG_FLAG_OPAQUE = 1 << 9;
@@ -19909,6 +19909,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * @deprecated Use {@link #startDragAndDrop(ClipData, DragShadowBuilder, Object, int)
     * startDragAndDrop()} for newer platform versions.
     */
    public final boolean startDrag(ClipData data, DragShadowBuilder shadowBuilder,
                                   Object myLocalState, int flags) {
        return startDragAndDrop(data, shadowBuilder, myLocalState, flags);
    }
    /**
     * Starts a drag and drop operation. When your application calls this method, it passes a
     * {@link android.view.View.DragShadowBuilder} object to the system. The
@@ -19926,9 +19935,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *  {@link android.view.DragEvent#ACTION_DRAG_STARTED}.
     * </p>
     * <p>
     * Your application can invoke startDrag() on any attached View object. The View object does not
     * need to be the one used in {@link android.view.View.DragShadowBuilder}, nor does it need to
     * be related to the View the user selected for dragging.
     * Your application can invoke {@link #startDragAndDrop(ClipData, DragShadowBuilder, Object,
     * int) startDragAndDrop()} on any attached View object. The View object does not need to be
     * the one used in {@link android.view.View.DragShadowBuilder}, nor does it need to be related
     * to the View the user selected for dragging.
     * </p>
     * @param data A {@link android.content.ClipData} object pointing to the data to be
     * transferred by the drag and drop operation.
@@ -19948,10 +19958,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * {@code false} if it fails anywhere. Returning {@code false} means the system was unable to
     * do a drag, and so no drag operation is in progress.
     */
    public final boolean startDrag(ClipData data, DragShadowBuilder shadowBuilder,
    public final boolean startDragAndDrop(ClipData data, DragShadowBuilder shadowBuilder,
            Object myLocalState, int flags) {
        if (ViewDebug.DEBUG_DRAG) {
            Log.d(VIEW_LOG_TAG, "startDrag: data=" + data + " flags=" + flags);
            Log.d(VIEW_LOG_TAG, "startDragAndDrop: data=" + data + " flags=" + flags);
        }
        boolean okay = false;
@@ -20030,7 +20040,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    /**
     * Handles drag events sent by the system following a call to
     * {@link android.view.View#startDrag(ClipData,DragShadowBuilder,Object,int) startDrag()}.
     * {@link android.view.View#startDragAndDrop(ClipData,DragShadowBuilder,Object,int)
     * startDragAndDrop()}.
     *<p>
     * When the system calls this method, it passes a
     * {@link android.view.DragEvent} object. A call to