From 5273b695c2f3b3ad61f5af391e74615eefcba689 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 7 Jun 2018 11:46:16 -0700 Subject: [PATCH] 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 --- .../launcher3/uioverrides/BackButtonAlphaHandler.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java b/quickstep/src/com/android/launcher3/uioverrides/BackButtonAlphaHandler.java index 2e6dcc0e77..722f51ba76 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 @@ public class BackButtonAlphaHandler implements LauncherStateManager.StateHandler 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); } }