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

Commit d750d16b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Let TaskbarDragView scale up before switching to system drag view" into sc-v2-dev

parents b574095b 27ab9d96
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -117,6 +117,24 @@ public class TaskbarDragController extends DragController<TaskbarActivityContext
        dragLayerY += dragRect.top;

        DragOptions dragOptions = new DragOptions();
        dragOptions.preDragCondition = new DragOptions.PreDragCondition() {
            private DragView mDragView;

            @Override
            public boolean shouldStartDrag(double distanceDragged) {
                return mDragView != null && mDragView.isAnimationFinished();
            }

            @Override
            public void onPreDragStart(DropTarget.DragObject dragObject) {
                mDragView = dragObject.dragView;
            }

            @Override
            public void onPreDragEnd(DropTarget.DragObject dragObject, boolean dragStarted) {
                mDragView = null;
            }
        };
        // TODO: open popup/pre-drag
        // PopupContainerWithArrow popupContainer = PopupContainerWithArrow.showForIcon(view);
        // if (popupContainer != null) {
@@ -155,6 +173,7 @@ public class TaskbarDragController extends DragController<TaskbarActivityContext

        mDragObject = new DropTarget.DragObject(mActivity.getApplicationContext());
        mDragObject.originalView = originalView;
        mDragObject.deferDragViewCleanupPostAnimation = false;

        mIsInPreDrag = mOptions.preDragCondition != null
                && !mOptions.preDragCondition.shouldStartDrag(0);
+14 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
import static com.android.launcher3.Utilities.getBadge;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
@@ -94,6 +96,8 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
    private boolean mHasDrawn = false;

    final ValueAnimator mAnim;
    // Whether mAnim has started. Unlike mAnim.isStarted(), this is true even after mAnim ends.
    private boolean mAnimStarted;

    private int mLastTouchX;
    private int mLastTouchY;
@@ -171,6 +175,12 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
                animation.cancel();
            }
        });
        mAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                mAnimStarted = true;
            }
        });

        setDragRegion(new Rect(0, 0, width, height));

@@ -396,6 +406,10 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
        }
    }

    public boolean isAnimationFinished() {
        return mAnimStarted && !mAnim.isRunning();
    }

    /**
     * Move the window containing this view.
     *