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 {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
|
@ -229,11 +227,9 @@ val incrementVersionCode by tasks.registering {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks.whenTaskAdded {
|
tasks.whenTaskAdded {
|
||||||
if (name.startsWith("assemble")) {
|
if (name.startsWith("assemble")) {
|
||||||
|
if (name.contains("debug")) return@whenTaskAdded
|
||||||
dependsOn(incrementVersionCode)
|
dependsOn(incrementVersionCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.zaneschepke.wireguardautotunnel.ui.common.config
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.interaction.collectIsFocusedAsState
|
import androidx.compose.foundation.interaction.collectIsFocusedAsState
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.Save
|
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.res.stringResource
|
||||||
import androidx.compose.ui.text.input.ImeAction
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
|
import androidx.core.text.isDigitsOnly
|
||||||
import com.zaneschepke.wireguardautotunnel.R
|
import com.zaneschepke.wireguardautotunnel.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -49,10 +52,21 @@ fun SubmitConfigurationTextBox(
|
||||||
interactionSource = interactionSource,
|
interactionSource = interactionSource,
|
||||||
value = stateValue ?: "",
|
value = stateValue ?: "",
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
stateValue = it
|
when (keyboardOptions.keyboardType) {
|
||||||
|
KeyboardType.Number -> {
|
||||||
|
if (it.isDigitsOnly()) stateValue = it
|
||||||
|
}
|
||||||
|
else -> stateValue = it
|
||||||
|
}
|
||||||
},
|
},
|
||||||
keyboardOptions = keyboardOptions,
|
keyboardOptions = keyboardOptions,
|
||||||
label = label,
|
label = label,
|
||||||
|
keyboardActions = KeyboardActions(
|
||||||
|
onDone = {
|
||||||
|
onSubmit(stateValue!!)
|
||||||
|
keyboardController?.hide()
|
||||||
|
},
|
||||||
|
),
|
||||||
hint = hint,
|
hint = hint,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|
|
@ -296,6 +296,7 @@ fun OptionsScreen(
|
||||||
focusRequester,
|
focusRequester,
|
||||||
keyboardOptions = KeyboardOptions(
|
keyboardOptions = KeyboardOptions(
|
||||||
keyboardType = KeyboardType.Number,
|
keyboardType = KeyboardType.Number,
|
||||||
|
imeAction = ImeAction.Done,
|
||||||
),
|
),
|
||||||
isErrorValue = ::isSecondsError,
|
isErrorValue = ::isSecondsError,
|
||||||
onSubmit = {
|
onSubmit = {
|
||||||
|
|
Loading…
Reference in New Issue