Merge "Clock and padding updates" into sc-dev

This commit is contained in:
Matt Pietal
2021-03-18 18:07:30 +00:00
committed by Android (Google) Code Review
4 changed files with 28 additions and 9 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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();
}

View File

@@ -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);