Fix crash related to slider
This commit is contained in:
@@ -15,8 +15,8 @@ android {
|
||||
applicationId 'org.koitharu.kotatsu'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
versionCode 501
|
||||
versionName '4.0.1'
|
||||
versionCode 502
|
||||
versionName '4.0.2'
|
||||
generatedDensities = []
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -127,7 +127,11 @@ fun <T> RecyclerView.ViewHolder.getItem(clazz: Class<T>): T? {
|
||||
|
||||
fun Slider.setValueRounded(newValue: Float) {
|
||||
val step = stepSize
|
||||
val roundedValue = (newValue / step).roundToInt() * step
|
||||
val roundedValue = if (step <= 0f) {
|
||||
newValue
|
||||
} else {
|
||||
(newValue / step).roundToInt() * step
|
||||
}
|
||||
value = roundedValue.coerceIn(valueFrom, valueTo)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user