From d5e3890e4ec6fe7a01ef388f131636914084d3a0 Mon Sep 17 00:00:00 2001 From: Nishant Mishra Date: Fri, 12 Dec 2025 19:19:16 +0530 Subject: [PATCH] fix(stats): fix incorrect corner radius in 1D heatmap --- .../statsScreen/components/visualizations.kt | 24 ++++++++++--------- .../ui/statsScreen/screens/LastWeekScreen.kt | 8 +++---- app/src/main/res/values/strings.xml | 4 ++++ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/components/visualizations.kt b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/components/visualizations.kt index a27ded3..e552996 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/components/visualizations.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/components/visualizations.kt @@ -72,19 +72,21 @@ fun VariableWidth1DHeatmap( ) { values.fastForEachIndexed { index, item -> if (item > 0L) { - val shape = when (index) { - firstNonZeroIndex -> shapes.large.copy( - topEnd = shapes.extraSmall.topEnd, - bottomEnd = shapes.extraSmall.bottomEnd - ) + val shape = + if (firstNonZeroIndex == lastNonZeroIndex) shapes.large + else when (index) { + firstNonZeroIndex -> shapes.large.copy( + topEnd = shapes.extraSmall.topEnd, + bottomEnd = shapes.extraSmall.bottomEnd + ) - lastNonZeroIndex -> shapes.large.copy( - topStart = shapes.extraSmall.topStart, - bottomStart = shapes.extraSmall.bottomStart - ) + lastNonZeroIndex -> shapes.large.copy( + topStart = shapes.extraSmall.topStart, + bottomStart = shapes.extraSmall.bottomStart + ) - else -> shapes.extraSmall - } + else -> shapes.extraSmall + } Spacer( Modifier .weight(item.toFloat()) diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/screens/LastWeekScreen.kt b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/screens/LastWeekScreen.kt index adb64a6..f886975 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/screens/LastWeekScreen.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/screens/LastWeekScreen.kt @@ -204,11 +204,11 @@ fun SharedTransitionScope.LastWeekScreen( item { Text( - "Focus overview", + stringResource(R.string.focus_overview), style = typography.headlineSmall ) Text( - "Average focus durations at different times of the day", + stringResource(R.string.focus_overview_desc), style = typography.bodySmall, color = colorScheme.onSurfaceVariant ) @@ -249,11 +249,11 @@ fun SharedTransitionScope.LastWeekScreen( item { Text( - "Focus insights", + stringResource(R.string.focus_insights), style = typography.headlineSmall ) Text( - "Focus overview of each day of the past week", + stringResource(R.string.focus_insights_desc), style = typography.bodySmall, color = colorScheme.onSurfaceVariant ) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 24df1ec..0c421ae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -114,4 +114,8 @@ Timer reset Undo Focus-break ratio + Focus overview + Average focus durations at different times of the day + Focus insights + Focus overview of each day of the past week (click on each cell for more info) \ No newline at end of file