Reapply back button alpha at end of state animation
We determine the toAlpha at the start of the state change, but something
may happen (e.g. we lose window focus) during the transition. So to make
sure we don't end in a state with the wrong alpha, reapply at the end.
Bug: 109835691
Change-Id: I271a1d269f861f698efbb8e66148a924c8620e71
diff --git a/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java b/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java
index 2e6dcc0..722f51b 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java
@@ -16,6 +16,8 @@
package com.android.launcher3.uioverrides;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import com.android.launcher3.Launcher;
@@ -56,6 +58,13 @@
final float alpha = (float) valueAnimator.getAnimatedValue();
mOverviewInteractionState.setBackButtonAlpha(alpha, false);
});
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ // Reapply the final alpha in case some state (e.g. window focus) changed.
+ UiFactory.onLauncherStateOrFocusChanged(mLauncher);
+ }
+ });
builder.play(anim);
}
}