diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-08-21 01:12:37 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-08-25 17:21:05 +0200 |
commit | e070018b3e26371e1260229060d022808e43837e (patch) | |
tree | ccd13518265328a710036121fc805825a7d08438 /packages/Keyguard/src/com/android | |
parent | fb28c0e129896b17e4906b873bf44eb103ac2a8d (diff) | |
download | frameworks_base-e070018b3e26371e1260229060d022808e43837e.zip frameworks_base-e070018b3e26371e1260229060d022808e43837e.tar.gz frameworks_base-e070018b3e26371e1260229060d022808e43837e.tar.bz2 |
Fix password unlock method
- Update layouts/assets to material
- Fix that the virtual keyboard didn't always come up
- Fix window layout of status bar window, so it's above the IME when
on Keyguard
Bug: 16957208
Change-Id: I1785af9ac73103abe6cd9968ed27582fbfc9a1d9
Diffstat (limited to 'packages/Keyguard/src/com/android')
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java index 5f5d25c..e6c9e6c 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java @@ -25,6 +25,8 @@ import android.text.method.TextKeyListener; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.View; +import android.view.animation.AnimationUtils; +import android.view.animation.Interpolator; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; @@ -42,9 +44,12 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView implements KeyguardSecurityView, OnEditorActionListener, TextWatcher { private final boolean mShowImeAtScreenOn; + private final int mDisappearYTranslation; InputMethodManager mImm; private TextView mPasswordEntry; + private Interpolator mLinearOutSlowInInterpolator; + private Interpolator mFastOutLinearInInterpolator; public KeyguardPasswordView(Context context) { this(context, null); @@ -54,6 +59,12 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView super(context, attrs); mShowImeAtScreenOn = context.getResources(). getBoolean(R.bool.kg_show_ime_at_screen_on); + mDisappearYTranslation = getResources().getDimensionPixelSize( + R.dimen.disappear_y_translation); + mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator( + context, android.R.interpolator.linear_out_slow_in); + mFastOutLinearInInterpolator = AnimationUtils.loadInterpolator( + context, android.R.interpolator.fast_out_linear_in); } protected void resetState() { @@ -72,12 +83,19 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView } @Override - public void onResume(int reason) { + public void onResume(final int reason) { super.onResume(reason); - mPasswordEntry.requestFocus(); - if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { - mImm.showSoftInput(mPasswordEntry, InputMethodManager.SHOW_IMPLICIT); - } + + // Wait a bit to focus the field so the focusable flag on the window is already set then. + post(new Runnable() { + @Override + public void run() { + mPasswordEntry.requestFocus(); + if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { + mImm.showSoftInput(mPasswordEntry, InputMethodManager.SHOW_IMPLICIT); + } + } + }); } @Override @@ -239,14 +257,24 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView @Override public void startAppearAnimation() { - // TODO: Fancy animation. - setAlpha(0); - animate().alpha(1).withLayer().setDuration(200); + setAlpha(0f); + setTranslationY(0f); + animate() + .alpha(1) + .withLayer() + .setDuration(300) + .setInterpolator(mLinearOutSlowInInterpolator); } @Override public boolean startDisappearAnimation(Runnable finishRunnable) { - return false; + animate() + .alpha(0f) + .translationY(mDisappearYTranslation) + .setInterpolator(mFastOutLinearInInterpolator) + .setDuration(100) + .withEndAction(finishRunnable); + return true; } @Override |