From 11f91b39c621f2786788ef53a8b205990104ac6b Mon Sep 17 00:00:00 2001 From: Kyle Corry Date: Mon, 1 Jun 2026 15:05:27 -0400 Subject: [PATCH] fix: astronomy time slider click --- .../trail_sense/tools/astronomy/ui/AstronomyFragment.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/kylecorry/trail_sense/tools/astronomy/ui/AstronomyFragment.kt b/app/src/main/java/com/kylecorry/trail_sense/tools/astronomy/ui/AstronomyFragment.kt index 1b42149fa..63aef9bf9 100644 --- a/app/src/main/java/com/kylecorry/trail_sense/tools/astronomy/ui/AstronomyFragment.kt +++ b/app/src/main/java/com/kylecorry/trail_sense/tools/astronomy/ui/AstronomyFragment.kt @@ -261,9 +261,13 @@ class AstronomyFragment : BoundFragment() { private fun getSeekProgress(): Int { val totalDuration = Duration.between(minChartTime, maxChartTime).seconds + if (totalDuration <= 0) { + return 0 + } + val currentDuration = Duration.between(minChartTime, currentSeekChartTime).seconds val progress = maxProgress * currentDuration / totalDuration.toFloat() - return progress.toInt() + return progress.toInt().coerceIn(0, maxProgress) } private fun hideTimeSeeker() {