Refine password disappear animation.

In the disappear animation, tie alpha of the view to animated value.
Before this fix, the view alpha is 1 until the animation is complete and
looks janky.

Fixes: 284436144
Test: unlock password with swipe up.
Test: unlock password with tap on notificaiton.
Test: unlock password with tap on settings from QS.
Change-Id: Ide0e632df5f4f32ecdb5ab27d4435f3e3785eecc
This commit is contained in:
Aaron Liu
2023-08-03 09:11:16 -07:00
parent da8da31917
commit 6883edae21

View File

@@ -189,17 +189,18 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView {
if (controller.isCancelled()) {
return;
}
float value = (float) animation.getAnimatedValue();
float fraction = anim.getAnimatedFraction();
Insets shownInsets = controller.getShownStateInsets();
int dist = (int) (-shownInsets.bottom / 4
* anim.getAnimatedFraction());
* fraction);
Insets insets = Insets.add(shownInsets, Insets.of(0, 0, 0, dist));
if (mDisappearAnimationListener != null) {
mDisappearAnimationListener.setTranslationY(-dist);
}
controller.setInsetsAndAlpha(insets,
(float) animation.getAnimatedValue(),
anim.getAnimatedFraction());
controller.setInsetsAndAlpha(insets, value, fraction);
setAlpha(value);
});
anim.addListener(new AnimatorListenerAdapter() {
@Override