Loading quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +19 −0 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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); Loading src/com/android/launcher3/dragndrop/DragView.java +14 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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)); Loading Loading @@ -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. * Loading Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +19 −0 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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); Loading
src/com/android/launcher3/dragndrop/DragView.java +14 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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)); Loading Loading @@ -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. * Loading