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
This commit is contained in:
Tony 2018-06-07 11:46:16 -07:00
parent 87168ca1f7
commit 5273b695c2
1 changed files with 9 additions and 0 deletions

View File

@ -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);
}
}