diff --git a/android/app/src/main/java/tv/orbit/classic/CreateChannel.kt b/android/app/src/main/java/tv/orbit/classic/CreateChannel.kt index 502dece7..70178894 100644 --- a/android/app/src/main/java/tv/orbit/classic/CreateChannel.kt +++ b/android/app/src/main/java/tv/orbit/classic/CreateChannel.kt @@ -13,6 +13,7 @@ import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.ui.input.key.onPreviewKeyEvent import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -217,9 +218,13 @@ internal fun ChoiceCard(title: String, lines: List, modifier: Modifier, @Composable internal fun OrbitField(value: String, onChange: (String) -> Unit, hint: String, modifier: Modifier) { var focused by remember { mutableStateOf(false) } + // The remote's rules for a text box (1.0 RC1, found on the emulator: Create your own's name box kept Up and Down, so its + // Next button couldn't be reached): OK opens the keyboard, Up and Down move on, as on the sign-in boxes. + val keyboard = androidx.compose.ui.platform.LocalSoftwareKeyboardController.current + val focus = androidx.compose.ui.platform.LocalFocusManager.current Box(modifier.onFocusChanged { focused = it.isFocused }.background(Panel, RoundedCornerShape(8.dp)).border(2.dp, if (focused) Yellow else Blue, RoundedCornerShape(8.dp)).padding(10.dp)) { if (value.isEmpty()) Text(hint, color = Muted, fontSize = 15.sp) - BasicTextField(value, { onChange(it.replace("\n", "")) }, Modifier.fillMaxWidth(), singleLine = true, textStyle = TextStyle(color = Ink, fontSize = 15.sp), + BasicTextField(value, { onChange(it.replace("\n", "")) }, Modifier.fillMaxWidth().onPreviewKeyEvent { event -> textFieldKeys(event.nativeKeyEvent, keyboard, focus) }, singleLine = true, textStyle = TextStyle(color = Ink, fontSize = 15.sp), cursorBrush = SolidColor(Yellow), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done)) } }