Let TaskbarDragView scale up before switching to system drag view

Test: Long press taskbar icons, ensure they aniamte the scale up
Fixes: 182981908
Change-Id: I573fe66c93ebf995b3f56f2c003dee987687b6a7
This commit is contained in:
Tony Wickham
2021-07-28 08:03:14 -10:00
parent 42fe934768
commit 27ab9d96eb
2 changed files with 33 additions and 0 deletions

View File

@@ -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);