mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
Merge "Fade navbar-handle in/out during TRANSITION_HANDLE_FADE" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2a20958f4b
@@ -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) {
|
||||
if (animationType == TRANSITION_HOME_TO_APP) {
|
||||
iconAlphaStartDelay = TASKBAR_STASH_ICON_ALPHA_HOME_TO_APP_START_DELAY;
|
||||
}
|
||||
stashedHandleAlphaDelay = iconAlphaStartDelay;
|
||||
stashedHandleAlphaDuration = Math.max(0, duration - iconAlphaStartDelay);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
skippable = new AnimatorSet();
|
||||
as.play(skippable);
|
||||
skippable.setInterpolator(isStashed ? INSTANT : FINAL_FRAME);
|
||||
}
|
||||
|
||||
final boolean animateBg = animationType != TRANSITION_UNSTASH_SUW_MANUAL;
|
||||
if (animateBg) {
|
||||
play(skippable, mTaskbarBackgroundOffset.animateToValue(backgroundOffsetTarget), 0,
|
||||
duration, EMPHASIZED);
|
||||
} else {
|
||||
skippable.addListener(AnimatorListeners.forEndCallback(
|
||||
() -> mTaskbarBackgroundOffset.updateValue(backgroundOffsetTarget)));
|
||||
}
|
||||
|
||||
play(skippable, mIconAlphaForStash.animateToValue(iconAlphaTarget), iconAlphaStartDelay,
|
||||
iconAlphaDuration,
|
||||
LINEAR);
|
||||
|
||||
if (isStashed) {
|
||||
play(as, mTaskbarBackgroundOffset.animateToValue(1), 0, duration, EMPHASIZED);
|
||||
|
||||
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);
|
||||
|
||||
if (animationType == TRANSITION_HANDLE_FADE) {
|
||||
skipInterpolator = INSTANT;
|
||||
}
|
||||
} else {
|
||||
final boolean animateBg = animationType != TRANSITION_UNSTASH_SUW_MANUAL;
|
||||
if (animateBg) {
|
||||
play(as, mTaskbarBackgroundOffset.animateToValue(0), 0, duration, EMPHASIZED);
|
||||
} else {
|
||||
as.addListener(AnimatorListeners.forEndCallback(
|
||||
() -> mTaskbarBackgroundOffset.updateValue(0)));
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (animationType == TRANSITION_HANDLE_FADE) {
|
||||
skipInterpolator = FINAL_FRAME;
|
||||
}
|
||||
play(skippable, mControllers.taskbarSpringOnStashController.createSpringToStash(),
|
||||
0, duration, LINEAR);
|
||||
}
|
||||
mControllers.taskbarViewController.addRevealAnimToIsStashed(as, isStashed, duration,
|
||||
|
||||
mControllers.taskbarViewController.addRevealAnimToIsStashed(skippable, isStashed, duration,
|
||||
EMPHASIZED);
|
||||
|
||||
if (skipInterpolator != null) {
|
||||
as.setInterpolator(skipInterpolator);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user