Merge "Keyguard: Fix missing IME, and apply better animations"
This commit is contained in:
committed by
Android (Google) Code Review
commit
583b2e5098
@@ -43,6 +43,10 @@ public abstract class KeyguardInputView extends LinearLayout {
|
||||
|
||||
abstract CharSequence getTitle();
|
||||
|
||||
void animateForIme(float interpolatedFraction) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean disallowInterceptTouch(MotionEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -136,24 +136,14 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView {
|
||||
|
||||
@Override
|
||||
public void startAppearAnimation() {
|
||||
// Reset state, and let IME animation reveal the view as it slides in
|
||||
setAlpha(0f);
|
||||
setTranslationY(0f);
|
||||
animate()
|
||||
.alpha(1)
|
||||
.withLayer()
|
||||
.setDuration(300)
|
||||
.setInterpolator(mLinearOutSlowInInterpolator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startDisappearAnimation(Runnable finishRunnable) {
|
||||
animate()
|
||||
.alpha(0f)
|
||||
.translationY(mDisappearYTranslation)
|
||||
.setInterpolator(mFastOutLinearInInterpolator)
|
||||
.setDuration(100)
|
||||
.withEndAction(finishRunnable);
|
||||
return true;
|
||||
public void animateForIme(float interpolatedFraction) {
|
||||
setAlpha(interpolatedFraction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -194,14 +194,18 @@ public class KeyguardPasswordViewController
|
||||
@Override
|
||||
public void onResume(int reason) {
|
||||
super.onResume(reason);
|
||||
// Wait a bit to focus the field so the focusable flag on the window is already set then.
|
||||
mMainExecutor.execute(() -> {
|
||||
if (mView.isShown() && mPasswordEntry.isEnabled()) {
|
||||
mPasswordEntry.requestFocus();
|
||||
if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) {
|
||||
mInputMethodManager.showSoftInput(
|
||||
mPasswordEntry, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
|
||||
mPasswordEntry.requestFocus();
|
||||
if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) {
|
||||
showInput();
|
||||
}
|
||||
}
|
||||
|
||||
private void showInput() {
|
||||
mPasswordEntry.post(() -> {
|
||||
if (mPasswordEntry.isFocused() && mView.isShown()) {
|
||||
mInputMethodManager.showSoftInput(
|
||||
mPasswordEntry, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -119,21 +119,24 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
@Override
|
||||
public WindowInsets onProgress(WindowInsets windowInsets,
|
||||
List<WindowInsetsAnimation> list) {
|
||||
int translationY = 0;
|
||||
if (mDisappearAnimRunning) {
|
||||
mSecurityViewFlipper.setTranslationY(
|
||||
mInitialBounds.bottom - mFinalBounds.bottom);
|
||||
} else {
|
||||
int translationY = 0;
|
||||
float interpolatedFraction = 1f;
|
||||
for (WindowInsetsAnimation animation : list) {
|
||||
if ((animation.getTypeMask() & WindowInsets.Type.ime()) == 0) {
|
||||
continue;
|
||||
}
|
||||
interpolatedFraction = animation.getInterpolatedFraction();
|
||||
|
||||
final int paddingBottom = (int) MathUtils.lerp(
|
||||
mInitialBounds.bottom - mFinalBounds.bottom, 0,
|
||||
animation.getInterpolatedFraction());
|
||||
interpolatedFraction);
|
||||
translationY += paddingBottom;
|
||||
}
|
||||
mSecurityViewFlipper.setTranslationY(translationY);
|
||||
mSecurityViewFlipper.animateForIme(translationY, interpolatedFraction);
|
||||
}
|
||||
return windowInsets;
|
||||
}
|
||||
@@ -141,7 +144,7 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
@Override
|
||||
public void onEnd(WindowInsetsAnimation animation) {
|
||||
if (!mDisappearAnimRunning) {
|
||||
mSecurityViewFlipper.setTranslationY(0);
|
||||
mSecurityViewFlipper.animateForIme(0, /* interpolatedFraction */ 1f);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -83,6 +83,16 @@ public class KeyguardSecurityViewFlipper extends ViewFlipper {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate the entire view, and optionally inform the wrapped view of the progress
|
||||
* so it can animate with the parent.
|
||||
*/
|
||||
public void animateForIme(int translationY, float interpolatedFraction) {
|
||||
super.setTranslationY(translationY);
|
||||
KeyguardInputView v = getSecurityView();
|
||||
if (v != null) v.animateForIme(interpolatedFraction);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
|
||||
return p instanceof LayoutParams;
|
||||
|
||||
@@ -451,10 +451,6 @@ public class KeyguardBouncer {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBackPressed() {
|
||||
return mKeyguardViewController != null && mKeyguardViewController.handleBackKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if and only if the security method should be shown before showing the
|
||||
* notifications on Keyguard, like SIM PIN/PUK.
|
||||
|
||||
Reference in New Issue
Block a user