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

Commit aadf7baf authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Only animate clock weight if doze is animating

Test: manual
Fixes: 180574794
Change-Id: I055e1b7d2e3f0db9d4359bba5295f6ee8ae27502
parent d3035fe4
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
    private int mLockScreenColor;

    private boolean mIsDozing;
    private float mDozeAmount;
    private Locale mLocale;

    private final NumberFormat mBurmeseNf = NumberFormat.getInstance(Locale.forLanguageTag("my"));
@@ -59,6 +60,7 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
        super(view);
        mStatusBarStateController = statusBarStateController;
        mIsDozing = mStatusBarStateController.isDozing();
        mDozeAmount = mStatusBarStateController.getDozeAmount();
        mBroadcastDispatcher = broadcastDispatcher;

        mBurmeseNumerals = mBurmeseNf.format(FORMAT_NUMBER);
@@ -82,6 +84,7 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
                new IntentFilter(Intent.ACTION_LOCALE_CHANGED));
        mStatusBarStateController.addCallback(mStatusBarStateListener);
        mIsDozing = mStatusBarStateController.isDozing();
        mDozeAmount = mStatusBarStateController.getDozeAmount();
        refreshTime();
        initColors();
    }
@@ -136,9 +139,15 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
    private final StatusBarStateController.StateListener mStatusBarStateListener =
            new StatusBarStateController.StateListener() {
                @Override
                public void onDozingChanged(boolean isDozing) {
                public void onDozeAmountChanged(float linear, float eased) {
                    boolean noAnimation = (mDozeAmount == 0f && linear == 1f)
                            || (mDozeAmount == 1f && linear == 0f);
                    boolean isDozing = linear > mDozeAmount;
                    mDozeAmount = linear;
                    if (mIsDozing != isDozing) {
                        mIsDozing = isDozing;
                    mView.animateDoze(mIsDozing, true);
                        mView.animateDoze(mIsDozing, !noAnimation);
                    }
                }
            };
}