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

Commit 04aeeebc authored by Matt Pietal's avatar Matt Pietal
Browse files

Clock and padding updates

Single line clock for the small clock only. Align padding to specs

Bug: 172360102
Test: manual
Change-Id: I2d1a3f20f23886166a67ca40bf6d8e703eff3298
parent 4cdcf412
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -77,8 +77,9 @@
            android:fontFamily="@font/clock"
            android:typeface="monospace"
            android:elegantTextHeight="false"
            android:singleLine="true"
            dozeWeight="200"
            lockScreenWeight="300"
            lockScreenWeight="400"
        />
    </FrameLayout>
    <FrameLayout
@@ -109,8 +110,6 @@

    <com.android.systemui.statusbar.phone.NotificationIconContainer
        android:id="@+id/left_aligned_notification_icon_container"
        android:paddingStart="16dp"
        android:paddingEnd="16dp"
        android:layout_width="match_parent"
        android:layout_height="@dimen/notification_shelf_height"
        android:layout_marginTop="@dimen/widget_vertical_padding"
+0 −2
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@
<!-- This is a view that shows general status information in Keyguard. -->
<com.android.keyguard.KeyguardSliceView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:paddingStart="16dp"
    android:paddingEnd="16dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
+25 −3
Original line number Diff line number Diff line
@@ -38,8 +38,10 @@ import kotlin.Unit;
 * The time's text color is a gradient that changes its colors based on its controller.
 */
public class AnimatableClockView extends TextView {
    private static final CharSequence FORMAT_12_HOUR = "hh\nmm";
    private static final CharSequence FORMAT_24_HOUR = "HH\nmm";
    private static final CharSequence DOUBLE_LINE_FORMAT_12_HOUR = "hh\nmm";
    private static final CharSequence DOUBLE_LINE_FORMAT_24_HOUR = "HH\nmm";
    private static final CharSequence SINGLE_LINE_FORMAT_12_HOUR = "h:mm";
    private static final CharSequence SINGLE_LINE_FORMAT_24_HOUR = "H:mm";
    private static final long ANIM_DURATION = 300;

    private final Calendar mTime = Calendar.getInstance();
@@ -55,6 +57,8 @@ public class AnimatableClockView extends TextView {
    private TextAnimator mTextAnimator = null;
    private Runnable mOnTextAnimatorInitialized;

    private boolean mIsSingleLine;

    public AnimatableClockView(Context context) {
        this(context, null, 0, 0);
    }
@@ -78,6 +82,15 @@ public class AnimatableClockView extends TextView {
        } finally {
            ta.recycle();
        }

        ta = context.obtainStyledAttributes(
                attrs, android.R.styleable.TextView, defStyleAttr, defStyleRes);
        try {
            mIsSingleLine = ta.getBoolean(android.R.styleable.TextView_singleLine, false);
        } finally {
            ta.recycle();
        }

        refreshFormat();
    }

@@ -171,7 +184,16 @@ public class AnimatableClockView extends TextView {

    void refreshFormat() {
        final boolean use24HourFormat = DateFormat.is24HourFormat(getContext());
        mFormat =  use24HourFormat ? FORMAT_24_HOUR : FORMAT_12_HOUR;
        if (mIsSingleLine && use24HourFormat) {
            mFormat = SINGLE_LINE_FORMAT_24_HOUR;
        } else if (!mIsSingleLine && use24HourFormat) {
            mFormat = DOUBLE_LINE_FORMAT_24_HOUR;
        } else if (mIsSingleLine && !use24HourFormat) {
            mFormat = SINGLE_LINE_FORMAT_12_HOUR;
        } else {
            mFormat = DOUBLE_LINE_FORMAT_12_HOUR;
        }

        mDescFormat = getBestDateTimePattern(getContext(), use24HourFormat ? "Hm" : "hm");
        refreshTime();
    }
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
        if (mode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) {
            final int startEndPadding = (int) TypedValue.applyDimension(
                    TypedValue.COMPLEX_UNIT_DIP,
                    12,
                    32,
                    getResources().getDisplayMetrics());
            setPaddingRelative(startEndPadding, 0, startEndPadding, 0);
            mSmallClockFrame.setVisibility(GONE);