Loading quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +58 −37 Original line number Diff line number Diff line Loading @@ -749,56 +749,77 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba private void createTransientAnimToIsStashed(AnimatorSet as, boolean isStashed, long duration, @StashAnimation int animationType) { Interpolator skipInterpolator = null; // Target values of the properties this is going to set final float backgroundOffsetTarget = isStashed ? 1 : 0; final float iconAlphaTarget = isStashed ? 0 : 1; final float stashedHandleAlphaTarget = isStashed ? 1 : 0; // Timing for the alpha values depend on the animation played long iconAlphaStartDelay = 0, iconAlphaDuration = 0, stashedHandleAlphaDelay = 0, stashedHandleAlphaDuration = 0; if (duration > 0) { if (animationType == TRANSITION_HANDLE_FADE) { // When fading, the handle fades in/out at the beginning of the transition with // TASKBAR_STASH_ALPHA_DURATION. stashedHandleAlphaDuration = TASKBAR_STASH_ALPHA_DURATION; // The iconAlphaDuration must be set to duration for the skippable interpolators // below to work. iconAlphaDuration = duration; } else { iconAlphaStartDelay = TASKBAR_STASH_ALPHA_START_DELAY; iconAlphaDuration = TASKBAR_STASH_ALPHA_DURATION; stashedHandleAlphaDuration = TASKBAR_STASH_ALPHA_DURATION; if (isStashed) { play(as, mTaskbarBackgroundOffset.animateToValue(1), 0, duration, EMPHASIZED); if (animationType == TRANSITION_HOME_TO_APP) { iconAlphaStartDelay = TASKBAR_STASH_ICON_ALPHA_HOME_TO_APP_START_DELAY; } stashedHandleAlphaDelay = iconAlphaStartDelay; stashedHandleAlphaDuration = Math.max(0, duration - iconAlphaStartDelay); } long alphaStartDelay = duration == 0 ? 0 : animationType == TRANSITION_HOME_TO_APP ? TASKBAR_STASH_ICON_ALPHA_HOME_TO_APP_START_DELAY : TASKBAR_STASH_ALPHA_START_DELAY; long alphaDuration = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_DURATION; play(as, mIconAlphaForStash.animateToValue(0), alphaStartDelay, alphaDuration, LINEAR); play(as, mTaskbarStashedHandleAlpha.animateToValue(1), alphaStartDelay, Math.max(0, duration - alphaStartDelay), LINEAR); } } play(as, mControllers.taskbarSpringOnStashController.createSpringToStash(), 0, duration, LINEAR); play(as, mTaskbarStashedHandleAlpha.animateToValue(stashedHandleAlphaTarget), stashedHandleAlphaDelay, stashedHandleAlphaDuration, LINEAR); // The rest of the animations might be "skipped" in TRANSITION_HANDLE_FADE transitions. AnimatorSet skippable = as; if (animationType == TRANSITION_HANDLE_FADE) { skipInterpolator = INSTANT; skippable = new AnimatorSet(); as.play(skippable); skippable.setInterpolator(isStashed ? INSTANT : FINAL_FRAME); } } else { final boolean animateBg = animationType != TRANSITION_UNSTASH_SUW_MANUAL; if (animateBg) { play(as, mTaskbarBackgroundOffset.animateToValue(0), 0, duration, EMPHASIZED); play(skippable, mTaskbarBackgroundOffset.animateToValue(backgroundOffsetTarget), 0, duration, EMPHASIZED); } else { as.addListener(AnimatorListeners.forEndCallback( () -> mTaskbarBackgroundOffset.updateValue(0))); skippable.addListener(AnimatorListeners.forEndCallback( () -> mTaskbarBackgroundOffset.updateValue(backgroundOffsetTarget))); } long alphaStartDelay = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_START_DELAY; long alphaDuration = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_DURATION; play(as, mIconAlphaForStash.animateToValue(1), alphaStartDelay, alphaDuration, LINEAR); play(as, mTaskbarStashedHandleAlpha.animateToValue(0), 0, alphaDuration, LINEAR); play(skippable, mIconAlphaForStash.animateToValue(iconAlphaTarget), iconAlphaStartDelay, iconAlphaDuration, LINEAR); if (animationType == TRANSITION_HANDLE_FADE) { skipInterpolator = FINAL_FRAME; } if (isStashed) { play(skippable, mControllers.taskbarSpringOnStashController.createSpringToStash(), 0, duration, LINEAR); } mControllers.taskbarViewController.addRevealAnimToIsStashed(as, isStashed, duration, EMPHASIZED); if (skipInterpolator != null) { as.setInterpolator(skipInterpolator); } mControllers.taskbarViewController.addRevealAnimToIsStashed(skippable, isStashed, duration, EMPHASIZED); play(as, mControllers.stashedHandleViewController play(skippable, mControllers.stashedHandleViewController .createRevealAnimToIsStashed(isStashed), 0, duration, EMPHASIZED); // Return the stashed handle to its default scale in case it was changed as part of the // feedforward hint. Note that the reveal animation above also visually scales it. as.play(mTaskbarStashedHandleHintScale.animateToValue(1f) skippable.play(mTaskbarStashedHandleHintScale.animateToValue(1f) .setDuration(isStashed ? duration / 2 : duration)); } Loading Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +58 −37 Original line number Diff line number Diff line Loading @@ -749,56 +749,77 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba private void createTransientAnimToIsStashed(AnimatorSet as, boolean isStashed, long duration, @StashAnimation int animationType) { Interpolator skipInterpolator = null; // Target values of the properties this is going to set final float backgroundOffsetTarget = isStashed ? 1 : 0; final float iconAlphaTarget = isStashed ? 0 : 1; final float stashedHandleAlphaTarget = isStashed ? 1 : 0; // Timing for the alpha values depend on the animation played long iconAlphaStartDelay = 0, iconAlphaDuration = 0, stashedHandleAlphaDelay = 0, stashedHandleAlphaDuration = 0; if (duration > 0) { if (animationType == TRANSITION_HANDLE_FADE) { // When fading, the handle fades in/out at the beginning of the transition with // TASKBAR_STASH_ALPHA_DURATION. stashedHandleAlphaDuration = TASKBAR_STASH_ALPHA_DURATION; // The iconAlphaDuration must be set to duration for the skippable interpolators // below to work. iconAlphaDuration = duration; } else { iconAlphaStartDelay = TASKBAR_STASH_ALPHA_START_DELAY; iconAlphaDuration = TASKBAR_STASH_ALPHA_DURATION; stashedHandleAlphaDuration = TASKBAR_STASH_ALPHA_DURATION; if (isStashed) { play(as, mTaskbarBackgroundOffset.animateToValue(1), 0, duration, EMPHASIZED); if (animationType == TRANSITION_HOME_TO_APP) { iconAlphaStartDelay = TASKBAR_STASH_ICON_ALPHA_HOME_TO_APP_START_DELAY; } stashedHandleAlphaDelay = iconAlphaStartDelay; stashedHandleAlphaDuration = Math.max(0, duration - iconAlphaStartDelay); } long alphaStartDelay = duration == 0 ? 0 : animationType == TRANSITION_HOME_TO_APP ? TASKBAR_STASH_ICON_ALPHA_HOME_TO_APP_START_DELAY : TASKBAR_STASH_ALPHA_START_DELAY; long alphaDuration = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_DURATION; play(as, mIconAlphaForStash.animateToValue(0), alphaStartDelay, alphaDuration, LINEAR); play(as, mTaskbarStashedHandleAlpha.animateToValue(1), alphaStartDelay, Math.max(0, duration - alphaStartDelay), LINEAR); } } play(as, mControllers.taskbarSpringOnStashController.createSpringToStash(), 0, duration, LINEAR); play(as, mTaskbarStashedHandleAlpha.animateToValue(stashedHandleAlphaTarget), stashedHandleAlphaDelay, stashedHandleAlphaDuration, LINEAR); // The rest of the animations might be "skipped" in TRANSITION_HANDLE_FADE transitions. AnimatorSet skippable = as; if (animationType == TRANSITION_HANDLE_FADE) { skipInterpolator = INSTANT; skippable = new AnimatorSet(); as.play(skippable); skippable.setInterpolator(isStashed ? INSTANT : FINAL_FRAME); } } else { final boolean animateBg = animationType != TRANSITION_UNSTASH_SUW_MANUAL; if (animateBg) { play(as, mTaskbarBackgroundOffset.animateToValue(0), 0, duration, EMPHASIZED); play(skippable, mTaskbarBackgroundOffset.animateToValue(backgroundOffsetTarget), 0, duration, EMPHASIZED); } else { as.addListener(AnimatorListeners.forEndCallback( () -> mTaskbarBackgroundOffset.updateValue(0))); skippable.addListener(AnimatorListeners.forEndCallback( () -> mTaskbarBackgroundOffset.updateValue(backgroundOffsetTarget))); } long alphaStartDelay = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_START_DELAY; long alphaDuration = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_DURATION; play(as, mIconAlphaForStash.animateToValue(1), alphaStartDelay, alphaDuration, LINEAR); play(as, mTaskbarStashedHandleAlpha.animateToValue(0), 0, alphaDuration, LINEAR); play(skippable, mIconAlphaForStash.animateToValue(iconAlphaTarget), iconAlphaStartDelay, iconAlphaDuration, LINEAR); if (animationType == TRANSITION_HANDLE_FADE) { skipInterpolator = FINAL_FRAME; } if (isStashed) { play(skippable, mControllers.taskbarSpringOnStashController.createSpringToStash(), 0, duration, LINEAR); } mControllers.taskbarViewController.addRevealAnimToIsStashed(as, isStashed, duration, EMPHASIZED); if (skipInterpolator != null) { as.setInterpolator(skipInterpolator); } mControllers.taskbarViewController.addRevealAnimToIsStashed(skippable, isStashed, duration, EMPHASIZED); play(as, mControllers.stashedHandleViewController play(skippable, mControllers.stashedHandleViewController .createRevealAnimToIsStashed(isStashed), 0, duration, EMPHASIZED); // Return the stashed handle to its default scale in case it was changed as part of the // feedforward hint. Note that the reveal animation above also visually scales it. as.play(mTaskbarStashedHandleHintScale.animateToValue(1f) skippable.play(mTaskbarStashedHandleHintScale.animateToValue(1f) .setDuration(isStashed ? duration / 2 : duration)); } Loading