Loading packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java +3 −0 Original line number Diff line number Diff line Loading @@ -194,9 +194,12 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey mMessageAreaController.setMessage(mView.getWrongPasswordStringId()); } mView.resetPasswordText(true /* animate */, false /* announce deletion if no match */); startErrorAnimation(); } } protected void startErrorAnimation() { /* no-op */ } protected void verifyPasswordAndUnlock() { if (mDismissing) return; // already verified but haven't been dismissed; don't do it again. Loading packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java +51 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_RESTART; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_TIMEOUT; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_USER_REQUEST; import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; Loading @@ -32,6 +35,10 @@ import android.view.View; import com.android.internal.widget.LockscreenCredential; import com.android.systemui.R; import com.android.systemui.animation.Interpolators; import java.util.ArrayList; import java.util.List; /** * A Pin based Keyguard input view Loading Loading @@ -188,4 +195,48 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView return getContext().getString( com.android.internal.R.string.keyguard_accessibility_pin_unlock); } /** * Begins an error animation for this view. **/ public void startErrorAnimation() { AnimatorSet animatorSet = new AnimatorSet(); List<Animator> animators = new ArrayList(); List<View> buttons = new ArrayList<>(); for (int i = 1; i <= 9; i++) { buttons.add(mButtons[i]); } buttons.add(mDeleteButton); buttons.add(mButtons[0]); buttons.add(mOkButton); int delay = 0; for (int i = 0; i < buttons.size(); i++) { final View button = buttons.get(i); AnimatorSet animateWrapper = new AnimatorSet(); animateWrapper.setStartDelay(delay); ValueAnimator scaleDownAnimator = ValueAnimator.ofFloat(1f, 0.8f); scaleDownAnimator.setInterpolator(Interpolators.STANDARD); scaleDownAnimator.addUpdateListener(valueAnimator -> { button.setScaleX((float) valueAnimator.getAnimatedValue()); button.setScaleY((float) valueAnimator.getAnimatedValue()); }); scaleDownAnimator.setDuration(50); ValueAnimator scaleUpAnimator = ValueAnimator.ofFloat(0.8f, 1f); scaleUpAnimator.setInterpolator(Interpolators.STANDARD); scaleUpAnimator.addUpdateListener(valueAnimator -> { button.setScaleX((float) valueAnimator.getAnimatedValue()); button.setScaleY((float) valueAnimator.getAnimatedValue()); }); scaleUpAnimator.setDuration(617); animateWrapper.playSequentially(scaleDownAnimator, scaleUpAnimator); animators.add(animateWrapper); delay += 33; } animatorSet.playTogether(animators); animatorSet.start(); } } packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java +6 −0 Original line number Diff line number Diff line Loading @@ -134,4 +134,10 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB mView.setPasswordEntryEnabled(true); mMessageAreaController.setMessage(R.string.keyguard_enter_your_pin); } @Override protected void startErrorAnimation() { super.startErrorAnimation(); mView.startErrorAnimation(); } } Loading
packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java +3 −0 Original line number Diff line number Diff line Loading @@ -194,9 +194,12 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey mMessageAreaController.setMessage(mView.getWrongPasswordStringId()); } mView.resetPasswordText(true /* animate */, false /* announce deletion if no match */); startErrorAnimation(); } } protected void startErrorAnimation() { /* no-op */ } protected void verifyPasswordAndUnlock() { if (mDismissing) return; // already verified but haven't been dismissed; don't do it again. Loading
packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java +51 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_RESTART; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_TIMEOUT; import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_USER_REQUEST; import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; Loading @@ -32,6 +35,10 @@ import android.view.View; import com.android.internal.widget.LockscreenCredential; import com.android.systemui.R; import com.android.systemui.animation.Interpolators; import java.util.ArrayList; import java.util.List; /** * A Pin based Keyguard input view Loading Loading @@ -188,4 +195,48 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView return getContext().getString( com.android.internal.R.string.keyguard_accessibility_pin_unlock); } /** * Begins an error animation for this view. **/ public void startErrorAnimation() { AnimatorSet animatorSet = new AnimatorSet(); List<Animator> animators = new ArrayList(); List<View> buttons = new ArrayList<>(); for (int i = 1; i <= 9; i++) { buttons.add(mButtons[i]); } buttons.add(mDeleteButton); buttons.add(mButtons[0]); buttons.add(mOkButton); int delay = 0; for (int i = 0; i < buttons.size(); i++) { final View button = buttons.get(i); AnimatorSet animateWrapper = new AnimatorSet(); animateWrapper.setStartDelay(delay); ValueAnimator scaleDownAnimator = ValueAnimator.ofFloat(1f, 0.8f); scaleDownAnimator.setInterpolator(Interpolators.STANDARD); scaleDownAnimator.addUpdateListener(valueAnimator -> { button.setScaleX((float) valueAnimator.getAnimatedValue()); button.setScaleY((float) valueAnimator.getAnimatedValue()); }); scaleDownAnimator.setDuration(50); ValueAnimator scaleUpAnimator = ValueAnimator.ofFloat(0.8f, 1f); scaleUpAnimator.setInterpolator(Interpolators.STANDARD); scaleUpAnimator.addUpdateListener(valueAnimator -> { button.setScaleX((float) valueAnimator.getAnimatedValue()); button.setScaleY((float) valueAnimator.getAnimatedValue()); }); scaleUpAnimator.setDuration(617); animateWrapper.playSequentially(scaleDownAnimator, scaleUpAnimator); animators.add(animateWrapper); delay += 33; } animatorSet.playTogether(animators); animatorSet.start(); } }
packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java +6 −0 Original line number Diff line number Diff line Loading @@ -134,4 +134,10 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB mView.setPasswordEntryEnabled(true); mMessageAreaController.setMessage(R.string.keyguard_enter_your_pin); } @Override protected void startErrorAnimation() { super.startErrorAnimation(); mView.startErrorAnimation(); } }