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

Commit df3a54e1 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Only animate clock weight if doze is animating" into sc-dev

parents 92bff6ee aadf7baf
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
    private int mLockScreenColor;
    private int mLockScreenColor;


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


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


        mBurmeseNumerals = mBurmeseNf.format(FORMAT_NUMBER);
        mBurmeseNumerals = mBurmeseNf.format(FORMAT_NUMBER);
@@ -82,6 +84,7 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
                new IntentFilter(Intent.ACTION_LOCALE_CHANGED));
                new IntentFilter(Intent.ACTION_LOCALE_CHANGED));
        mStatusBarStateController.addCallback(mStatusBarStateListener);
        mStatusBarStateController.addCallback(mStatusBarStateListener);
        mIsDozing = mStatusBarStateController.isDozing();
        mIsDozing = mStatusBarStateController.isDozing();
        mDozeAmount = mStatusBarStateController.getDozeAmount();
        refreshTime();
        refreshTime();
        initColors();
        initColors();
    }
    }
@@ -136,9 +139,15 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
    private final StatusBarStateController.StateListener mStatusBarStateListener =
    private final StatusBarStateController.StateListener mStatusBarStateListener =
            new StatusBarStateController.StateListener() {
            new StatusBarStateController.StateListener() {
                @Override
                @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;
                        mIsDozing = isDozing;
                    mView.animateDoze(mIsDozing, true);
                        mView.animateDoze(mIsDozing, !noAnimation);
                    }
                }
                }
            };
            };
}
}