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

Commit b021337e authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Android (Google) Code Review
Browse files

Merge "Enabling accessibility dragging with the framework drag driver." into ub-launcher3-master

parents fc431166 56e40989
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -76,10 +76,11 @@ public class DragController implements DragDriver.EventListener {

    /**
     * Drag driver for the current drag/drop operation, or null if there is no active DND operation.
     * It's null during accessible drag operations.
     */
    private DragDriver mDragDriver = null;

    /** Whether or not this is an accessible drag operation */
    /** Whether or not an accessible drag operation is in progress. */
    private boolean mIsAccessibleDrag;

    /** X coordinate of the down event. */
@@ -255,7 +256,9 @@ public class DragController implements DragDriver.EventListener {
        final DragView dragView = mDragObject.dragView = new DragView(mLauncher, b, registrationX,
                registrationY, 0, 0, b.getWidth(), b.getHeight(), initialDragViewScale);

        if (!accessible) {
            mDragDriver = DragDriver.create(this, dragInfo, dragView);
        }

        if (dragOffset != null) {
            dragView.setDragVisualizeOffset(new Point(dragOffset));
@@ -323,14 +326,14 @@ public class DragController implements DragDriver.EventListener {
    }

    public boolean isDragging() {
        return mDragDriver != null;
        return mDragDriver != null || mIsAccessibleDrag;
    }

    /**
     * Stop dragging without dropping.
     */
    public void cancelDrag() {
        if (mDragDriver != null) {
        if (isDragging()) {
            if (mLastDropTarget != null) {
                mLastDropTarget.onDragExit(mDragObject);
            }
@@ -365,7 +368,7 @@ public class DragController implements DragDriver.EventListener {
    }

    private void endDrag() {
        if (mDragDriver != null) {
        if (isDragging()) {
            mDragDriver = null;
            mIsAccessibleDrag = false;
            clearScrollRunnable();
@@ -842,10 +845,6 @@ public class DragController implements DragDriver.EventListener {
        mScrollView = v;
    }

    DragView getDragView() {
        return mDragObject.dragView;
    }

    private class ScrollRunnable implements Runnable {
        private int mDirection;