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

Commit 267836b3 authored by Shan Huang's avatar Shan Huang Committed by Automerger Merge Worker
Browse files

Merge "Fix clock font weight animation to always match the latest doze state."...

Merge "Fix clock font weight animation to always match the latest doze state." into sc-dev am: be9f6e9b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15135534

Change-Id: I8c3ea1e26c025c2780619ddf90f49b178baf1ea9
parents 9b685c9e be9f6e9b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -94,7 +94,9 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
        @Override
        public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
            if (mKeyguardShowing && !mIsCharging && charging) {
                mView.animateCharge(mIsDozing);
                mView.animateCharge(() -> {
                    return mStatusBarStateController.isDozing();
                });
            }
            mIsCharging = charging;
        }
+7 −3
Original line number Diff line number Diff line
@@ -196,20 +196,20 @@ public class AnimatableClockView extends TextView {
                null /* onAnimationEnd */);
    }

    void animateCharge(boolean isDozing) {
    void animateCharge(DozeStateGetter dozeStateGetter) {
        if (mTextAnimator == null || mTextAnimator.isRunning()) {
            // Skip charge animation if dozing animation is already playing.
            return;
        }
        Runnable startAnimPhase2 = () -> setTextStyle(
                isDozing ? mDozingWeight : mLockScreenWeight/* weight */,
                dozeStateGetter.isDozing() ? mDozingWeight : mLockScreenWeight/* weight */,
                -1,
                null,
                true /* animate */,
                CHARGE_ANIM_DURATION_PHASE_1,
                0 /* delay */,
                null /* onAnimationEnd */);
        setTextStyle(isDozing ? mLockScreenWeight : mDozingWeight/* weight */,
        setTextStyle(dozeStateGetter.isDozing() ? mLockScreenWeight : mDozingWeight/* weight */,
                -1,
                null,
                true /* animate */,
@@ -279,4 +279,8 @@ public class AnimatableClockView extends TextView {
                context.getResources().getConfiguration().locale);
        return dtpg.getBestPattern(skeleton);
    }

    interface DozeStateGetter {
        boolean isDozing();
    }
}