Fixing issue with swipe-dismiss animation clobbering home animation.
- Finish all dismiss animations when a dismiss-to-home animation is started, and prevent lingering deferred layout animation requests from running as they will be overwritten anyways. Bug: 28287904 Change-Id: Ie40c66c0f25705b56f6808607d2b7b8ae4e5a112
This commit is contained in:
@@ -416,7 +416,7 @@ public class TaskStackLayoutAlgorithm {
|
|||||||
int prevFocusState = mFocusState;
|
int prevFocusState = mFocusState;
|
||||||
mFocusState = focusState;
|
mFocusState = focusState;
|
||||||
updateFrontBackTransforms();
|
updateFrontBackTransforms();
|
||||||
if (mCb != null) {
|
if (mCb != null && (prevFocusState != focusState)) {
|
||||||
mCb.onFocusStateChanged(prevFocusState, focusState);
|
mCb.onFocusStateChanged(prevFocusState, focusState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
|||||||
*/
|
*/
|
||||||
private void relayoutTaskViews(AnimationProps animation, boolean ignoreTaskOverrides) {
|
private void relayoutTaskViews(AnimationProps animation, boolean ignoreTaskOverrides) {
|
||||||
// If we had a deferred animation, cancel that
|
// If we had a deferred animation, cancel that
|
||||||
mDeferredTaskViewLayoutAnimation = null;
|
cancelDeferredTaskViewLayoutAnimation();
|
||||||
|
|
||||||
// Synchronize the current set of TaskViews
|
// Synchronize the current set of TaskViews
|
||||||
bindVisibleTaskViews(mStackScroller.getStackScroll(),
|
bindVisibleTaskViews(mStackScroller.getStackScroll(),
|
||||||
@@ -739,23 +739,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels all {@link TaskView} animations.
|
* Cancels all {@link TaskView} animations.
|
||||||
*
|
|
||||||
* @see #cancelAllTaskViewAnimations(ArraySet<Task.TaskKey>)
|
|
||||||
*/
|
*/
|
||||||
void cancelAllTaskViewAnimations() {
|
void cancelAllTaskViewAnimations() {
|
||||||
cancelAllTaskViewAnimations(mIgnoreTasks);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancels all {@link TaskView} animations.
|
|
||||||
*
|
|
||||||
* @param ignoreTasksSet The set of tasks to continue running their animations.
|
|
||||||
*/
|
|
||||||
void cancelAllTaskViewAnimations(ArraySet<Task.TaskKey> ignoreTasksSet) {
|
|
||||||
List<TaskView> taskViews = getTaskViews();
|
List<TaskView> taskViews = getTaskViews();
|
||||||
for (int i = taskViews.size() - 1; i >= 0; i--) {
|
for (int i = taskViews.size() - 1; i >= 0; i--) {
|
||||||
final TaskView tv = taskViews.get(i);
|
final TaskView tv = taskViews.get(i);
|
||||||
if (!ignoreTasksSet.contains(tv.getTask().key)) {
|
if (!mIgnoreTasks.contains(tv.getTask().key)) {
|
||||||
tv.cancelTransformAnimation();
|
tv.cancelTransformAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1675,8 +1664,10 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
|||||||
|
|
||||||
public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
|
public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
|
||||||
// Stop any scrolling
|
// Stop any scrolling
|
||||||
|
cancelDeferredTaskViewLayoutAnimation();
|
||||||
mStackScroller.stopScroller();
|
mStackScroller.stopScroller();
|
||||||
mStackScroller.stopBoundScrollAnimation();
|
mStackScroller.stopBoundScrollAnimation();
|
||||||
|
mTouchHandler.finishAnimations();
|
||||||
|
|
||||||
// Start the task animations
|
// Start the task animations
|
||||||
mAnimationHelper.startExitToHomeAnimation(event.animated, event.getAnimationTrigger());
|
mAnimationHelper.startExitToHomeAnimation(event.animated, event.getAnimationTrigger());
|
||||||
|
|||||||
@@ -188,6 +188,18 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finishes all scroll-fling and swipe animations currently running.
|
||||||
|
*/
|
||||||
|
public void finishAnimations() {
|
||||||
|
Utilities.cancelAnimationWithoutCallbacks(mScrollFlingAnimator);
|
||||||
|
ArrayMap<View, Animator> existingAnimators = new ArrayMap<>(mSwipeHelperAnimations);
|
||||||
|
for (int i = 0; i < existingAnimators.size(); i++) {
|
||||||
|
existingAnimators.get(existingAnimators.keyAt(i)).end();
|
||||||
|
}
|
||||||
|
mSwipeHelperAnimations.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean handleTouchEvent(MotionEvent ev) {
|
private boolean handleTouchEvent(MotionEvent ev) {
|
||||||
// Short circuit if we have no children
|
// Short circuit if we have no children
|
||||||
if (mSv.getTaskViews().size() == 0) {
|
if (mSv.getTaskViews().size() == 0) {
|
||||||
@@ -207,19 +219,11 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
|
|||||||
mActiveTaskView = findViewAtPoint(mDownX, mDownY);
|
mActiveTaskView = findViewAtPoint(mDownX, mDownY);
|
||||||
|
|
||||||
// Stop the current scroll if it is still flinging
|
// Stop the current scroll if it is still flinging
|
||||||
|
mSv.cancelDeferredTaskViewLayoutAnimation();
|
||||||
mScroller.stopScroller();
|
mScroller.stopScroller();
|
||||||
mScroller.stopBoundScrollAnimation();
|
mScroller.stopBoundScrollAnimation();
|
||||||
mScroller.resetDeltaScroll();
|
mScroller.resetDeltaScroll();
|
||||||
Utilities.cancelAnimationWithoutCallbacks(mScrollFlingAnimator);
|
finishAnimations();
|
||||||
|
|
||||||
// Finish any existing task animations from the delete
|
|
||||||
mSv.cancelAllTaskViewAnimations();
|
|
||||||
// Finish any of the swipe helper animations
|
|
||||||
ArrayMap<View, Animator> existingAnimators = new ArrayMap<>(mSwipeHelperAnimations);
|
|
||||||
for (int i = 0; i < existingAnimators.size(); i++) {
|
|
||||||
existingAnimators.get(existingAnimators.keyAt(i)).end();
|
|
||||||
}
|
|
||||||
mSwipeHelperAnimations.clear();
|
|
||||||
|
|
||||||
// Initialize the velocity tracker
|
// Initialize the velocity tracker
|
||||||
initOrResetVelocityTracker();
|
initOrResetVelocityTracker();
|
||||||
|
|||||||
Reference in New Issue
Block a user