fix: androidtv ping settings bug
save for android tv will not work when you submit with keyboard closes #355
This commit is contained in:
parent
230f505806
commit
a9d7648425
|
@ -1,5 +1,3 @@
|
|||
import com.android.build.gradle.internal.scope.ProjectInfo.Companion.getBaseName
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
|
@ -229,11 +227,9 @@ val incrementVersionCode by tasks.registering {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
tasks.whenTaskAdded {
|
||||
if (name.startsWith("assemble")) {
|
||||
if (name.contains("debug")) return@whenTaskAdded
|
||||
dependsOn(incrementVersionCode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.zaneschepke.wireguardautotunnel.ui.common.config
|
|||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.interaction.collectIsFocusedAsState
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Save
|
||||
|
@ -22,6 +23,8 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.core.text.isDigitsOnly
|
||||
import com.zaneschepke.wireguardautotunnel.R
|
||||
|
||||
@Composable
|
||||
|
@ -49,10 +52,21 @@ fun SubmitConfigurationTextBox(
|
|||
interactionSource = interactionSource,
|
||||
value = stateValue ?: "",
|
||||
onValueChange = {
|
||||
stateValue = it
|
||||
when (keyboardOptions.keyboardType) {
|
||||
KeyboardType.Number -> {
|
||||
if (it.isDigitsOnly()) stateValue = it
|
||||
}
|
||||
else -> stateValue = it
|
||||
}
|
||||
},
|
||||
keyboardOptions = keyboardOptions,
|
||||
label = label,
|
||||
keyboardActions = KeyboardActions(
|
||||
onDone = {
|
||||
onSubmit(stateValue!!)
|
||||
keyboardController?.hide()
|
||||
},
|
||||
),
|
||||
hint = hint,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
|
|
@ -296,6 +296,7 @@ fun OptionsScreen(
|
|||
focusRequester,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = KeyboardType.Number,
|
||||
imeAction = ImeAction.Done,
|
||||
),
|
||||
isErrorValue = ::isSecondsError,
|
||||
onSubmit = {
|
||||
|
|
Loading…
Reference in New Issue