Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81187100 authored by Chandru S's avatar Chandru S
Browse files

Update num pad button font and font scale animation to match spec

num pad button font: SMALL_EMPHASIZED
num pad button text scale x: 1.0 -> 1.35f (when pressed)

Bug: 394115355
Bug: 394134718
Test: verified manually
Flag: com.android.systemui.bouncer_ui_revamp_2
Change-Id: I26698aaea66b2cd7cfc9853d106d1c958ebbc02f
parent efeea629
Loading
Loading
Loading
Loading
+41 −4
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.keyguard;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
@@ -33,6 +34,9 @@ import com.android.systemui.Flags;
import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Animation;
import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Color;

import java.util.ArrayList;
import java.util.List;

/**
 * Provides background color and radius animations for key pad buttons.
 */
@@ -141,6 +145,7 @@ class NumPadAnimator {
        mExpandAnimator.addUpdateListener(
                anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue()));

        List<Animator> expandAnimators = new ArrayList<>();
        ValueAnimator expandBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(),
                mNormalBackgroundColor, mPressedBackgroundColor);
        expandBackgroundColorAnimator.setDuration(Animation.expansionColorDuration);
@@ -162,10 +167,27 @@ class NumPadAnimator {
            }
        });

        expandAnimators.add(mExpandAnimator);
        expandAnimators.add(expandBackgroundColorAnimator);
        expandAnimators.add(expandTextColorAnimator);

        if (Flags.bouncerUiRevamp2()) {
            ValueAnimator expandTextScaleAnimator = ValueAnimator.ofFloat(
                    Animation.normalTextScaleX, Animation.pressedTextScaleX);
            expandTextScaleAnimator.setInterpolator(Animation.expansionInterpolator);
            expandTextScaleAnimator.setDuration(Animation.expansionDuration);
            expandTextScaleAnimator.addUpdateListener(valueAnimator -> {
                if (mDigitTextView != null) {
                    mDigitTextView.setTextScaleX((Float) valueAnimator.getAnimatedValue());
                }
            });
            expandAnimators.add(expandTextScaleAnimator);
        }

        mExpandAnimatorSet = new AnimatorSet();
        mExpandAnimatorSet.playTogether(mExpandAnimator,
                expandBackgroundColorAnimator, expandTextColorAnimator);
        mExpandAnimatorSet.playTogether(expandAnimators);

        List<Animator> contractAnimators = new ArrayList<>();
        mContractAnimator = ValueAnimator.ofFloat(1f, 0f);
        mContractAnimator.setStartDelay(Animation.contractionStartDelay);
        mContractAnimator.setDuration(Animation.contractionDuration);
@@ -195,9 +217,24 @@ class NumPadAnimator {
            }
        });

        contractAnimators.add(mContractAnimator);
        contractAnimators.add(contractBackgroundColorAnimator);
        contractAnimators.add(contractTextColorAnimator);

        if (Flags.bouncerUiRevamp2()) {
            ValueAnimator contractTextScaleAnimator = ValueAnimator.ofFloat(
                    Animation.pressedTextScaleX, Animation.normalTextScaleX);
            contractTextScaleAnimator.setInterpolator(Animation.contractionRadiusInterpolator);
            contractTextScaleAnimator.setDuration(Animation.contractionDuration);
            contractTextScaleAnimator.addUpdateListener(valueAnimator -> {
                if (mDigitTextView != null) {
                    mDigitTextView.setTextScaleX((Float) valueAnimator.getAnimatedValue());
                }
            });
            contractAnimators.add(contractTextScaleAnimator);
        }
        mContractAnimatorSet = new AnimatorSet();
        mContractAnimatorSet.playTogether(mContractAnimator,
                contractBackgroundColorAnimator, contractTextColorAnimator);
        mContractAnimatorSet.playTogether(contractAnimators);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener {

        if (bouncerUiRevamp2()) {
            mDigitText.setTypeface(
                    Typeface.create(FontStyles.GSF_LABEL_LARGE_EMPHASIZED, Typeface.NORMAL));
                    Typeface.create(FontStyles.GSF_LABEL_SMALL_EMPHASIZED, Typeface.NORMAL));
        }
    }

+3 −0
Original line number Diff line number Diff line
@@ -126,5 +126,8 @@ object PinBouncerConstants {
        @JvmField
        val contractionColorInterpolator =
            c(old = Interpolators.LINEAR, new = Interpolators.STANDARD)!!

        const val pressedTextScaleX = 1.35f
        const val normalTextScaleX = 1.0f
    }
}