Skip to content

Commit 5ec90ee

Browse files
committed
fix: floating button sliders weren't rounding properly.
This is due to a Material components bug I think because the float value coming from onValueChange in the Slider is slightly wrong. It is 59.99996 instead of 60.
1 parent 1a7f09c commit 5ec90ee

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/src/main/java/io/github/sds100/keymapper/util/StringUtils.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.github.sds100.keymapper.util
22

33
import androidx.annotation.IntRange
4+
import kotlin.math.roundToInt
45

56
/**
67
* Created by sds100 on 24/04/2021.
@@ -45,5 +46,5 @@ fun String.getWordBoundaries(@IntRange(from = 0L) cursorPosition: Int): Pair<Int
4546
}
4647

4748
fun Float.toPercentString(): String {
48-
return "${(this * 100).toInt()}%"
49+
return "${(this * 100).roundToInt()}%"
4950
}

0 commit comments

Comments
 (0)