refactor(stats): use string resources

This commit is contained in:
Nishant Mishra
2025-12-17 21:16:38 +05:30
parent 5d5d47f5ae
commit 57e77dbb6e
5 changed files with 19 additions and 12 deletions

View File

@@ -271,7 +271,7 @@ fun FocusBreakRatioVisualization(
) )
) )
Text( Text(
text = breakPercentage.roundToInt().toString() + '%', text = "${breakPercentage.roundToInt()}%",
style = typography.bodyLarge, style = typography.bodyLarge,
color = colorScheme.tertiary, color = colorScheme.tertiary,
modifier = Modifier.padding(start = 6.dp) modifier = Modifier.padding(start = 6.dp)
@@ -438,7 +438,10 @@ fun HeatmapWithWeekLabels(
) )
Spacer(Modifier.height(4.dp)) Spacer(Modifier.height(4.dp))
Text( Text(
text = millisecondsToHoursMinutes(sum), text = millisecondsToHoursMinutes(
sum,
stringResource(R.string.hours_and_minutes_format)
),
style = typography.bodyMedium style = typography.bodyMedium
) )
Spacer(Modifier.height(8.dp)) Spacer(Modifier.height(8.dp))

View File

@@ -269,7 +269,7 @@ fun SharedTransitionScope.LastMonthScreen(
modifier = Modifier.rotate(iconRotation) modifier = Modifier.rotate(iconRotation)
) )
Spacer(Modifier.width(ButtonDefaults.IconSpacing)) Spacer(Modifier.width(ButtonDefaults.IconSpacing))
Text("Show chart") Text(stringResource(R.string.show_chart))
} }
FocusBreakdownChart( FocusBreakdownChart(
@@ -297,11 +297,11 @@ fun SharedTransitionScope.LastMonthScreen(
item { item {
Text( Text(
"Focus history heatmap", "Focus history calendar",
style = typography.headlineSmall style = typography.headlineSmall
) )
Text( Text(
"Focus history of the past year. Brighter colors represent a longer focus duration.", "Focus history of the past month",
style = typography.bodySmall, style = typography.bodySmall,
color = colorScheme.onSurfaceVariant color = colorScheme.onSurfaceVariant
) )

View File

@@ -270,7 +270,7 @@ fun SharedTransitionScope.LastWeekScreen(
modifier = Modifier.rotate(iconRotation) modifier = Modifier.rotate(iconRotation)
) )
Spacer(Modifier.width(ButtonDefaults.IconSpacing)) Spacer(Modifier.width(ButtonDefaults.IconSpacing))
Text("Show chart") Text(stringResource(R.string.show_chart))
} }
FocusBreakdownChart( FocusBreakdownChart(
@@ -313,7 +313,7 @@ fun SharedTransitionScope.LastWeekScreen(
Spacer(Modifier.width(18.dp)) Spacer(Modifier.width(18.dp))
(1..9 step 2).forEach { (1..9 step 2).forEach {
Text( Text(
(it * 10).toString() + "%\n|", "${it * 10}%\n|",
style = typography.labelSmall, style = typography.labelSmall,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
modifier = Modifier.weight(1f) modifier = Modifier.weight(1f)

View File

@@ -290,7 +290,7 @@ fun SharedTransitionScope.LastYearScreen(
modifier = Modifier.rotate(iconRotation) modifier = Modifier.rotate(iconRotation)
) )
Spacer(Modifier.width(ButtonDefaults.IconSpacing)) Spacer(Modifier.width(ButtonDefaults.IconSpacing))
Text("Show chart") Text(stringResource(R.string.show_chart))
} }
FocusBreakdownChart( FocusBreakdownChart(
@@ -320,12 +320,12 @@ fun SharedTransitionScope.LastYearScreen(
item { item {
Text( Text(
"Focus history heatmap", stringResource(R.string.focus_history_heatmap),
style = typography.headlineSmall, style = typography.headlineSmall,
modifier = Modifier.padding(horizontal = 16.dp) modifier = Modifier.padding(horizontal = 16.dp)
) )
Text( Text(
"Focus history of the past year. Deeper colors represent a longer focus duration. Cells are grouped by month.", stringResource(R.string.focus_history_heatmap_desc),
style = typography.bodySmall, style = typography.bodySmall,
color = colorScheme.onSurfaceVariant, color = colorScheme.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 16.dp) modifier = Modifier.padding(horizontal = 16.dp)
@@ -347,7 +347,7 @@ fun SharedTransitionScope.LastYearScreen(
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth()
) { ) {
Text( Text(
"Less", stringResource(R.string.less),
color = colorScheme.onSurfaceVariant, color = colorScheme.onSurfaceVariant,
style = typography.labelMedium style = typography.labelMedium
) )
@@ -374,7 +374,7 @@ fun SharedTransitionScope.LastYearScreen(
} }
Spacer(Modifier.width(8.dp)) Spacer(Modifier.width(8.dp))
Text( Text(
"More", stringResource(R.string.more),
color = colorScheme.onSurfaceVariant, color = colorScheme.onSurfaceVariant,
style = typography.labelMedium style = typography.labelMedium
) )

View File

@@ -114,4 +114,8 @@
<string name="focus_breakdown_desc">Average focus durations at different times of the day</string> <string name="focus_breakdown_desc">Average focus durations at different times of the day</string>
<string name="focus_history">Focus history</string> <string name="focus_history">Focus history</string>
<string name="focus_history_desc">Focus breakdown of each day of the past week (click on each cell for more info)</string> <string name="focus_history_desc">Focus breakdown of each day of the past week (click on each cell for more info)</string>
<string name="less">Less</string>
<string name="show_chart">Show chart</string>
<string name="focus_history_heatmap">Focus history heatmap</string>
<string name="focus_history_heatmap_desc">Focus history of the past year. Deeper colors represent a longer duration. Cells are grouped by month. Tap on cells for more info.</string>
</resources> </resources>