Merge pull request #12375 from JosJuice/android-gate-size-crash

Android: Fix crash when trying to edit gate size setting
This commit is contained in:
JosJuice 2024-01-07 19:34:06 +01:00 committed by GitHub
commit 4e57b66dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -56,9 +56,6 @@ open class FloatSliderSetting : SliderSetting {
get() = floatSetting.float
open fun setSelectedValue(settings: Settings, selection: Float) {
floatSetting.setFloat(
settings,
BigDecimal((selection).toDouble()).round(MathContext(3)).toFloat()
)
floatSetting.setFloat(settings, selection)
}
}

View File

@ -41,6 +41,7 @@ import java.io.File
import java.io.IOException
import java.io.RandomAccessFile
import java.util.*
import kotlin.math.roundToInt
class SettingsAdapter(
private val fragmentView: SettingsFragmentView,
@ -259,7 +260,7 @@ class SettingsAdapter(
slider.stepSize = item.stepSize.toFloat()
}
}
slider.value = seekbarProgress
slider.value = (seekbarProgress / slider.stepSize).roundToInt() * slider.stepSize
slider.addOnChangeListener(this)
dialog = MaterialAlertDialogBuilder(fragmentView.fragmentActivity)