@@ -37,6 +37,7 @@ import com.example.util.simpletimetracker.presentation.ui.ACTIVITY_RUNNING_VIEW_
3737import com.example.util.simpletimetracker.presentation.ui.ErrorState
3838import com.example.util.simpletimetracker.presentation.ui.RenderLoading
3939import com.example.util.simpletimetracker.presentation.ui.renderError
40+ import com.example.util.simpletimetracker.utils.getCoercedFontScale
4041import com.example.util.simpletimetracker.utils.getString
4142import java.util.UUID
4243
@@ -75,7 +76,6 @@ fun StatisticsList(
7576 onPrevClick : () -> Unit = {},
7677 onNextClick : () -> Unit = {},
7778) {
78- val density = LocalDensity .current
7979 Box {
8080 ScaffoldedScrollingColumn {
8181 when (state) {
@@ -91,15 +91,13 @@ fun StatisticsList(
9191 is StatisticsListState .Empty -> {
9292 renderEmptyState(
9393 state = state,
94- density = density,
9594 onTitleClick = onTitleClick,
9695 onTitleLongClick = onTitleLongClick,
9796 )
9897 }
9998 is StatisticsListState .Content -> {
10099 renderContent(
101100 state = state,
102- density = density,
103101 onTitleClick = onTitleClick,
104102 onTitleLongClick = onTitleLongClick,
105103 )
@@ -120,7 +118,6 @@ fun StatisticsList(
120118
121119private fun ScalingLazyListScope.renderEmptyState (
122120 state : StatisticsListState .Empty ,
123- density : Density ,
124121 onTitleClick : () -> Unit ,
125122 onTitleLongClick : () -> Unit ,
126123) {
@@ -133,7 +130,7 @@ private fun ScalingLazyListScope.renderEmptyState(
133130 }
134131 item {
135132 val height = ACTIVITY_RUNNING_VIEW_HEIGHT *
136- density.fontScale
133+ getCoercedFontScale()
137134 Box (
138135 modifier = Modifier .height(height.dp),
139136 contentAlignment = Alignment .Center ,
@@ -148,7 +145,6 @@ private fun ScalingLazyListScope.renderEmptyState(
148145
149146private fun ScalingLazyListScope.renderContent (
150147 state : StatisticsListState .Content ,
151- density : Density ,
152148 onTitleClick : () -> Unit ,
153149 onTitleLongClick : () -> Unit ,
154150) {
@@ -162,9 +158,9 @@ private fun ScalingLazyListScope.renderContent(
162158 for (itemState in state.items) {
163159 when (itemState) {
164160 is StatisticsListState .Content .Item .Loader -> {
165- val height = ACTIVITY_RUNNING_VIEW_HEIGHT *
166- density.fontScale
167161 item {
162+ val height = ACTIVITY_RUNNING_VIEW_HEIGHT *
163+ getCoercedFontScale()
168164 Box (
169165 modifier = Modifier .height(height.dp),
170166 contentAlignment = Alignment .Center ,
@@ -222,7 +218,7 @@ private fun BoxScope.StatisticsButtons(
222218 }
223219}
224220
225- @Preview(device = WearDevices .LARGE_ROUND )
221+ @Preview(device = WearDevices .LARGE_ROUND , fontScale = 1f )
226222@Composable
227223private fun Loading () {
228224 StatisticsList (
@@ -240,7 +236,7 @@ private fun Error() {
240236 )
241237}
242238
243- @Preview(device = WearDevices .LARGE_ROUND )
239+ @Preview(device = WearDevices .LARGE_ROUND , fontScale = 1f )
244240@Composable
245241private fun NoData () {
246242 StatisticsList (
@@ -251,7 +247,7 @@ private fun NoData() {
251247 )
252248}
253249
254- @Preview(device = WearDevices .LARGE_ROUND )
250+ @Preview(device = WearDevices .LARGE_ROUND , fontScale = 1f )
255251@Composable
256252private fun Content () {
257253 val items = List (5 ) {
@@ -274,7 +270,7 @@ private fun Content() {
274270 )
275271}
276272
277- @Preview(device = WearDevices .LARGE_ROUND )
273+ @Preview(device = WearDevices .LARGE_ROUND , fontScale = 1f )
278274@Composable
279275private fun ContentLoading () {
280276 val items = List (1 ) {
0 commit comments