diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/DefaultBasicTextField.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/DefaultBasicTextField.kt index a6f0d2c9b..af1009b14 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/DefaultBasicTextField.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/DefaultBasicTextField.kt @@ -19,6 +19,7 @@ import dev.icerock.moko.resources.compose.painterResource import androidx.compose.ui.text.* import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.* +import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.* import chat.simplex.common.views.database.PassphraseStrength @@ -124,6 +125,7 @@ fun DefaultConfigurableTextField( keyboardActions: KeyboardActions = KeyboardActions(), keyboardType: KeyboardType = KeyboardType.Text, fontSize: TextUnit = 16.sp, + underline: Boolean = false, dependsOn: State? = null, ) { var valid by remember { mutableStateOf(isValid(state.value.text)) } @@ -144,8 +146,8 @@ fun DefaultConfigurableTextField( val colors = TextFieldDefaults.textFieldColors( backgroundColor = Color.Unspecified, textColor = MaterialTheme.colors.onBackground, - focusedIndicatorColor = Color.Unspecified, - unfocusedIndicatorColor = Color.Unspecified, + focusedIndicatorColor = if (underline) MaterialTheme.colors.primary.copy(alpha = ContentAlpha.high) else Color.Unspecified, + unfocusedIndicatorColor = if (underline) MaterialTheme.colors.onSurface.copy(alpha = TextFieldDefaults.UnfocusedIndicatorLineOpacity) else Color.Unspecified, ) val color = MaterialTheme.colors.onBackground val shape = MaterialTheme.shapes.small.copy(bottomEnd = ZeroCornerSize, bottomStart = ZeroCornerSize) @@ -157,7 +159,7 @@ fun DefaultConfigurableTextField( .indicatorLine(enabled, false, interactionSource, colors) .defaultMinSize( minWidth = TextFieldDefaults.MinWidth, - minHeight = TextFieldDefaults.MinHeight + minHeight = if (underline) Dp.Unspecified else TextFieldDefaults.MinHeight ), onValueChange = { state.value = it diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/remote/ConnectMobileView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/remote/ConnectMobileView.kt index 1ac958f93..a7dbbbd33 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/remote/ConnectMobileView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/remote/ConnectMobileView.kt @@ -463,10 +463,10 @@ private fun UnderQrLayout(cachedR: CR.RemoteHostStarted?, customAddress: Mutable keyboardActions = KeyboardActions(onDone = { defaultKeyboardAction(ImeAction.Done) }), keyboardType = KeyboardType.Number, fontSize = 14.sp, + underline = true, ) if (validPort(portUnsaved.value.text) && portUnsaved.value.text.toInt() > 1023) { - Icon(painterResource(MR.images.ic_edit), stringResource(MR.strings.edit_verb), Modifier.padding(end = 56.dp).size(16.dp).align(Alignment.CenterEnd), tint = MaterialTheme.colors.secondary) - IconButton(::showOpenPortAlert, Modifier.align(Alignment.TopEnd).padding(top = 2.dp)) { + IconButton(::showOpenPortAlert, Modifier.align(Alignment.TopEnd)) { Icon(painterResource(MR.images.ic_info), null, tint = MaterialTheme.colors.primary) } } @@ -482,6 +482,11 @@ private fun UnderQrLayout(cachedR: CR.RemoteHostStarted?, customAddress: Mutable } } } + KeyChangeEffect(customPort.value) { + if (customPort.value != null) { + portUnsaved.value = portUnsaved.value.copy(text = customPort.value.toString()) + } + } } } diff --git a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml index 386f43933..840e29fc0 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -1695,7 +1695,7 @@ No connected mobile Random Open port in firewall - To allow a mobile app to connect to the desktop, open this port in your firewall if you have it enabled + To allow a mobile app to connect to the desktop, open this port in your firewall, if you have it enabled Coming soon!