fix: roundToInt вместо toInt для слайдера потоков
This commit is contained in:
1 parent
739c9da25d
commit
a0b6ac81bd
1 file changed
+4
-3
@@ -55,6 +55,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import com.freeturn.app.data.ClientConfig
|
import com.freeturn.app.data.ClientConfig
|
||||||
import com.freeturn.app.ui.HapticUtil
|
import com.freeturn.app.ui.HapticUtil
|
||||||
import com.freeturn.app.viewmodel.MainViewModel
|
import com.freeturn.app.viewmodel.MainViewModel
|
||||||
|
import kotlin.math.roundToInt
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,7 +105,7 @@ fun ClientSetupScreen(
|
|||||||
ClientConfig(
|
ClientConfig(
|
||||||
serverAddress = serverAddress.trim(),
|
serverAddress = serverAddress.trim(),
|
||||||
vkLink = vkLink.trim(),
|
vkLink = vkLink.trim(),
|
||||||
threads = threads.toInt(),
|
threads = threads.roundToInt(),
|
||||||
useUdp = useUdp,
|
useUdp = useUdp,
|
||||||
noDtls = noDtls,
|
noDtls = noDtls,
|
||||||
localPort = localPort.trim()
|
localPort = localPort.trim()
|
||||||
@@ -175,7 +176,7 @@ fun ClientSetupScreen(
|
|||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
Text(stringResource(R.string.threads_format, threads.toInt()), style = MaterialTheme.typography.bodyMedium)
|
Text(stringResource(R.string.threads_format, threads.roundToInt()), style = MaterialTheme.typography.bodyMedium)
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.threads_recommendation),
|
stringResource(R.string.threads_recommendation),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
@@ -186,7 +187,7 @@ fun ClientSetupScreen(
|
|||||||
Slider(
|
Slider(
|
||||||
value = threads,
|
value = threads,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
val newInt = it.toInt()
|
val newInt = it.roundToInt()
|
||||||
if (newInt != lastSliderInt) {
|
if (newInt != lastSliderInt) {
|
||||||
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
||||||
lastSliderInt = newInt
|
lastSliderInt = newInt
|
||||||
|
|||||||
Reference in new issue
Block a user