From d81e197d8cffadf7da34314a10e3cab82b378382 Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Tue, 18 Jul 2023 20:18:35 +0200 Subject: [PATCH] Remove redundant conversion. Use val where possible. --- .../tichucounter/ui/counter/RoundGraphView.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/counter/RoundGraphView.kt b/app/src/main/java/me/zobrist/tichucounter/ui/counter/RoundGraphView.kt index 8f8d0e3..86fe20d 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/counter/RoundGraphView.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/counter/RoundGraphView.kt @@ -38,8 +38,8 @@ fun RoundGraphView(rounds: List, modifier: Modifier = Modifier) { chart = lineChart( lines = listOf(specA, specB), axisValuesOverrider = AxisValuesOverrider.fixed( - minY = range.first.toFloat(), - maxY = range.second.toFloat() + minY = range.first, + maxY = range.second ) ), model = composedChartEntryModelOf( @@ -58,8 +58,8 @@ fun RoundGraphView(rounds: List, modifier: Modifier = Modifier) { } private fun getPoints(rounds: List): Pair, List> { - var a = mutableListOf(FloatEntry(0f, 0f)) - var b = mutableListOf(FloatEntry(0f, 0f)) + val a = mutableListOf(FloatEntry(0f, 0f)) + val b = mutableListOf(FloatEntry(0f, 0f)) var sumA = 0 var sumB = 0 @@ -75,13 +75,13 @@ private fun getPoints(rounds: List): Pair, List, b: List, step: Int): Pair { - var min = (a + b).minBy { it -> it.y } - var max = (a + b).maxBy { it -> it.y } + val min = (a + b).minBy { it.y } + val max = (a + b).maxBy { it.y } - var lo = floor(min.y / step) * step - var hi = ceil(max.y / step) * step + val lo = floor(min.y / step) * step + val hi = ceil(max.y / step) * step - return Pair(lo.toFloat(), hi.toFloat()) + return Pair(lo, hi) } @Preview(name = "Light Mode")