Relying on the controller state instead of animator state for

icon alignment

Bug: 246644619
Test: Presubmit
Change-Id: Iaa4ddd94a6d85acb9f8501263665ea78394815de
This commit is contained in:
Sunny Goyal
2022-10-26 10:29:46 -07:00
parent 9e1f6002e5
commit 774dcd06ae
5 changed files with 35 additions and 40 deletions

View File

@@ -280,10 +280,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
* 0 => not aligned
* 1 => fully aligned
*/
public void setLauncherIconAlignment(float alignmentRatio, Float endAlignment,
DeviceProfile launcherDp) {
public void setLauncherIconAlignment(float alignmentRatio, DeviceProfile launcherDp) {
if (mIconAlignControllerLazy == null) {
mIconAlignControllerLazy = createIconAlignmentController(launcherDp, endAlignment);
mIconAlignControllerLazy = createIconAlignmentController(launcherDp);
}
mIconAlignControllerLazy.setPlayFraction(alignmentRatio);
if (alignmentRatio <= 0 || alignmentRatio >= 1) {
@@ -295,8 +294,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
/**
* Creates an animation for aligning the taskbar icons with the provided Launcher device profile
*/
private AnimatorPlaybackController createIconAlignmentController(DeviceProfile launcherDp,
Float endAlignment) {
private AnimatorPlaybackController createIconAlignmentController(DeviceProfile launcherDp) {
mOnControllerPreCreateCallback.run();
PendingAnimation setter = new PendingAnimation(100);
DeviceProfile taskbarDp = mActivity.getDeviceProfile();
@@ -322,7 +320,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
setter.addOnFrameListener(anim -> mActivity.setTaskbarWindowHeight(
anim.getAnimatedFraction() > 0 ? expandedHeight : collapsedHeight));
boolean isToHome = endAlignment != null && endAlignment == 1;
boolean isToHome = mControllers.uiController.isIconAlignedWithHotseat();
for (int i = 0; i < mTaskbarView.getChildCount(); i++) {
View child = mTaskbarView.getChildAt(i);
int positionInHotseat;