Merge "Cancel recents animations after the transition starts." into nyc-dev
am: 2204f0c
* commit '2204f0c41b78808fcd1f4d05ec6fe45845bb1abf':
Cancel recents animations after the transition starts.
Change-Id: Ifb7d3ea1f85f449375523d521ecfa743b64ff458
This commit is contained in:
@@ -116,6 +116,7 @@ public class RecentsTransitionHelper {
|
|||||||
// window transition
|
// window transition
|
||||||
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
|
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
|
||||||
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
|
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
|
||||||
|
stackView.cancelAllTaskViewAnimations();
|
||||||
|
|
||||||
if (screenPinningRequested) {
|
if (screenPinningRequested) {
|
||||||
// Request screen pinning after the animation runs
|
// Request screen pinning after the animation runs
|
||||||
@@ -133,6 +134,7 @@ public class RecentsTransitionHelper {
|
|||||||
// window transition
|
// window transition
|
||||||
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
|
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
|
||||||
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
|
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
|
||||||
|
stackView.cancelAllTaskViewAnimations();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
|
|||||||
AnimateableViewBounds mViewBounds;
|
AnimateableViewBounds mViewBounds;
|
||||||
|
|
||||||
private AnimatorSet mTransformAnimation;
|
private AnimatorSet mTransformAnimation;
|
||||||
|
private ObjectAnimator mDimAnimator;
|
||||||
|
private ObjectAnimator mOutlineAnimator;
|
||||||
private final TaskViewTransform mTargetAnimationTransform = new TaskViewTransform();
|
private final TaskViewTransform mTargetAnimationTransform = new TaskViewTransform();
|
||||||
private ArrayList<Animator> mTmpAnimators = new ArrayList<>();
|
private ArrayList<Animator> mTmpAnimators = new ArrayList<>();
|
||||||
|
|
||||||
@@ -308,14 +310,14 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
|
|||||||
} else {
|
} else {
|
||||||
// Both the progress and the update are a function of the bounds movement of the task
|
// Both the progress and the update are a function of the bounds movement of the task
|
||||||
if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
|
if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
|
||||||
ObjectAnimator anim = ObjectAnimator.ofFloat(this, DIM_ALPHA, getDimAlpha(),
|
mDimAnimator = ObjectAnimator.ofFloat(this, DIM_ALPHA, getDimAlpha(),
|
||||||
toTransform.dimAlpha);
|
toTransform.dimAlpha);
|
||||||
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, anim));
|
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, mDimAnimator));
|
||||||
}
|
}
|
||||||
if (Float.compare(mViewBounds.getAlpha(), toTransform.viewOutlineAlpha) != 0) {
|
if (Float.compare(mViewBounds.getAlpha(), toTransform.viewOutlineAlpha) != 0) {
|
||||||
ObjectAnimator anim = ObjectAnimator.ofFloat(this, VIEW_OUTLINE_ALPHA,
|
mOutlineAnimator = ObjectAnimator.ofFloat(this, VIEW_OUTLINE_ALPHA,
|
||||||
mViewBounds.getAlpha(), toTransform.viewOutlineAlpha);
|
mViewBounds.getAlpha(), toTransform.viewOutlineAlpha);
|
||||||
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, anim));
|
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, mOutlineAnimator));
|
||||||
}
|
}
|
||||||
if (updateCallback != null) {
|
if (updateCallback != null) {
|
||||||
ValueAnimator updateCallbackAnim = ValueAnimator.ofInt(0, 1);
|
ValueAnimator updateCallbackAnim = ValueAnimator.ofInt(0, 1);
|
||||||
@@ -358,6 +360,8 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
|
|||||||
*/
|
*/
|
||||||
public void cancelTransformAnimation() {
|
public void cancelTransformAnimation() {
|
||||||
Utilities.cancelAnimationWithoutCallbacks(mTransformAnimation);
|
Utilities.cancelAnimationWithoutCallbacks(mTransformAnimation);
|
||||||
|
Utilities.cancelAnimationWithoutCallbacks(mDimAnimator);
|
||||||
|
Utilities.cancelAnimationWithoutCallbacks(mOutlineAnimator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enables/disables handling touch on this task view. */
|
/** Enables/disables handling touch on this task view. */
|
||||||
@@ -537,13 +541,15 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
|
|||||||
@Override
|
@Override
|
||||||
public void onStartLaunchTargetEnterAnimation(TaskViewTransform transform, int duration,
|
public void onStartLaunchTargetEnterAnimation(TaskViewTransform transform, int duration,
|
||||||
boolean screenPinningEnabled, ReferenceCountedTrigger postAnimationTrigger) {
|
boolean screenPinningEnabled, ReferenceCountedTrigger postAnimationTrigger) {
|
||||||
|
Utilities.cancelAnimationWithoutCallbacks(mDimAnimator);
|
||||||
|
|
||||||
// Dim the view after the app window transitions down into recents
|
// Dim the view after the app window transitions down into recents
|
||||||
postAnimationTrigger.increment();
|
postAnimationTrigger.increment();
|
||||||
AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT);
|
AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT);
|
||||||
Animator anim = animation.apply(AnimationProps.DIM_ALPHA, ObjectAnimator.ofFloat(this,
|
mDimAnimator = animation.apply(AnimationProps.DIM_ALPHA, ObjectAnimator.ofFloat(this,
|
||||||
DIM_ALPHA_WITHOUT_HEADER, getDimAlpha(), transform.dimAlpha));
|
DIM_ALPHA_WITHOUT_HEADER, getDimAlpha(), transform.dimAlpha));
|
||||||
anim.addListener(postAnimationTrigger.decrementOnAnimationEnd());
|
mDimAnimator.addListener(postAnimationTrigger.decrementOnAnimationEnd());
|
||||||
anim.start();
|
mDimAnimator.start();
|
||||||
|
|
||||||
if (screenPinningEnabled) {
|
if (screenPinningEnabled) {
|
||||||
showActionButton(true /* fadeIn */, duration /* fadeInDuration */);
|
showActionButton(true /* fadeIn */, duration /* fadeInDuration */);
|
||||||
@@ -553,11 +559,13 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
|
|||||||
@Override
|
@Override
|
||||||
public void onStartLaunchTargetLaunchAnimation(int duration, boolean screenPinningRequested,
|
public void onStartLaunchTargetLaunchAnimation(int duration, boolean screenPinningRequested,
|
||||||
ReferenceCountedTrigger postAnimationTrigger) {
|
ReferenceCountedTrigger postAnimationTrigger) {
|
||||||
|
Utilities.cancelAnimationWithoutCallbacks(mDimAnimator);
|
||||||
|
|
||||||
// Un-dim the view before/while launching the target
|
// Un-dim the view before/while launching the target
|
||||||
AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT);
|
AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT);
|
||||||
Animator anim = animation.apply(AnimationProps.DIM_ALPHA, ObjectAnimator.ofFloat(this,
|
mDimAnimator = animation.apply(AnimationProps.DIM_ALPHA, ObjectAnimator.ofFloat(this,
|
||||||
DIM_ALPHA, getDimAlpha(), 0));
|
DIM_ALPHA, getDimAlpha(), 0));
|
||||||
anim.start();
|
mDimAnimator.start();
|
||||||
|
|
||||||
postAnimationTrigger.increment();
|
postAnimationTrigger.increment();
|
||||||
hideActionButton(true /* fadeOut */, duration,
|
hideActionButton(true /* fadeOut */, duration,
|
||||||
|
|||||||
Reference in New Issue
Block a user