mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Translate the taskbar icons to match nav handle shape.
- We need to reset icon alignment whenever icon layout bound changes. This fixes the issue where we build an icon alignment animator before any of the views are laid out. - Separated animation logic between. createTransientAnimToIsStashed and createAnimToIsStashed * The values still require a bit more tuning but this gets us a lot closer to spec for many of the motion polish. Bug: 267806083 Bug: 246634367 Bug: 246635237 Test: manual Change-Id: Id122134b22ef4e418ce632e4a8137239dc8bb313
This commit is contained in:
@@ -17,7 +17,6 @@ package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.TASKBAR_STASH_DURATION;
|
||||
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME;
|
||||
import static com.android.systemui.animation.Interpolators.EMPHASIZED;
|
||||
|
||||
@@ -41,6 +40,7 @@ import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.launcher3.uioverrides.states.OverviewState;
|
||||
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
|
||||
import com.android.launcher3.util.window.RefreshRateTracker;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks;
|
||||
import com.android.quickstep.RecentsAnimationController;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
@@ -139,8 +139,7 @@ import java.util.StringJoiner;
|
||||
mIconAlphaForHome = mControllers.taskbarViewController
|
||||
.getTaskbarIconAlpha().get(ALPHA_INDEX_HOME);
|
||||
|
||||
mIconAlignment.finishAnimation();
|
||||
onIconAlignmentRatioChanged();
|
||||
resetIconAlignment();
|
||||
|
||||
mLauncher.getStateManager().addStateListener(mStateListener);
|
||||
|
||||
@@ -234,7 +233,7 @@ import java.util.StringJoiner;
|
||||
}
|
||||
|
||||
public void applyState() {
|
||||
applyState(TASKBAR_STASH_DURATION);
|
||||
applyState(mControllers.taskbarStashController.getStashDuration());
|
||||
}
|
||||
|
||||
public void applyState(long duration) {
|
||||
@@ -242,7 +241,7 @@ import java.util.StringJoiner;
|
||||
}
|
||||
|
||||
public Animator applyState(boolean start) {
|
||||
return applyState(TASKBAR_STASH_DURATION, start);
|
||||
return applyState(mControllers.taskbarStashController.getStashDuration(), start);
|
||||
}
|
||||
|
||||
public Animator applyState(long duration, boolean start) {
|
||||
@@ -329,8 +328,17 @@ import java.util.StringJoiner;
|
||||
+ mTaskbarBackgroundAlpha.value
|
||||
+ " -> " + backgroundAlpha + ": " + duration);
|
||||
}
|
||||
animatorSet.play(mTaskbarBackgroundAlpha.animateToValue(backgroundAlpha)
|
||||
.setDuration(duration));
|
||||
|
||||
Animator taskbarBackgroundAlpha = mTaskbarBackgroundAlpha
|
||||
.animateToValue(backgroundAlpha)
|
||||
.setDuration(duration);
|
||||
// Add a single frame delay to the taskbar bg to avoid too many moving parts during the
|
||||
// app launch animation.
|
||||
taskbarBackgroundAlpha.setStartDelay(
|
||||
(hasAnyFlag(changedFlags, FLAG_RESUMED) && !goingToLauncher)
|
||||
? RefreshRateTracker.getSingleFrameMs(mLauncher)
|
||||
: 0);
|
||||
animatorSet.play(taskbarBackgroundAlpha);
|
||||
}
|
||||
|
||||
float cornerRoundness = goingToLauncher ? 0 : 1;
|
||||
@@ -433,6 +441,14 @@ import java.util.StringJoiner;
|
||||
return (mState & FLAGS_LAUNCHER) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets and updates the icon alignment.
|
||||
*/
|
||||
protected void resetIconAlignment() {
|
||||
mIconAlignment.finishAnimation();
|
||||
onIconAlignmentRatioChanged();
|
||||
}
|
||||
|
||||
private void onIconAlignmentRatioChanged() {
|
||||
float currentValue = mIconAlphaForHome.getValue();
|
||||
boolean taskbarWillBeVisible = mIconAlignment.value < 1;
|
||||
|
||||
Reference in New Issue
Block a user