Merge "Let TaskbarDragView scale up before switching to system drag view" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d750d16b69
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user