diff options
| author | 2025-01-28 21:17:32 +0000 | |
|---|---|---|
| committer | 2025-01-29 23:28:19 +0000 | |
| commit | 8f7be9ef332523bd133f2ea9fcb63bece8baf1df (patch) | |
| tree | 90e737a378043a25f1c95eeb1f0322db25928632 | |
| parent | c896855ced8b89c829b11b184b1568ad08bb3228 (diff) | |
Update aodFontVariation to be modified version of user set axes
Adjust width axes for better glyph positioning on LS/AOD
Bug: 392968587
Test: Checked aod rendering
Flag: com.android.systemui.shared.clock_reactive_variants
Change-Id: I245f6c57f92df368f8e51bb658c377a93156d8a1
3 files changed, 29 insertions, 22 deletions
diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt index cc3769e0a568..64deed46fe48 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt @@ -135,7 +135,7 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController key = GSFAxes.WIDTH, type = AxisType.Float, minValue = 25f, - currentValue = 100f, + currentValue = 85f, maxValue = 151f, name = "Width", description = "Glyph Width", diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt index db39162205b2..fbfda72896c2 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt @@ -69,8 +69,8 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe lateinit var textStyle: FontTextStyle lateinit var aodStyle: FontTextStyle - private var lsFontVariation = ClockFontAxisSetting.toFVar(DEFAULT_LS_VARIATION) - private var aodFontVariation = ClockFontAxisSetting.toFVar(DEFAULT_AOD_VARIATION) + private var lsFontVariation = ClockFontAxisSetting.toFVar(DEFAULT_LS_AXES) + private var aodFontVariation = ClockFontAxisSetting.toFVar(DEFAULT_AOD_AXES) private val parser = DimensionParser(clockCtx.context) var maxSingleDigitHeight = -1 var maxSingleDigitWidth = -1 @@ -129,8 +129,15 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe invalidate() } - fun updateAxes(axes: List<ClockFontAxisSetting>) { - lsFontVariation = ClockFontAxisSetting.toFVar(axes + OPTICAL_SIZE_AXIS) + fun updateAxes(lsAxes: List<ClockFontAxisSetting>) { + val aodAxes = ClockFontAxisSetting.replace(lsAxes, AOD_FIXED_AXES) + lsFontVariation = ClockFontAxisSetting.toFVar(lsAxes) + aodFontVariation = ClockFontAxisSetting.toFVar(aodAxes) + logger.i({ "updateAxes(LS = $str1, AOD = $str2)" }) { + str1 = lsFontVariation + str2 = aodFontVariation + } + lockScreenPaint.typeface = typefaceCache.getTypefaceForVariant(lsFontVariation) typeface = lockScreenPaint.typeface @@ -501,22 +508,14 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe Paint().also { it.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OUT) } val AOD_COLOR = Color.WHITE - val OPTICAL_SIZE_AXIS = ClockFontAxisSetting(GSFAxes.OPTICAL_SIZE, 144f) - val DEFAULT_LS_VARIATION = - listOf( - OPTICAL_SIZE_AXIS, - ClockFontAxisSetting(GSFAxes.WEIGHT, 400f), - ClockFontAxisSetting(GSFAxes.WIDTH, 100f), - ClockFontAxisSetting(GSFAxes.ROUND, 0f), - ClockFontAxisSetting(GSFAxes.SLANT, 0f), - ) - val DEFAULT_AOD_VARIATION = - listOf( - OPTICAL_SIZE_AXIS, - ClockFontAxisSetting(GSFAxes.WEIGHT, 200f), - ClockFontAxisSetting(GSFAxes.WIDTH, 100f), - ClockFontAxisSetting(GSFAxes.ROUND, 0f), - ClockFontAxisSetting(GSFAxes.SLANT, 0f), - ) + val LS_WEIGHT_AXIS = ClockFontAxisSetting(GSFAxes.WEIGHT, 400f) + val AOD_WEIGHT_AXIS = ClockFontAxisSetting(GSFAxes.WEIGHT, 200f) + val WIDTH_AXIS = ClockFontAxisSetting(GSFAxes.WIDTH, 85f) + val ROUND_AXIS = ClockFontAxisSetting(GSFAxes.ROUND, 0f) + val SLANT_AXIS = ClockFontAxisSetting(GSFAxes.SLANT, 0f) + + val DEFAULT_LS_AXES = listOf(LS_WEIGHT_AXIS, WIDTH_AXIS, ROUND_AXIS, SLANT_AXIS) + val AOD_FIXED_AXES = listOf(AOD_WEIGHT_AXIS, WIDTH_AXIS) + val DEFAULT_AOD_AXES = AOD_FIXED_AXES + listOf(ROUND_AXIS, SLANT_AXIS) } } diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockSettings.kt b/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockSettings.kt index 6128c00f3843..970af71b9f9d 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockSettings.kt +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockSettings.kt @@ -106,5 +106,13 @@ data class ClockFontAxisSetting( } return sb.toString() } + + fun replace( + list: List<ClockFontAxisSetting>, + replacements: List<ClockFontAxisSetting>, + ): List<ClockFontAxisSetting> { + var remaining = list.filterNot { lhs -> replacements.any { rhs -> lhs.key == rhs.key } } + return remaining + replacements + } } } |