mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +00:00
Fade in/out taskbar when launching apps from or back to AllApps/-1
- Added isHotseatIconTopWhenAligned to control both iconAlignment and stash animation to just fade in if hotseat icon isn't on top of the screen in the aligned state Fix: 257355864 Fix: 213455090 Test: Launch apps from/back to home, taskbar animate from/to hotseat Test: Launch apps from/back to AllApps/-1, taskbar fade in/out Test: Repeat aboth with transient or persistent taskbar Change-Id: I6bdae615ff9e199d23cbfe2d26c8d46a08fbc436
This commit is contained in:
@@ -17,6 +17,8 @@ package com.android.launcher3.taskbar;
|
||||
|
||||
import static android.view.HapticFeedbackConstants.LONG_PRESS;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
|
||||
import static com.android.launcher3.anim.Interpolators.INSTANT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW;
|
||||
import static com.android.launcher3.taskbar.Utilities.appendFlag;
|
||||
@@ -535,6 +537,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
final float firstHalfDurationScale;
|
||||
final float secondHalfDurationScale;
|
||||
|
||||
boolean isHotseatIconOnTopWhenAligned =
|
||||
mControllers.uiController.isHotseatIconOnTopWhenAligned();
|
||||
if (isStashed) {
|
||||
firstHalfDurationScale = 0.75f;
|
||||
secondHalfDurationScale = 0.5f;
|
||||
@@ -555,6 +559,12 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
secondHalfAnimatorSet.playTogether(
|
||||
mTaskbarStashedHandleAlpha.animateToValue(1)
|
||||
);
|
||||
|
||||
// If Hotseat is not the top element, an already stashed Taskbar should fade in.
|
||||
if (!isHotseatIconOnTopWhenAligned) {
|
||||
fullLengthAnimatorSet.setInterpolator(INSTANT);
|
||||
firstHalfAnimatorSet.setInterpolator(INSTANT);
|
||||
}
|
||||
} else {
|
||||
firstHalfDurationScale = 0.5f;
|
||||
secondHalfDurationScale = 0.75f;
|
||||
@@ -575,6 +585,13 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
secondHalfAnimatorSet.playTogether(
|
||||
mIconAlphaForStash.animateToValue(1)
|
||||
);
|
||||
|
||||
// If Hotseat is not the top element, the stashed Taskbar should fade out without
|
||||
// unstashing.
|
||||
if (!isHotseatIconOnTopWhenAligned) {
|
||||
fullLengthAnimatorSet.setInterpolator(FINAL_FRAME);
|
||||
secondHalfAnimatorSet.setInterpolator(FINAL_FRAME);
|
||||
}
|
||||
}
|
||||
|
||||
fullLengthAnimatorSet.play(mControllers.stashedHandleViewController
|
||||
@@ -916,6 +933,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
private final IntPredicate mStashCondition;
|
||||
|
||||
private boolean mIsStashed;
|
||||
private boolean mIsHotseatIconOnTopWhenAligned;
|
||||
private int mPrevFlags;
|
||||
|
||||
StatePropertyHolder(IntPredicate stashCondition) {
|
||||
@@ -945,7 +963,13 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
mPrevFlags = flags;
|
||||
}
|
||||
boolean isStashed = mStashCondition.test(flags);
|
||||
if (mIsStashed != isStashed) {
|
||||
boolean isHotseatIconOnTopWhenAligned =
|
||||
mControllers.uiController.isHotseatIconOnTopWhenAligned();
|
||||
// If an animation has started and mIsHotseatIconOnTopWhenAligned is changed, we need
|
||||
// to restart the animation with new parameters.
|
||||
if (mIsStashed != isStashed
|
||||
|| (mIsHotseatIconOnTopWhenAligned != isHotseatIconOnTopWhenAligned
|
||||
&& mAnimator != null && mAnimator.isStarted())) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.TASKBAR_IN_APP_STATE, String.format(
|
||||
"setState: mIsStashed=%b, isStashed=%b, duration=%d, start=:%b",
|
||||
@@ -955,6 +979,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
start));
|
||||
}
|
||||
mIsStashed = isStashed;
|
||||
mIsHotseatIconOnTopWhenAligned = isHotseatIconOnTopWhenAligned;
|
||||
|
||||
// This sets mAnimator.
|
||||
createAnimToIsStashed(mIsStashed, duration, startDelay, /* animateBg= */ true);
|
||||
|
||||
Reference in New Issue
Block a user