From 842f001c601d27952cdd6bd47ed007039b146c86 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 13 Jul 2026 16:50:24 +0000 Subject: fix(widget): floor header text size/weight at NORMAL even when SMALL Headers (hour labels, section titles) shrinking along with content at the SMALL setting made them too small relative to content. Content still shrinks at SMALL; headers now stay at NORMAL's scale/weight regardless of the selected tier. --- .../src/main/java/org/terst/doot/widget/ui/WidgetTextSize.kt | 10 ++++++---- .../test/java/org/terst/doot/widget/ui/WidgetTextSizeTest.kt | 9 +++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'android/app') diff --git a/android/app/src/main/java/org/terst/doot/widget/ui/WidgetTextSize.kt b/android/app/src/main/java/org/terst/doot/widget/ui/WidgetTextSize.kt index e44b983..1e8ecab 100644 --- a/android/app/src/main/java/org/terst/doot/widget/ui/WidgetTextSize.kt +++ b/android/app/src/main/java/org/terst/doot/widget/ui/WidgetTextSize.kt @@ -5,9 +5,11 @@ import androidx.compose.ui.unit.sp import androidx.glance.text.FontWeight /** - * Header and content are independent knobs (currently seeded with the same - * numbers) so either can be retuned later without affecting the other. - * SMALL reproduces the widget's original, pre-setting appearance exactly. + * Header and content are independent knobs so either can be retuned without + * affecting the other. SMALL keeps content at the widget's original, + * pre-setting size -- but floors headers at NORMAL's scale/weight, since + * chrome text (hour labels, section titles) stays hard to read if it + * shrinks along with the content the user is deliberately shrinking. */ enum class WidgetTextSize( val headerScale: Float, @@ -15,7 +17,7 @@ enum class WidgetTextSize( val contentScale: Float, val contentWeightBump: Int ) { - SMALL(1.0f, 0, 1.0f, 0), + SMALL(1.15f, 1, 1.0f, 0), NORMAL(1.15f, 1, 1.15f, 1), LARGE(1.3f, 2, 1.3f, 2); diff --git a/android/app/src/test/java/org/terst/doot/widget/ui/WidgetTextSizeTest.kt b/android/app/src/test/java/org/terst/doot/widget/ui/WidgetTextSizeTest.kt index b0826b5..7f3bcfc 100644 --- a/android/app/src/test/java/org/terst/doot/widget/ui/WidgetTextSizeTest.kt +++ b/android/app/src/test/java/org/terst/doot/widget/ui/WidgetTextSizeTest.kt @@ -7,10 +7,15 @@ import org.junit.Test class WidgetTextSizeTest { @Test - fun `SMALL reproduces base size and weight unchanged`() { + fun `SMALL keeps content at base size and weight, unchanged`() { assertEquals(14f, WidgetTextSize.SMALL.scaledContentSize(14).value, 0.001f) assertEquals(FontWeight.Normal, WidgetTextSize.SMALL.scaledContentWeight(FontWeight.Normal)) - assertEquals(FontWeight.Bold, WidgetTextSize.SMALL.scaledHeaderWeight(FontWeight.Bold)) + } + + @Test + fun `SMALL floors headers at NORMAL's scale and weight`() { + assertEquals(WidgetTextSize.NORMAL.scaledHeaderSize(11).value, WidgetTextSize.SMALL.scaledHeaderSize(11).value, 0.001f) + assertEquals(FontWeight.Medium, WidgetTextSize.SMALL.scaledHeaderWeight(FontWeight.Normal)) } @Test -- cgit v1.2.3