Loading packages/SystemUI/src/com/android/keyguard/BouncerKeyguardMessageArea.kt +53 −1 Original line number Diff line number Diff line Loading @@ -16,19 +16,29 @@ package com.android.keyguard import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.AnimatorSet import android.animation.ObjectAnimator import android.content.Context import android.content.res.ColorStateList import android.content.res.TypedArray import android.graphics.Color import android.util.AttributeSet import android.view.View import com.android.settingslib.Utils import com.android.systemui.animation.Interpolators /** Displays security messages for the keyguard bouncer. */ class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) : open class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) : KeyguardMessageArea(context, attrs) { private val DEFAULT_COLOR = -1 private var mDefaultColorState: ColorStateList? = null private var mNextMessageColorState: ColorStateList? = ColorStateList.valueOf(DEFAULT_COLOR) private val animatorSet = AnimatorSet() private var textAboutToShow: CharSequence? = null protected open val SHOW_DURATION_MILLIS = 150L protected open val HIDE_DURATION_MILLIS = 200L override fun updateTextColor() { var colorState = mDefaultColorState Loading Loading @@ -58,4 +68,46 @@ class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) : mDefaultColorState = Utils.getColorAttr(context, android.R.attr.textColorPrimary) super.reloadColor() } override fun setMessage(msg: CharSequence?) { if (msg == textAboutToShow || msg == text) { return } textAboutToShow = msg if (animatorSet.isRunning) { animatorSet.cancel() textAboutToShow = null } val hideAnimator = ObjectAnimator.ofFloat(this, View.ALPHA, 1f, 0f).apply { duration = HIDE_DURATION_MILLIS interpolator = Interpolators.STANDARD_ACCELERATE } hideAnimator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator?) { super@BouncerKeyguardMessageArea.setMessage(msg) } } ) val showAnimator = ObjectAnimator.ofFloat(this, View.ALPHA, 0f, 1f).apply { duration = SHOW_DURATION_MILLIS interpolator = Interpolators.STANDARD_DECELERATE } showAnimator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator?) { textAboutToShow = null } } ) animatorSet.playSequentially(hideAnimator, showAnimator) animatorSet.start() } } packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java +6 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView> } public void startAppearAnimation() { mMessageAreaController.setMessage(getInitialMessageResId()); mView.startAppearAnimation(); } Loading @@ -169,6 +170,11 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView> return view.indexOfChild(mView); } /** Determines the message to show in the bouncer when it first appears. */ protected int getInitialMessageResId() { return 0; } /** Factory for a {@link KeyguardInputViewController}. */ public static class Factory { private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; Loading packages/SystemUI/src/com/android/keyguard/KeyguardMessageAreaController.java +0 −10 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.keyguard; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.text.TextUtils; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; Loading Loading @@ -100,15 +99,6 @@ public class KeyguardMessageAreaController<T extends KeyguardMessageArea> mView.setMessage(resId); } /** * Set Text if KeyguardMessageArea is empty. */ public void setMessageIfEmpty(int resId) { if (TextUtils.isEmpty(mView.getText())) { setMessage(resId); } } public void setNextMessageColor(ColorStateList colorState) { mView.setNextMessageColor(colorState); } Loading packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java +6 −2 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public class KeyguardPasswordViewController @Override void resetState() { mPasswordEntry.setTextOperationUser(UserHandle.of(KeyguardUpdateMonitor.getCurrentUser())); mMessageAreaController.setMessage(""); mMessageAreaController.setMessage(getInitialMessageResId()); final boolean wasDisabled = mPasswordEntry.isEnabled(); mView.setPasswordEntryEnabled(true); mView.setPasswordEntryInputEnabled(true); Loading @@ -207,7 +207,6 @@ public class KeyguardPasswordViewController if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { showInput(); } mMessageAreaController.setMessageIfEmpty(R.string.keyguard_enter_your_password); } private void showInput() { Loading Loading @@ -324,4 +323,9 @@ public class KeyguardPasswordViewController //enabled input method subtype (The current IME should be LatinIME.) || imm.getEnabledInputMethodSubtypeList(null, false).size() > 1; } @Override protected int getInitialMessageResId() { return R.string.keyguard_enter_your_password; } } packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java +6 −7 Original line number Diff line number Diff line Loading @@ -297,12 +297,6 @@ public class KeyguardPatternViewController displayDefaultSecurityMessage(); } @Override public void onResume(int reason) { super.onResume(reason); mMessageAreaController.setMessageIfEmpty(R.string.keyguard_enter_your_pattern); } @Override public boolean needsInput() { return false; Loading Loading @@ -361,7 +355,7 @@ public class KeyguardPatternViewController } private void displayDefaultSecurityMessage() { mMessageAreaController.setMessage(""); mMessageAreaController.setMessage(getInitialMessageResId()); } private void handleAttemptLockout(long elapsedRealtimeDeadline) { Loading Loading @@ -392,4 +386,9 @@ public class KeyguardPatternViewController }.start(); } @Override protected int getInitialMessageResId() { return R.string.keyguard_enter_your_pattern; } } Loading
packages/SystemUI/src/com/android/keyguard/BouncerKeyguardMessageArea.kt +53 −1 Original line number Diff line number Diff line Loading @@ -16,19 +16,29 @@ package com.android.keyguard import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.AnimatorSet import android.animation.ObjectAnimator import android.content.Context import android.content.res.ColorStateList import android.content.res.TypedArray import android.graphics.Color import android.util.AttributeSet import android.view.View import com.android.settingslib.Utils import com.android.systemui.animation.Interpolators /** Displays security messages for the keyguard bouncer. */ class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) : open class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) : KeyguardMessageArea(context, attrs) { private val DEFAULT_COLOR = -1 private var mDefaultColorState: ColorStateList? = null private var mNextMessageColorState: ColorStateList? = ColorStateList.valueOf(DEFAULT_COLOR) private val animatorSet = AnimatorSet() private var textAboutToShow: CharSequence? = null protected open val SHOW_DURATION_MILLIS = 150L protected open val HIDE_DURATION_MILLIS = 200L override fun updateTextColor() { var colorState = mDefaultColorState Loading Loading @@ -58,4 +68,46 @@ class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) : mDefaultColorState = Utils.getColorAttr(context, android.R.attr.textColorPrimary) super.reloadColor() } override fun setMessage(msg: CharSequence?) { if (msg == textAboutToShow || msg == text) { return } textAboutToShow = msg if (animatorSet.isRunning) { animatorSet.cancel() textAboutToShow = null } val hideAnimator = ObjectAnimator.ofFloat(this, View.ALPHA, 1f, 0f).apply { duration = HIDE_DURATION_MILLIS interpolator = Interpolators.STANDARD_ACCELERATE } hideAnimator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator?) { super@BouncerKeyguardMessageArea.setMessage(msg) } } ) val showAnimator = ObjectAnimator.ofFloat(this, View.ALPHA, 0f, 1f).apply { duration = SHOW_DURATION_MILLIS interpolator = Interpolators.STANDARD_DECELERATE } showAnimator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator?) { textAboutToShow = null } } ) animatorSet.playSequentially(hideAnimator, showAnimator) animatorSet.start() } }
packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java +6 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView> } public void startAppearAnimation() { mMessageAreaController.setMessage(getInitialMessageResId()); mView.startAppearAnimation(); } Loading @@ -169,6 +170,11 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView> return view.indexOfChild(mView); } /** Determines the message to show in the bouncer when it first appears. */ protected int getInitialMessageResId() { return 0; } /** Factory for a {@link KeyguardInputViewController}. */ public static class Factory { private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; Loading
packages/SystemUI/src/com/android/keyguard/KeyguardMessageAreaController.java +0 −10 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.keyguard; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.text.TextUtils; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; Loading Loading @@ -100,15 +99,6 @@ public class KeyguardMessageAreaController<T extends KeyguardMessageArea> mView.setMessage(resId); } /** * Set Text if KeyguardMessageArea is empty. */ public void setMessageIfEmpty(int resId) { if (TextUtils.isEmpty(mView.getText())) { setMessage(resId); } } public void setNextMessageColor(ColorStateList colorState) { mView.setNextMessageColor(colorState); } Loading
packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java +6 −2 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public class KeyguardPasswordViewController @Override void resetState() { mPasswordEntry.setTextOperationUser(UserHandle.of(KeyguardUpdateMonitor.getCurrentUser())); mMessageAreaController.setMessage(""); mMessageAreaController.setMessage(getInitialMessageResId()); final boolean wasDisabled = mPasswordEntry.isEnabled(); mView.setPasswordEntryEnabled(true); mView.setPasswordEntryInputEnabled(true); Loading @@ -207,7 +207,6 @@ public class KeyguardPasswordViewController if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { showInput(); } mMessageAreaController.setMessageIfEmpty(R.string.keyguard_enter_your_password); } private void showInput() { Loading Loading @@ -324,4 +323,9 @@ public class KeyguardPasswordViewController //enabled input method subtype (The current IME should be LatinIME.) || imm.getEnabledInputMethodSubtypeList(null, false).size() > 1; } @Override protected int getInitialMessageResId() { return R.string.keyguard_enter_your_password; } }
packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java +6 −7 Original line number Diff line number Diff line Loading @@ -297,12 +297,6 @@ public class KeyguardPatternViewController displayDefaultSecurityMessage(); } @Override public void onResume(int reason) { super.onResume(reason); mMessageAreaController.setMessageIfEmpty(R.string.keyguard_enter_your_pattern); } @Override public boolean needsInput() { return false; Loading Loading @@ -361,7 +355,7 @@ public class KeyguardPatternViewController } private void displayDefaultSecurityMessage() { mMessageAreaController.setMessage(""); mMessageAreaController.setMessage(getInitialMessageResId()); } private void handleAttemptLockout(long elapsedRealtimeDeadline) { Loading Loading @@ -392,4 +386,9 @@ public class KeyguardPatternViewController }.start(); } @Override protected int getInitialMessageResId() { return R.string.keyguard_enter_your_pattern; } }