diff options
author | Selim Cinek <cinek@google.com> | 2014-11-11 13:41:02 +0100 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2014-11-12 14:48:48 +0100 |
commit | f9c0e8f02f3483d6aa9e762c97a2c02ea50eeb02 (patch) | |
tree | b5f79c6f5af6883f43ca8e5ce4ef6c55e3e1a9be /packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java | |
parent | 72e32fd55538715f72299a08e14834257847d8dc (diff) | |
download | frameworks_base-f9c0e8f02f3483d6aa9e762c97a2c02ea50eeb02.zip frameworks_base-f9c0e8f02f3483d6aa9e762c97a2c02ea50eeb02.tar.gz frameworks_base-f9c0e8f02f3483d6aa9e762c97a2c02ea50eeb02.tar.bz2 |
Added dissapear animation to pattern and pin input
Bug: 18232017
Change-Id: I062d55b0870ccaad6093b672f5076c3f80c10f94
Diffstat (limited to 'packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java')
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java | 71 |
1 files changed, 45 insertions, 26 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java index 55538a7..04ef57e 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java @@ -28,6 +28,7 @@ import android.view.animation.AnimationUtils; public class KeyguardPINView extends KeyguardPinBasedInputView { private final AppearAnimationUtils mAppearAnimationUtils; + private final DisappearAnimationUtils mDisappearAnimationUtils; private ViewGroup mKeyguardBouncerFrame; private ViewGroup mRow0; private ViewGroup mRow1; @@ -35,6 +36,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { private ViewGroup mRow3; private View mDivider; private int mDisappearYTranslation; + private View[][] mViews; public KeyguardPINView(Context context) { this(context, null); @@ -43,6 +45,10 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { public KeyguardPINView(Context context, AttributeSet attrs) { super(context, attrs); mAppearAnimationUtils = new AppearAnimationUtils(context); + mDisappearAnimationUtils = new DisappearAnimationUtils(context, + 125, 0.6f /* translationScale */, + 0.6f /* delayScale */, AnimationUtils.loadInterpolator( + mContext, android.R.interpolator.fast_out_linear_in)); mDisappearYTranslation = getResources().getDimensionPixelSize( R.dimen.disappear_y_translation); } @@ -71,6 +77,28 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { mRow2 = (ViewGroup) findViewById(R.id.row2); mRow3 = (ViewGroup) findViewById(R.id.row3); mDivider = findViewById(R.id.divider); + mViews = new View[][]{ + new View[]{ + mRow0, null, null + }, + new View[]{ + findViewById(R.id.key1), findViewById(R.id.key2), + findViewById(R.id.key3) + }, + new View[]{ + findViewById(R.id.key4), findViewById(R.id.key5), + findViewById(R.id.key6) + }, + new View[]{ + findViewById(R.id.key7), findViewById(R.id.key8), + findViewById(R.id.key9) + }, + new View[]{ + null, findViewById(R.id.key0), findViewById(R.id.key_enter) + }, + new View[]{ + null, mEcaView, null + }}; } @Override @@ -91,25 +119,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { .setDuration(500) .setInterpolator(mAppearAnimationUtils.getInterpolator()) .translationY(0); - mAppearAnimationUtils.startAppearAnimation(new View[][] { - new View[] { - mRow0, null, null - }, - new View[] { - findViewById(R.id.key1), findViewById(R.id.key2), findViewById(R.id.key3) - }, - new View[] { - findViewById(R.id.key4), findViewById(R.id.key5), findViewById(R.id.key6) - }, - new View[] { - findViewById(R.id.key7), findViewById(R.id.key8), findViewById(R.id.key9) - }, - new View[] { - null, findViewById(R.id.key0), findViewById(R.id.key_enter) - }, - new View[] { - null, mEcaView, null - }}, + mAppearAnimationUtils.startAnimation(mViews, new Runnable() { @Override public void run() { @@ -119,14 +129,23 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { } @Override - public boolean startDisappearAnimation(Runnable finishRunnable) { + public boolean startDisappearAnimation(final Runnable finishRunnable) { + enableClipping(false); + setTranslationY(0); animate() - .alpha(0f) - .translationY(mDisappearYTranslation) - .setInterpolator(AnimationUtils - .loadInterpolator(mContext, android.R.interpolator.fast_out_linear_in)) - .setDuration(100) - .withEndAction(finishRunnable); + .setDuration(280) + .setInterpolator(mDisappearAnimationUtils.getInterpolator()) + .translationY(mDisappearYTranslation); + mDisappearAnimationUtils.startAnimation(mViews, + new Runnable() { + @Override + public void run() { + enableClipping(true); + if (finishRunnable != null) { + finishRunnable.run(); + } + } + }); return true; } |