Loading packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java +16 −21 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import android.widget.TextView; import androidx.annotation.StyleRes; import com.android.app.animation.Interpolators; import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Animation; /** * Provides background color and radius animations for key pad buttons. Loading @@ -58,11 +58,6 @@ class NumPadAnimator { private int mHeight; private int mWidth; private static final int EXPAND_ANIMATION_MS = 100; private static final int EXPAND_COLOR_ANIMATION_MS = 50; private static final int CONTRACT_ANIMATION_DELAY_MS = 33; private static final int CONTRACT_ANIMATION_MS = 417; NumPadAnimator(Context context, final Drawable drawable, @StyleRes int style, Drawable buttonImage) { this(context, drawable, style, null, buttonImage); Loading Loading @@ -143,23 +138,23 @@ class NumPadAnimator { private void createAnimators() { // Actual values will be updated later, usually during an onLayout() call mExpandAnimator = ValueAnimator.ofFloat(0f, 1f); mExpandAnimator.setDuration(EXPAND_ANIMATION_MS); mExpandAnimator.setInterpolator(Interpolators.LINEAR); mExpandAnimator.setDuration(Animation.expansionDuration); mExpandAnimator.setInterpolator(Animation.expansionInterpolator); mExpandAnimator.addUpdateListener( anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue())); ValueAnimator expandBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mNormalBackgroundColor, mPressedBackgroundColor); expandBackgroundColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS); expandBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR); expandBackgroundColorAnimator.setDuration(Animation.expansionColorDuration); expandBackgroundColorAnimator.setInterpolator(Animation.expansionInterpolator); expandBackgroundColorAnimator.addUpdateListener( animator -> mBackground.setColor((int) animator.getAnimatedValue())); ValueAnimator expandTextColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mTextColorPrimary, mTextColorPressed); expandTextColorAnimator.setInterpolator(Interpolators.LINEAR); expandTextColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS); expandTextColorAnimator.setInterpolator(Animation.expansionInterpolator); expandTextColorAnimator.setDuration(Animation.expansionColorDuration); expandTextColorAnimator.addUpdateListener(valueAnimator -> { if (mDigitTextView != null) { mDigitTextView.setTextColor((int) valueAnimator.getAnimatedValue()); Loading @@ -174,25 +169,25 @@ class NumPadAnimator { expandBackgroundColorAnimator, expandTextColorAnimator); mContractAnimator = ValueAnimator.ofFloat(1f, 0f); mContractAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); mContractAnimator.setDuration(CONTRACT_ANIMATION_MS); mContractAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); mContractAnimator.setStartDelay(Animation.contractionStartDelay); mContractAnimator.setDuration(Animation.contractionDuration); mContractAnimator.setInterpolator(Animation.contractionRadiusInterpolator); mContractAnimator.addUpdateListener( anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue())); ValueAnimator contractBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mPressedBackgroundColor, mNormalBackgroundColor); contractBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR); contractBackgroundColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); contractBackgroundColorAnimator.setDuration(CONTRACT_ANIMATION_MS); contractBackgroundColorAnimator.setInterpolator(Animation.contractionColorInterpolator); contractBackgroundColorAnimator.setStartDelay(Animation.contractionStartDelay); contractBackgroundColorAnimator.setDuration(Animation.contractionDuration); contractBackgroundColorAnimator.addUpdateListener( animator -> mBackground.setColor((int) animator.getAnimatedValue())); ValueAnimator contractTextColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mTextColorPressed, mTextColorPrimary); contractTextColorAnimator.setInterpolator(Interpolators.LINEAR); contractTextColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); contractTextColorAnimator.setDuration(CONTRACT_ANIMATION_MS); contractTextColorAnimator.setInterpolator(Animation.contractionColorInterpolator); contractTextColorAnimator.setStartDelay(Animation.contractionStartDelay); contractTextColorAnimator.setDuration(Animation.contractionDuration); contractTextColorAnimator.addUpdateListener(valueAnimator -> { if (mDigitTextView != null) { mDigitTextView.setTextColor((int) valueAnimator.getAnimatedValue()); Loading packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt +26 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.systemui.bouncer.shared.constants import com.android.app.animation.Interpolators import com.android.internal.R.color as colors import com.android.systemui.Flags object KeyguardBouncerConstants { /** Loading Loading @@ -66,9 +68,33 @@ object KeyguardBouncerConstants { } } private fun <T> c(old: T, new: T): T { return if (Flags.bouncerUiRevamp2()) { new } else { old } } object PinBouncerConstants { object Color { @JvmField val hintDot = colors.materialColorOnSurfaceVariant @JvmField val shape = colors.materialColorPrimary } object Animation { @JvmField val expansionDuration = c(old = 100, new = 33) @JvmField val expansionColorDuration = c(old = 50, new = expansionDuration) @JvmField val expansionInterpolator = c(old = Interpolators.LINEAR, new = Interpolators.LINEAR)!! @JvmField val contractionDuration = c(old = 417, new = 300) @JvmField val contractionStartDelay = c(old = 33, new = 0) @JvmField val contractionRadiusInterpolator = c(old = Interpolators.FAST_OUT_SLOW_IN, new = Interpolators.STANDARD)!! @JvmField val contractionColorInterpolator = c(old = Interpolators.LINEAR, new = Interpolators.STANDARD)!! } } Loading
packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java +16 −21 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import android.widget.TextView; import androidx.annotation.StyleRes; import com.android.app.animation.Interpolators; import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Animation; /** * Provides background color and radius animations for key pad buttons. Loading @@ -58,11 +58,6 @@ class NumPadAnimator { private int mHeight; private int mWidth; private static final int EXPAND_ANIMATION_MS = 100; private static final int EXPAND_COLOR_ANIMATION_MS = 50; private static final int CONTRACT_ANIMATION_DELAY_MS = 33; private static final int CONTRACT_ANIMATION_MS = 417; NumPadAnimator(Context context, final Drawable drawable, @StyleRes int style, Drawable buttonImage) { this(context, drawable, style, null, buttonImage); Loading Loading @@ -143,23 +138,23 @@ class NumPadAnimator { private void createAnimators() { // Actual values will be updated later, usually during an onLayout() call mExpandAnimator = ValueAnimator.ofFloat(0f, 1f); mExpandAnimator.setDuration(EXPAND_ANIMATION_MS); mExpandAnimator.setInterpolator(Interpolators.LINEAR); mExpandAnimator.setDuration(Animation.expansionDuration); mExpandAnimator.setInterpolator(Animation.expansionInterpolator); mExpandAnimator.addUpdateListener( anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue())); ValueAnimator expandBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mNormalBackgroundColor, mPressedBackgroundColor); expandBackgroundColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS); expandBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR); expandBackgroundColorAnimator.setDuration(Animation.expansionColorDuration); expandBackgroundColorAnimator.setInterpolator(Animation.expansionInterpolator); expandBackgroundColorAnimator.addUpdateListener( animator -> mBackground.setColor((int) animator.getAnimatedValue())); ValueAnimator expandTextColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mTextColorPrimary, mTextColorPressed); expandTextColorAnimator.setInterpolator(Interpolators.LINEAR); expandTextColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS); expandTextColorAnimator.setInterpolator(Animation.expansionInterpolator); expandTextColorAnimator.setDuration(Animation.expansionColorDuration); expandTextColorAnimator.addUpdateListener(valueAnimator -> { if (mDigitTextView != null) { mDigitTextView.setTextColor((int) valueAnimator.getAnimatedValue()); Loading @@ -174,25 +169,25 @@ class NumPadAnimator { expandBackgroundColorAnimator, expandTextColorAnimator); mContractAnimator = ValueAnimator.ofFloat(1f, 0f); mContractAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); mContractAnimator.setDuration(CONTRACT_ANIMATION_MS); mContractAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); mContractAnimator.setStartDelay(Animation.contractionStartDelay); mContractAnimator.setDuration(Animation.contractionDuration); mContractAnimator.setInterpolator(Animation.contractionRadiusInterpolator); mContractAnimator.addUpdateListener( anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue())); ValueAnimator contractBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mPressedBackgroundColor, mNormalBackgroundColor); contractBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR); contractBackgroundColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); contractBackgroundColorAnimator.setDuration(CONTRACT_ANIMATION_MS); contractBackgroundColorAnimator.setInterpolator(Animation.contractionColorInterpolator); contractBackgroundColorAnimator.setStartDelay(Animation.contractionStartDelay); contractBackgroundColorAnimator.setDuration(Animation.contractionDuration); contractBackgroundColorAnimator.addUpdateListener( animator -> mBackground.setColor((int) animator.getAnimatedValue())); ValueAnimator contractTextColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mTextColorPressed, mTextColorPrimary); contractTextColorAnimator.setInterpolator(Interpolators.LINEAR); contractTextColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS); contractTextColorAnimator.setDuration(CONTRACT_ANIMATION_MS); contractTextColorAnimator.setInterpolator(Animation.contractionColorInterpolator); contractTextColorAnimator.setStartDelay(Animation.contractionStartDelay); contractTextColorAnimator.setDuration(Animation.contractionDuration); contractTextColorAnimator.addUpdateListener(valueAnimator -> { if (mDigitTextView != null) { mDigitTextView.setTextColor((int) valueAnimator.getAnimatedValue()); Loading
packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt +26 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.systemui.bouncer.shared.constants import com.android.app.animation.Interpolators import com.android.internal.R.color as colors import com.android.systemui.Flags object KeyguardBouncerConstants { /** Loading Loading @@ -66,9 +68,33 @@ object KeyguardBouncerConstants { } } private fun <T> c(old: T, new: T): T { return if (Flags.bouncerUiRevamp2()) { new } else { old } } object PinBouncerConstants { object Color { @JvmField val hintDot = colors.materialColorOnSurfaceVariant @JvmField val shape = colors.materialColorPrimary } object Animation { @JvmField val expansionDuration = c(old = 100, new = 33) @JvmField val expansionColorDuration = c(old = 50, new = expansionDuration) @JvmField val expansionInterpolator = c(old = Interpolators.LINEAR, new = Interpolators.LINEAR)!! @JvmField val contractionDuration = c(old = 417, new = 300) @JvmField val contractionStartDelay = c(old = 33, new = 0) @JvmField val contractionRadiusInterpolator = c(old = Interpolators.FAST_OUT_SLOW_IN, new = Interpolators.STANDARD)!! @JvmField val contractionColorInterpolator = c(old = Interpolators.LINEAR, new = Interpolators.STANDARD)!! } }