Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.
Close the keyboard when you tap outside the text box on the Remote
jesse-agent-2321ab61258a9b5
diff --git a/app/src/main/java/app/tellyscope/ui/RemoteScreen.kt b/app/src/main/java/app/tellyscope/ui/RemoteScreen.ktindex 213a096..eeebd48 100644--- a/app/src/main/java/app/tellyscope/ui/RemoteScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/RemoteScreen.kt@@ -103,10 +103,15 @@ import androidx.compose.ui.graphics.PathEffectimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.graphics.vector.PathParserimport androidx.compose.ui.hapticfeedback.HapticFeedbackType+import androidx.compose.ui.input.pointer.PointerEventPassimport androidx.compose.ui.input.pointer.PointerInputChangeimport androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.input.pointer.positionChange+import androidx.compose.ui.layout.boundsInWindow+import androidx.compose.ui.layout.onGloballyPositioned+import androidx.compose.ui.layout.positionInWindowimport androidx.compose.ui.platform.LocalConfiguration+import androidx.compose.ui.platform.LocalFocusManagerimport androidx.compose.ui.platform.LocalHapticFeedbackimport androidx.compose.ui.semantics.CustomAccessibilityActionimport androidx.compose.ui.semantics.Role@@ -125,6 +130,8 @@ import androidx.compose.ui.unit.dpimport androidx.compose.ui.zIndeximport androidx.compose.ui.graphics.drawscope.Strokeimport androidx.compose.ui.geometry.CornerRadius+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.geometry.Rectimport app.tellyscope.adb.RemoteKeyimport app.tellyscope.data.AppInfoimport app.tellyscope.data.DeviceState@@ -231,6 +238,10 @@ fun RemoteScreen(var tight by remember { mutableStateOf(false) }// While typing, the keyboard needs the room: volume, the hint and the dock step aside for the D-pad.val typing = WindowInsets.isImeVisible+ val focus = LocalFocusManager.current+ // The text box in window coordinates, so a tap on it (or its ⌫ and Send) keeps the keyboard up.+ var field by remember { mutableStateOf(Rect.Zero) }+ var origin by remember { mutableStateOf(Offset.Zero) }val rowGap = if (tight || typing) 12.dp else 20.dpval short = LocalConfiguration.current.screenHeightDp < SHORT_PHONE_DP@@ -239,7 +250,21 @@ fun RemoteScreen(sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),dragHandle = { HandleRow(screenControl, screenOff, live, showTip = state.screenOffTip, actions, onRestart = { confirmReboot = true }) },) {- Box(Modifier.fillMaxSize()) {+ // A tap anywhere else puts the keyboard away once the finger lifts, so nothing moves under a+ // press; the key that was tapped still does its job. Watched on the way down, never consumed.+ Box(+ Modifier.fillMaxSize()+ .onGloballyPositioned { origin = it.positionInWindow() }+ .pointerInput(typing) {+ if (!typing) return@pointerInput+ awaitEachGesture {+ val down = awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial)+ if (field.contains(origin + down.position)) return@awaitEachGesture+ waitForUpOrCancellation(PointerEventPass.Initial)+ focus.clearFocus()+ }+ },+ ) {Column(Modifier.fillMaxSize().padding(start = 16.dp, end = 16.dp, bottom = 16.dp),horizontalAlignment = Alignment.CenterHorizontally,@@ -299,7 +324,10 @@ fun RemoteScreen(}// Twice the usual gap, so a thumb aiming at a volume key doesn't land in the text box.Spacer(Modifier.height(if (typing) rowGap else 24.dp))- Keyboard(live, actions.type, actions.press, hint = !tight && !typing)+ Keyboard(+ live, actions.type, actions.press, hint = !tight && !typing,+ modifier = Modifier.onGloballyPositioned { field = it.boundsInWindow() },+ )} }// Under the keys, out of a thumb's way.if (!typing) {@@ -449,7 +477,13 @@ private fun KeySurface(/** [hint] off on a screen too short for it; an error still shows. */@Composable@OptIn(ExperimentalMaterial3Api::class)-private fun Keyboard(enabled: Boolean, type: (String) -> String?, press: suspend (RemoteKey) -> Boolean, hint: Boolean = true) {+private fun Keyboard(+ enabled: Boolean,+ type: (String) -> String?,+ press: suspend (RemoteKey) -> Boolean,+ hint: Boolean = true,+ modifier: Modifier = Modifier,+) {var text by rememberSaveable { mutableStateOf("") }var error by rememberSaveable { mutableStateOf<String?>(null) }fun send() {@@ -479,7 +513,7 @@ private fun Keyboard(enabled: Boolean, type: (String) -> String?, press: suspend}}},- modifier = Modifier.fillMaxWidth(),+ modifier = modifier.fillMaxWidth(),)}