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

Commit 79e7e4b7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "AOD - Large clock"

parents 71cb3e0e 217dba4c
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -82,6 +82,28 @@
            android:elegantTextHeight="false"
        />
    </FrameLayout>
    <FrameLayout
        android:id="@+id/new_lockscreen_clock_view_large"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/keyguard_status_area"
        android:paddingTop="20dp"
        android:visibility="gone">
        <com.android.keyguard.AnimatableClockView
            android:id="@+id/animatable_clock_view_large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:gravity="center_horizontal"
            android:textSize="170dp"
            android:letterSpacing="0.02"
            android:lineSpacingMultiplier=".8"
            android:includeFontPadding="false"
            android:fontFamily="@font/clock"
            android:typeface="monospace"
            android:elegantTextHeight="false"
        />
    </FrameLayout>
    <include layout="@layout/keyguard_status_area"
        android:id="@+id/keyguard_status_area"
        android:layout_width="match_parent"
+31 −2
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
     * Frame for clock when mode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL.
     */
    private FrameLayout mNewLockscreenClockFrame;
    private FrameLayout mNewLockscreenLargeClockFrame;

    /**
     * Frame for default and custom clock.
@@ -154,14 +155,12 @@ public class KeyguardClockSwitch extends RelativeLayout {
            mNewLockscreenClockFrame.setVisibility(VISIBLE);

            statusAreaLP.removeRule(RelativeLayout.BELOW);
            statusAreaLP.addRule(RelativeLayout.LEFT_OF, R.id.new_lockscreen_clock_view);
            statusAreaLP.addRule(RelativeLayout.ALIGN_PARENT_START);
        } else {
            setPaddingRelative(0, 0, 0, 0);
            mSmallClockFrame.setVisibility(VISIBLE);
            mNewLockscreenClockFrame.setVisibility(GONE);

            statusAreaLP.removeRule(RelativeLayout.LEFT_OF);
            statusAreaLP.removeRule(RelativeLayout.ALIGN_PARENT_START);
            statusAreaLP.addRule(RelativeLayout.BELOW, R.id.clock_view);
        }
@@ -175,6 +174,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
        mClockView = findViewById(R.id.default_clock_view);
        mClockViewBold = findViewById(R.id.default_clock_view_bold);
        mNewLockscreenClockFrame = findViewById(R.id.new_lockscreen_clock_view);
        mNewLockscreenLargeClockFrame = findViewById(R.id.new_lockscreen_clock_view_large);
        mSmallClockFrame = findViewById(R.id.clock_view);
        mKeyguardStatusArea = findViewById(R.id.keyguard_status_area);
    }
@@ -292,6 +292,33 @@ public class KeyguardClockSwitch extends RelativeLayout {
        mClockViewBold.setFormat24Hour(format);
    }

    private void updateClockLayout(boolean useLargeClock) {
        if (mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) return;

        Fade fadeIn = new Fade();
        fadeIn.setDuration(KeyguardSliceView.DEFAULT_ANIM_DURATION);
        fadeIn.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);

        Fade fadeOut = new Fade();
        fadeOut.setDuration(KeyguardSliceView.DEFAULT_ANIM_DURATION / 2);
        fadeOut.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN);

        if (useLargeClock) {
            TransitionManager.beginDelayedTransition(mNewLockscreenClockFrame, fadeOut);
            TransitionManager.beginDelayedTransition(mNewLockscreenLargeClockFrame, fadeIn);

            mNewLockscreenClockFrame.setVisibility(View.INVISIBLE);
            addView(mNewLockscreenLargeClockFrame);
            mNewLockscreenLargeClockFrame.setVisibility(View.VISIBLE);
        } else {
            TransitionManager.beginDelayedTransition(mNewLockscreenClockFrame, fadeIn);
            TransitionManager.beginDelayedTransition(mNewLockscreenLargeClockFrame, fadeOut);

            removeView(mNewLockscreenLargeClockFrame);
            mNewLockscreenClockFrame.setVisibility(View.VISIBLE);
        }
    }

    /**
     * Set the amount (ratio) that the device has transitioned to doze.
     *
@@ -312,6 +339,8 @@ public class KeyguardClockSwitch extends RelativeLayout {
        if (hasVisibleNotifications == mHasVisibleNotifications) {
            return;
        }
        updateClockLayout(!hasVisibleNotifications);

        mHasVisibleNotifications = hasVisibleNotifications;
        if (mDarkAmount == 0f && mBigClockContainer != null) {
            // Starting a fade transition since the visibility of the big clock will change.
+8 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
     */
    private AnimatableClockController mNewLockScreenClockViewController;
    private FrameLayout mNewLockScreenClockFrame;
    private AnimatableClockController mNewLockScreenLargeClockViewController;

    private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL;

@@ -189,6 +190,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
    void refresh() {
        if (mNewLockScreenClockViewController != null) {
            mNewLockScreenClockViewController.refreshTime();
            mNewLockScreenLargeClockViewController.refreshTime();
        }

        mView.refresh();
@@ -221,9 +223,15 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
                                mView.findViewById(R.id.animatable_clock_view),
                                mStatusBarStateController);
                mNewLockScreenClockViewController.init();
                mNewLockScreenLargeClockViewController =
                        new AnimatableClockController(
                                mView.findViewById(R.id.animatable_clock_view_large),
                                mStatusBarStateController);
                mNewLockScreenLargeClockViewController.init();
            }
        } else {
            mNewLockScreenClockViewController = null;
            mNewLockScreenLargeClockViewController = null;
        }
        mView.updateLockScreenMode(mLockScreenMode);
        updateAodIcons();