Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ComposedDigitalLayerController.kt +14 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) : val layerCfg = LayerConfig( style = FontTextStyle(lineHeight = 147.25f), timespec = DigitalTimespec.DIGIT_PAIR, alignment = DigitalAlignment(HorizontalAlignment.CENTER, VerticalAlignment.CENTER), aodStyle = FontTextStyle( Loading @@ -63,12 +62,23 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) : transitionDuration = 750, ), // Placeholder // Placeholders timespec = DigitalTimespec.TIME_FULL_FORMAT, dateTimeFormat = "hh:mm", ) createController(layerCfg.copy(dateTimeFormat = "hh")) createController(layerCfg.copy(dateTimeFormat = "mm")) createController( layerCfg.copy(timespec = DigitalTimespec.FIRST_DIGIT, dateTimeFormat = "hh") ) createController( layerCfg.copy(timespec = DigitalTimespec.SECOND_DIGIT, dateTimeFormat = "hh") ) createController( layerCfg.copy(timespec = DigitalTimespec.FIRST_DIGIT, dateTimeFormat = "mm") ) createController( layerCfg.copy(timespec = DigitalTimespec.SECOND_DIGIT, dateTimeFormat = "mm") ) } private fun refreshTime() { Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt +10 −5 Original line number Diff line number Diff line Loading @@ -124,8 +124,10 @@ class FlexClockView(clockCtx: ClockContext) : ViewGroup(clockCtx.context) { maxChildSize.y * AOD_VERTICAL_TRANSLATE_RATIO ) */ val xScale = if (childViews.size < 4) 1f else 2f val yBuffer = context.resources.getDimensionPixelSize(R.dimen.clock_vertical_digit_buffer) return (maxChildSize + aodTranslate.abs()) * VPointF(1f, 2f) + VPointF(0f, yBuffer) return (maxChildSize + aodTranslate.abs()) * VPointF(xScale, 2f) + VPointF(0f, yBuffer) } override fun onViewAdded(child: View?) { Loading Loading @@ -226,19 +228,22 @@ class FlexClockView(clockCtx: ClockContext) : ViewGroup(clockCtx.context) { when (child.id) { R.id.HOUR_FIRST_DIGIT -> VPointF.ZERO R.id.HOUR_SECOND_DIGIT -> VPointF(x, 0f) R.id.MINUTE_FIRST_DIGIT -> VPointF(0f, y + yBuffer) R.id.MINUTE_SECOND_DIGIT -> this R.id.HOUR_DIGIT_PAIR -> VPointF.ZERO // Add a small vertical buffer for the second digit pair // Add a small vertical buffer for second line views R.id.MINUTE_DIGIT_PAIR -> VPointF(0f, y + yBuffer) R.id.MINUTE_FIRST_DIGIT -> VPointF(0f, y + yBuffer) R.id.MINUTE_SECOND_DIGIT -> VPointF(x, y + yBuffer) else -> VPointF.ZERO } } val childSize = child.measuredSize offset += VPointF((measuredWidth - childSize.x) / 2f, 0f) offset += aodTranslate.abs() // Horizontal offset to center each view in the available space val midX = if (childViews.size < 4) measuredWidth / 2f else measuredWidth / 4f offset += VPointF(midX - childSize.x / 2f, 0f) val setPos = if (isLayout) child::layout else child::setLeftTopRightBottom setPos( offset.x.roundToInt(), Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt +0 −2 Original line number Diff line number Diff line Loading @@ -425,12 +425,10 @@ open class SimpleDigitalClockTextView( return VPointF( when { mode.x == EXACTLY -> MeasureSpec.getSize(widthMeasureSpec).toFloat() isSingleDigit() -> maxSingleDigitWidth else -> interpBounds.width() + 2 * lockScreenPaint.strokeWidth }, when { mode.y == EXACTLY -> MeasureSpec.getSize(heightMeasureSpec).toFloat() isSingleDigit() -> maxSingleDigitHeight else -> interpBounds.height() + 2 * lockScreenPaint.strokeWidth }, ) Loading Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ComposedDigitalLayerController.kt +14 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) : val layerCfg = LayerConfig( style = FontTextStyle(lineHeight = 147.25f), timespec = DigitalTimespec.DIGIT_PAIR, alignment = DigitalAlignment(HorizontalAlignment.CENTER, VerticalAlignment.CENTER), aodStyle = FontTextStyle( Loading @@ -63,12 +62,23 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) : transitionDuration = 750, ), // Placeholder // Placeholders timespec = DigitalTimespec.TIME_FULL_FORMAT, dateTimeFormat = "hh:mm", ) createController(layerCfg.copy(dateTimeFormat = "hh")) createController(layerCfg.copy(dateTimeFormat = "mm")) createController( layerCfg.copy(timespec = DigitalTimespec.FIRST_DIGIT, dateTimeFormat = "hh") ) createController( layerCfg.copy(timespec = DigitalTimespec.SECOND_DIGIT, dateTimeFormat = "hh") ) createController( layerCfg.copy(timespec = DigitalTimespec.FIRST_DIGIT, dateTimeFormat = "mm") ) createController( layerCfg.copy(timespec = DigitalTimespec.SECOND_DIGIT, dateTimeFormat = "mm") ) } private fun refreshTime() { Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt +10 −5 Original line number Diff line number Diff line Loading @@ -124,8 +124,10 @@ class FlexClockView(clockCtx: ClockContext) : ViewGroup(clockCtx.context) { maxChildSize.y * AOD_VERTICAL_TRANSLATE_RATIO ) */ val xScale = if (childViews.size < 4) 1f else 2f val yBuffer = context.resources.getDimensionPixelSize(R.dimen.clock_vertical_digit_buffer) return (maxChildSize + aodTranslate.abs()) * VPointF(1f, 2f) + VPointF(0f, yBuffer) return (maxChildSize + aodTranslate.abs()) * VPointF(xScale, 2f) + VPointF(0f, yBuffer) } override fun onViewAdded(child: View?) { Loading Loading @@ -226,19 +228,22 @@ class FlexClockView(clockCtx: ClockContext) : ViewGroup(clockCtx.context) { when (child.id) { R.id.HOUR_FIRST_DIGIT -> VPointF.ZERO R.id.HOUR_SECOND_DIGIT -> VPointF(x, 0f) R.id.MINUTE_FIRST_DIGIT -> VPointF(0f, y + yBuffer) R.id.MINUTE_SECOND_DIGIT -> this R.id.HOUR_DIGIT_PAIR -> VPointF.ZERO // Add a small vertical buffer for the second digit pair // Add a small vertical buffer for second line views R.id.MINUTE_DIGIT_PAIR -> VPointF(0f, y + yBuffer) R.id.MINUTE_FIRST_DIGIT -> VPointF(0f, y + yBuffer) R.id.MINUTE_SECOND_DIGIT -> VPointF(x, y + yBuffer) else -> VPointF.ZERO } } val childSize = child.measuredSize offset += VPointF((measuredWidth - childSize.x) / 2f, 0f) offset += aodTranslate.abs() // Horizontal offset to center each view in the available space val midX = if (childViews.size < 4) measuredWidth / 2f else measuredWidth / 4f offset += VPointF(midX - childSize.x / 2f, 0f) val setPos = if (isLayout) child::layout else child::setLeftTopRightBottom setPos( offset.x.roundToInt(), Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt +0 −2 Original line number Diff line number Diff line Loading @@ -425,12 +425,10 @@ open class SimpleDigitalClockTextView( return VPointF( when { mode.x == EXACTLY -> MeasureSpec.getSize(widthMeasureSpec).toFloat() isSingleDigit() -> maxSingleDigitWidth else -> interpBounds.width() + 2 * lockScreenPaint.strokeWidth }, when { mode.y == EXACTLY -> MeasureSpec.getSize(heightMeasureSpec).toFloat() isSingleDigit() -> maxSingleDigitHeight else -> interpBounds.height() + 2 * lockScreenPaint.strokeWidth }, ) Loading