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.
Device page: four tabs under a top bar with the TV switcher
jesse-agent-362873e3900f3d7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 17bfedd..d9dcf32 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,8 @@ until this file has a section for its version.## Unreleased+- **Improved:** Each TV's page has four tabs: Overview, Apps, Files and Tweaks. [#NN](../../pull/NN)+## 0.3.0 — 2026-10-24- **Improved:** Picking your TV: your match on its own, or search by maker. [#49](../../pull/49)diff --git a/app/src/main/java/app/tellyscope/MainActivity.kt b/app/src/main/java/app/tellyscope/MainActivity.ktindex 1261ab6..2df872f 100644--- a/app/src/main/java/app/tellyscope/MainActivity.kt+++ b/app/src/main/java/app/tellyscope/MainActivity.kt@@ -42,7 +42,7 @@ import app.tellyscope.ui.AdvancedScreenimport app.tellyscope.ui.Copyimport app.tellyscope.ui.DebloatScreenimport app.tellyscope.ui.DeviceActions-import app.tellyscope.ui.DeviceScreen+import app.tellyscope.ui.DeviceTabsScreenimport app.tellyscope.ui.Doneimport app.tellyscope.ui.PermissionScreenimport app.tellyscope.ui.RemoteActions@@ -215,7 +215,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {tvMakers = listOfNotNull(state.selected?.brand, state.selected?.manufacturer).distinct(),)} else {- DeviceScreen(+ DeviceTabsScreen(state = state,snackbar = snackbar,actions = DeviceActions(diff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.ktindex e28ce1a..426519f 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt@@ -4,65 +4,40 @@ package app.tellyscope.uiimport android.graphics.BitmapFactoryimport androidx.compose.animation.AnimatedVisibility-import androidx.compose.animation.animateContentSize-import androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.foundation.Imageimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacer-import androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.heightimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.width-import androidx.compose.foundation.lazy.LazyColumn-import androidx.compose.foundation.lazy.LazyListScopeimport androidx.compose.foundation.shape.CircleShapeimport androidx.compose.material.icons.Icons-import androidx.compose.material.icons.filled.Add-import androidx.compose.material.icons.filled.ArrowDropDown+import androidx.compose.material.icons.filled.Checkimport androidx.compose.material.icons.filled.CheckCircle-import androidx.compose.material.icons.filled.Close-import androidx.compose.material.icons.filled.Delete-import androidx.compose.material.icons.filled.Editimport androidx.compose.material.icons.filled.Info-import androidx.compose.material.icons.filled.Settings-import androidx.compose.material.icons.filled.KeyboardArrowDownimport androidx.compose.material.icons.filled.Lock-import androidx.compose.material.icons.filled.Searchimport androidx.compose.material.icons.filled.Warningimport androidx.compose.material3.AlertDialogimport androidx.compose.material3.Buttonimport androidx.compose.material3.ButtonDefaultsimport androidx.compose.material3.Cardimport androidx.compose.material3.CardDefaults-import androidx.compose.material3.Checkbox-import androidx.compose.material3.DropdownMenu-import androidx.compose.material3.DropdownMenuItem-import androidx.compose.material3.ExperimentalMaterial3Apiimport androidx.compose.material3.ExperimentalMaterial3ExpressiveApiimport androidx.compose.material3.FilledTonalButton-import androidx.compose.material3.HorizontalDividerimport androidx.compose.material3.Icon-import androidx.compose.material3.IconButtonimport androidx.compose.material3.LinearProgressIndicatorimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.OutlinedButtonimport androidx.compose.material3.OutlinedTextField-import androidx.compose.material3.Scaffold-import androidx.compose.material3.SnackbarHost-import androidx.compose.material3.SnackbarHostStateimport androidx.compose.material3.Textimport androidx.compose.material3.TextButton-import androidx.compose.material3.TextField-import androidx.compose.material3.TextFieldDefaults-import androidx.compose.material3.TopAppBarimport androidx.compose.runtime.Composableimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOf@@ -73,7 +48,6 @@ import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.alphaimport androidx.compose.ui.draw.clip-import androidx.compose.ui.draw.rotateimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.asImageBitmapimport androidx.compose.ui.text.style.TextOverflow@@ -89,8 +63,6 @@ import app.tellyscope.data.HistoryBookimport app.tellyscope.data.HistoryEntryimport app.tellyscope.data.Procimport app.tellyscope.data.Snapshot-import app.tellyscope.data.Suggestions-import app.tellyscope.data.deviceKindimport app.tellyscope.ui.theme.SmallNumberdata class DeviceActions(@@ -139,148 +111,12 @@ data class DeviceActions(/** Off while the remote is made faster: the device page hides its Remote button. */internal const val REMOTE_ENABLED = false-@OptIn(ExperimentalMaterial3Api::class)-@Composable-fun DeviceScreen(- state: UiState,- actions: DeviceActions,- snackbar: SnackbarHostState = remember { SnackbarHostState() },-) {- val device = state.selected ?: return- val ui = state.device- var searching by rememberSaveable { mutableStateOf(false) }- val q = state.query.trim().lowercase()- val offline = device.state != DeviceState.Online-- Scaffold(- snackbarHost = { SnackbarHost(snackbar) },- topBar = {- if (searching) {- TopAppBar(- title = {- TextField(- value = state.query,- onValueChange = actions.query,- placeholder = { Text("Search apps") },- singleLine = true,- colors = TextFieldDefaults.colors(- focusedContainerColor = Color.Transparent,- unfocusedContainerColor = Color.Transparent,- ),- modifier = Modifier.fillMaxWidth(),- )- },- actions = {- IconButton(onClick = { searching = false; actions.query("") }) {- Icon(Icons.Default.Close, contentDescription = "Close search")- }- },- )- } else {- TopAppBar(- title = { Text("Your TV", style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onSurfaceVariant) },- actions = {- if (REMOTE_ENABLED) TextButton(onClick = actions.remote, enabled = !offline) { Text("Remote") }- TextButton(onClick = actions.advanced) { Text("Advanced") }- IconButton(onClick = { searching = true }, enabled = !offline) {- Icon(Icons.Default.Search, contentDescription = "Search")- }- },- )- }- },- ) { pad ->- LazyColumn(- Modifier.fillMaxSize().padding(pad),- contentPadding = PaddingValues(start = 16.dp, end = 16.dp, bottom = 32.dp),- verticalArrangement = Arrangement.spacedBy(12.dp),- ) {- val snap = ui.snapshot- // A reading from before the TV went away is stale: it doesn't speak for the TV now.- val live = snap?.takeIf { !offline }- item { TvCard(state, live, actions) }- val restart = state.restarting[device.id]- if (restart != null) {- item { RestartingCard(restart, state.now) }- } else if (device.state == DeviceState.NotAllowed) {- item { NotAllowedCard(actions.reconnect) }- } else if (offline) {- item { OfflineCard(device, state.now, actions.reconnect) }- }- if (live != null) {- item { SystemWidget(live) }- } else if (offline && snap == null) {- item {- Text(- Copy.noStats(device.state),- style = MaterialTheme.typography.bodyMedium,- color = MaterialTheme.colorScheme.onSurfaceVariant,- )- }- }- if (!offline && q.isEmpty()) {- item {- ActionTiles(- actions,- canDebloat = ui.lists is Suggestions.Pick || ui.lists is Suggestions.Ready,- disabling = ui.busy == DISABLING,- )- }- val count = (ui.lists as? Suggestions.Ready)?.groups?.sumOf { it.packages.size } ?: 0- section("lists", "Suggested for this TV", count, expandedByDefault = true) {- SuggestionsSummary(ui.lists)- }- }- // An offline TV can't list anything: sections with nothing in them stay out of the way.- // Protected apps can't be changed, so they wait in their own folded section below.- val (locked, changeable) = ui.apps- .filter { q.isEmpty() || it.label.lowercase().contains(q) || it.packageName.contains(q) }- .sortedWith(compareBy({ !it.enabled }, { it.system }, { it.label }))- .partition { it.protectedReason != null }- if (!offline || ui.apps.isNotEmpty()) section(- key = "apps",- title = "Apps",- count = ui.apps.count { it.protectedReason == null },- expandedByDefault = true,- forceOpen = q.isNotEmpty(),- ) {- if (changeable.isEmpty()) EmptyLine(q)- changeable.forEach { app ->- AppRow(app, snap?.procs.orEmpty(), ui.pending, ui.busy == app.packageName, actions, homeLabel(ui.apps, app))- }- }- if (ui.apps.any { it.protectedReason != null } && (q.isEmpty() || locked.isNotEmpty())) section(- key = "protected",- title = Copy.CANT_CHANGE,- count = ui.apps.count { it.protectedReason != null },- forceOpen = q.isNotEmpty(),- ) {- locked.forEach { app ->- AppRow(app, snap?.procs.orEmpty(), ui.pending, ui.busy == app.packageName, actions, homeLabel(ui.apps, app))- }- }- if (!offline && q.isEmpty()) section("files", "Files on the TV", ui.files.list?.size ?: 0) {- FilesBlock(ui.files, state.now, actions)- }- if (!offline && q.isEmpty()) section("tweaks", Copy.TWEAKS, 0) {- TweaksBlock(ui, actions)- }- section("history", "History", ui.history.size) {- HistoryList(ui.history, state.now, actions.undo, restoring = ui.busy == RESTORING, onRestoreAll = actions.restoreAll)- }- }- if (!offline) ui.request?.let { RequestDialog(it, ui.busy == ANSWERING, actions.answerRequest, actions.dismissRequest) }- ui.sideload?.let { SideloadDialog(it, actions) }- ui.transfer?.let { TransferDialog(it, actions.cancelTransfer) }- }-}-/**- * The TV at a glance, with room to breathe: which TV (tap to switch), how it's doing, and the+ * The TV at a glance, with room to breathe: how it's doing, and the* few facts people look up. Everything else is on Advanced.*/@Composable-private fun TvCard(state: UiState, live: Snapshot?, actions: DeviceActions) {+internal fun TvCard(state: UiState, live: Snapshot?) {val device = state.selected ?: returnval facts = listOfNotNull("IP address" to device.hit.ip,@@ -295,7 +131,6 @@ private fun TvCard(state: UiState, live: Snapshot?, actions: DeviceActions) {colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow),) {Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {- DevicePicker(state, actions)if (live != null) {HealthLine(Copy.health(live, heaviest(live, state.device.apps)))} else {@@ -330,7 +165,7 @@ private fun Fact(label: String, value: String, modifier: Modifier = Modifier) {* install fits, then CPU, RAM, temperature and network speed as plain numbers.*/@Composable-private fun SystemWidget(s: Snapshot) {+internal fun SystemWidget(s: Snapshot) {val dash = "\u2014"Card(Modifier.fillMaxWidth(),@@ -370,99 +205,6 @@ private fun Vital(label: String, value: String, modifier: Modifier = Modifier) {}}-@Composable-private fun DevicePicker(state: UiState, actions: DeviceActions) {- var open by remember { mutableStateOf(false) }- var forgetting by remember { mutableStateOf(false) }- var renaming by remember { mutableStateOf(false) }- var about by remember { mutableStateOf(false) }- val device = state.selected ?: return- if (forgetting) ForgetDialog(name(device), onForget = { forgetting = false; actions.forget(device.id) }, onDismiss = { forgetting = false })- if (renaming) RenameDialog(device.nickname.orEmpty(), networkName(device), onSave = { renaming = false; actions.rename(device.id, it) }, onDismiss = { renaming = false })- if (about) AboutDialog(- when (val l = state.device.lists) {- is Suggestions.Pick -> l.commit- is Suggestions.Ready -> l.commit- else -> null- },- onDismiss = { about = false },- )- val offlineCount = state.devices.count { it.state != DeviceState.Online }- Box {- Row(- Modifier.clip(MaterialTheme.shapes.large).clickable { open = true }.padding(vertical = 4.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- KindBadge(device)- Column(Modifier.weight(1f, fill = false)) {- Text(name(device), style = MaterialTheme.typography.titleLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)- val made = made(device.manufacturer ?: device.hit.maker, device.model)- if (made.isNotEmpty()) {- Text(made, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)- }- }- Icon(Icons.Default.ArrowDropDown, contentDescription = "Switch TV")- }- DropdownMenu(open, onDismissRequest = { open = false }) {- state.devices- .filter { state.showOffline || it.state == DeviceState.Online || it.id == state.selectedId }- .forEach { d ->- DropdownMenuItem(- // Name over state, like the top bar: a long name gets the full width.- text = {- Column {- Text(name(d), maxLines = 1, overflow = TextOverflow.Ellipsis)- Row(verticalAlignment = Alignment.CenterVertically) {- StateDot(d.state)- Spacer(Modifier.width(6.dp))- Text(- if (d.state == DeviceState.Online) Copy.state(d.state)- else d.lastSeen?.let { "${Copy.state(d.state)}, seen ${Copy.ago(it, state.now)}" } ?: Copy.state(d.state),- style = MaterialTheme.typography.labelSmall,- color = MaterialTheme.colorScheme.onSurfaceVariant,- )- }- }- },- leadingIcon = { Icon(DeviceIcons.of(deviceKind(d)), contentDescription = deviceKind(d).word()) },- onClick = { open = false; actions.select(d.id) },- )- }- HorizontalDivider()- DropdownMenuItem(- text = { Text("Show offline ($offlineCount)") },- leadingIcon = { Checkbox(state.showOffline, onCheckedChange = null) },- onClick = { actions.showOffline(!state.showOffline) },- )- DropdownMenuItem(- text = { Text("Add a TV") },- leadingIcon = { Icon(Icons.Default.Add, null) },- onClick = { open = false; actions.addDevice() },- )- DropdownMenuItem(- text = { Text("Rename this TV") },- leadingIcon = { Icon(Icons.Default.Edit, null) },- onClick = { open = false; renaming = true },- )- DropdownMenuItem(- text = { Text("Forget this TV") },- leadingIcon = { Icon(Icons.Default.Delete, null) },- onClick = { open = false; forgetting = true },- )- DropdownMenuItem(- text = { Text("Settings") },- leadingIcon = { Icon(Icons.Default.Settings, null) },- onClick = { open = false; actions.settings() },- )- DropdownMenuItem(- text = { Text("About & licences") },- leadingIcon = { Icon(Icons.Default.Info, null) },- onClick = { open = false; about = true },- )- }- }-}-/** Undoing a Turn on disables the app; it names the app and asks like any other Disable. */@Composablefun UndoDisableDialog(entry: HistoryEntry, onDisable: () -> Unit, onDismiss: () -> Unit) {@@ -493,18 +235,19 @@ fun RestoreDialog(count: Int, onRestore: () -> Unit, onDismiss: () -> Unit) {}/** "XGIMI · Horizon Pro": many models already start with the maker's name, so it isn't said twice. */-private fun made(maker: String?, model: String?): String {+internal fun made(maker: String?, model: String?): String {val m = if (maker != null && model != null && model.startsWith(maker, ignoreCase = true)) model.drop(maker.length).trim() else modelreturn listOfNotNull(maker, m?.takeIf { it.isNotEmpty() }).joinToString(" · ")}-private fun name(d: Device) = d.nickname ?: networkName(d)+/** The name the user gave the TV, else its model: a network id like "xgimi-projector" means little. */+internal fun name(d: Device) = d.nickname ?: d.model ?: networkName(d)-private fun networkName(d: Device) = d.hit.hostname ?: d.model ?: d.hit.ip+internal fun networkName(d: Device) = d.hit.hostname ?: d.model ?: d.hit.ip-/** Stored on this phone only, per TV; an empty name goes back to what the network calls it. */+/** Stored on this phone only, per TV; an empty name goes back to [fallback], the model or network name. */@Composable-fun RenameDialog(current: String, networkName: String, onSave: (String) -> Unit, onDismiss: () -> Unit) {+fun RenameDialog(current: String, fallback: String, onSave: (String) -> Unit, onDismiss: () -> Unit) {var text by rememberSaveable { mutableStateOf(current) }AlertDialog(onDismissRequest = onDismiss,@@ -516,7 +259,7 @@ fun RenameDialog(current: String, networkName: String, onSave: (String) -> Unit,value = text,onValueChange = { text = it.take(app.tellyscope.data.NameBook.MAX_LENGTH) },singleLine = true,- placeholder = { Text(networkName) },+ placeholder = { Text(fallback) },)}},@@ -525,19 +268,6 @@ fun RenameDialog(current: String, networkName: String, onSave: (String) -> Unit,)}-/** What kind of device it is, on a tile: TV, projector or streaming stick. Generic shapes, never a maker's logo. */-@Composable-private fun KindBadge(d: Device) {- val kind = deviceKind(d)- Box(- Modifier.padding(end = 14.dp).size(56.dp).clip(MaterialTheme.shapes.large)- .background(MaterialTheme.colorScheme.secondaryContainer),- contentAlignment = Alignment.Center,- ) {- Icon(DeviceIcons.of(kind), contentDescription = kind.word(), Modifier.size(30.dp), tint = MaterialTheme.colorScheme.onSecondaryContainer)- }-}-/** Forgetting only touches this phone; the TV keeps its own list of allowed computers. */@Composablefun ForgetDialog(name: String, onForget: () -> Unit, onDismiss: () -> Unit) {@@ -551,7 +281,7 @@ fun ForgetDialog(name: String, onForget: () -> Unit, onDismiss: () -> Unit) {}@Composable-private fun StateDot(state: DeviceState) {+internal fun StateDot(state: DeviceState) {val c = when (state) {DeviceState.Online -> MaterialTheme.colorScheme.primaryDeviceState.Waiting, DeviceState.Found, DeviceState.NeedsPairing -> MaterialTheme.colorScheme.tertiary@@ -563,7 +293,7 @@ private fun StateDot(state: DeviceState) {/** The TV refused (revoked access, a reset, or Deny); retrying stopped so the prompt doesn't nag. */@Composable-private fun NotAllowedCard(onConnect: () -> Unit) {+internal fun NotAllowedCard(onConnect: () -> Unit) {Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.errorContainer,@@ -595,7 +325,7 @@ private fun CardTitle(icon: androidx.compose.ui.graphics.vector.ImageVector, tex}@Composable-private fun OfflineCard(device: Device, now: Long, onReconnect: () -> Unit) {+internal fun OfflineCard(device: Device, now: Long, onReconnect: () -> Unit) {// Material 3 has no warning role; tertiary is the standard stand-in, kept apart from error.Card(colors = CardDefaults.cardColors(@@ -618,7 +348,7 @@ private fun OfflineCard(device: Device, now: Long, onReconnect: () -> Unit) {}/** App names by memory use, largest first, for the health line. */-private fun heaviest(snap: Snapshot, apps: List<AppInfo>): List<String> {+internal fun heaviest(snap: Snapshot, apps: List<AppInfo>): List<String> {val labels = apps.associate { it.packageName to it.label }return snap.procs.filter { it.packageName != null }.groupBy { labels[it.packageName] ?: AppNames.fallback(it.packageName!!) }@@ -640,41 +370,6 @@ private fun HealthLine(h: Copy.Health) {}}-/** A collapsible card section. */-private fun LazyListScope.section(- key: String,- title: String,- count: Int,- expandedByDefault: Boolean = false,- forceOpen: Boolean = false,- body: @Composable () -> Unit,-) {- item(key = key) {- var open by rememberSaveable { mutableStateOf(expandedByDefault) }- val shown = open || forceOpen- val turn by animateFloatAsState(if (shown) 180f else 0f, MaterialTheme.motionScheme.fastSpatialSpec(), label = "chevron")- Card(- Modifier.fillMaxWidth().animateContentSize(MaterialTheme.motionScheme.defaultSpatialSpec()),- colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow),- ) {- Row(- Modifier.fillMaxWidth().clickable { open = !open }.padding(16.dp),- verticalAlignment = Alignment.CenterVertically,- ) {- Text(title, style = MaterialTheme.typography.titleMedium, modifier = Modifier.weight(1f))- if (count > 0) Text("$count", style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant)- Spacer(Modifier.width(8.dp))- Icon(Icons.Default.KeyboardArrowDown, contentDescription = if (shown) "Collapse" else "Expand", Modifier.rotate(turn))- }- AnimatedVisibility(shown) {- Column(Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {- body()- }- }- }- }-}-@Composableinternal fun EmptyLine(q: String) {Text(@@ -702,7 +397,7 @@ fun AppIcon(app: AppInfo, modifier: Modifier = Modifier) {}/** The name of the home screen [app] would replace, or null when it isn't offered as one. */-private fun homeLabel(apps: List<AppInfo>, app: AppInfo): String? =+internal fun homeLabel(apps: List<AppInfo>, app: AppInfo): String? =app.homeInstead?.let { pkg -> apps.firstOrNull { it.packageName == pkg }?.label }/** Uninstall has no undo, so it asks in a dialog that names the app, not inline. */@@ -724,7 +419,7 @@ fun UninstallDialog(app: AppInfo, onUninstall: () -> Unit, onDismiss: () -> Unit@OptIn(ExperimentalMaterial3ExpressiveApi::class)@Composable-private fun AppRow(+internal fun AppRow(app: AppInfo,procs: List<Proc>,pending: Pair<String, Action>?,@@ -792,7 +487,7 @@ private fun AppRow(}@Composable-private fun HistoryList(+internal fun HistoryList(history: List<HistoryEntry>,now: Long,onUndo: (HistoryEntry) -> Unit,@@ -826,7 +521,16 @@ private fun HistoryList(Text(Copy.ago(h.at, now), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}when {- h.undoneAt != null -> Text("Undone", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ // Same button as Undo, switched off: the row keeps its shape and reads as done.+ h.undoneAt != null -> TextButton(+ onClick = {},+ enabled = false,+ colors = ButtonDefaults.textButtonColors(disabledContentColor = MaterialTheme.colorScheme.onSurfaceVariant),+ ) {+ Icon(Icons.Default.Check, contentDescription = null, Modifier.size(18.dp))+ Spacer(Modifier.width(4.dp))+ Text("Undone")+ }h.undo != null -> TextButton(onClick = { if (h.undo == Action.Disable) disabling = h else onUndo(h) }) { Text(Copy.undo(h.undo)) }}}diff --git a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt b/app/src/main/java/app/tellyscope/ui/DeviceTabs.ktnew file mode 100644index 0000000..548b01e--- /dev/null+++ b/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt@@ -0,0 +1,372 @@+// SPDX-License-Identifier: GPL-3.0-only+// Apps, Files and Tweaks icons are the Material Icons "apps", "folder" and "tune" (Apache-2.0), see NOTICE.++package app.tellyscope.ui++import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.Add+import androidx.compose.material.icons.filled.ArrowDropDown+import androidx.compose.material.icons.filled.Close+import androidx.compose.material.icons.filled.Delete+import androidx.compose.material.icons.filled.Edit+import androidx.compose.material.icons.filled.Home+import androidx.compose.material.icons.filled.Info+import androidx.compose.material.icons.filled.List+import androidx.compose.material.icons.filled.MoreVert+import androidx.compose.material.icons.filled.Search+import androidx.compose.material.icons.filled.Send+import androidx.compose.material.icons.filled.Settings+import androidx.compose.material3.Card+import androidx.compose.material3.CardDefaults+import androidx.compose.material3.Checkbox+import androidx.compose.material3.DropdownMenu+import androidx.compose.material3.DropdownMenuItem+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi+import androidx.compose.material3.FilledTonalButton+import androidx.compose.material3.HorizontalDivider+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Scaffold+import androidx.compose.material3.SegmentedButton+import androidx.compose.material3.SegmentedButtonDefaults+import androidx.compose.material3.ShortNavigationBar+import androidx.compose.material3.ShortNavigationBarItem+import androidx.compose.material3.SingleChoiceSegmentedButtonRow+import androidx.compose.material3.SnackbarHost+import androidx.compose.material3.SnackbarHostState+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.material3.TextField+import androidx.compose.material3.TextFieldDefaults+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.saveable.rememberSaveable+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.PathFillType+import androidx.compose.ui.graphics.SolidColor+import androidx.compose.ui.graphics.vector.ImageVector+import androidx.compose.ui.graphics.vector.PathParser+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import app.tellyscope.data.DeviceState+import app.tellyscope.data.Suggestions+import app.tellyscope.data.deviceKind++/** The TV page's destinations, one job each, in the bottom bar. */+enum class TvTab(val label: String) { Overview("Overview"), Apps("Apps"), Files("Files"), Tweaks("Tweaks") }++private object TabIcons {+ val Apps = icon(+ "Apps",+ "M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z",+ )+ val Folder = icon("Folder", "M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z")+ val Tune = icon(+ "Tune",+ "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z",+ )++ private fun icon(name: String, path: String) = ImageVector.Builder(name, 24.dp, 24.dp, 24f, 24f)+ .addPath(PathParser().parsePathString(path).toNodes(), pathFillType = PathFillType.NonZero, fill = SolidColor(Color.Black))+ .build()+}++private fun TvTab.icon() = when (this) {+ TvTab.Overview -> Icons.Default.Home+ TvTab.Apps -> TabIcons.Apps+ TvTab.Files -> TabIcons.Folder+ TvTab.Tweaks -> TabIcons.Tune+}++/**+ * The TV page as four tabs under a bottom bar, in place of one long scroll of folded sections.+ * The app bar is the same on every tab: the TV's name opens the TV menu, search jumps to Apps,+ * and the overflow holds the app-wide items.+ */+@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)+@Composable+fun DeviceTabsScreen(+ state: UiState,+ actions: DeviceActions,+ snackbar: SnackbarHostState = remember { SnackbarHostState() },+ startTab: TvTab = TvTab.Overview,+) {+ val device = state.selected ?: return+ val ui = state.device+ var tab by rememberSaveable { mutableStateOf(startTab) }+ var searching by rememberSaveable { mutableStateOf(false) }+ var onlyLocked by rememberSaveable { mutableStateOf(false) }+ val q = state.query.trim().lowercase()+ val offline = device.state != DeviceState.Online++ Scaffold(+ snackbarHost = { SnackbarHost(snackbar) },+ topBar = {+ if (searching) {+ TopAppBar(+ title = {+ TextField(+ value = state.query,+ onValueChange = actions.query,+ placeholder = { Text("Search apps") },+ singleLine = true,+ colors = TextFieldDefaults.colors(+ focusedContainerColor = Color.Transparent,+ unfocusedContainerColor = Color.Transparent,+ ),+ modifier = Modifier.fillMaxWidth(),+ )+ },+ actions = {+ IconButton(onClick = { searching = false; actions.query("") }) {+ Icon(Icons.Default.Close, contentDescription = "Close search")+ }+ },+ )+ } else {+ TopAppBar(+ title = { TvTitle(state, actions) },+ actions = {+ if (REMOTE_ENABLED) TextButton(onClick = actions.remote, enabled = !offline) { Text("Remote") }+ IconButton(onClick = { searching = true; tab = TvTab.Apps }, enabled = !offline) {+ Icon(Icons.Default.Search, contentDescription = "Search apps")+ }+ AppMenu(state, actions)+ },+ )+ }+ },+ bottomBar = {+ ShortNavigationBar {+ TvTab.entries.forEach { t ->+ ShortNavigationBarItem(+ selected = tab == t,+ onClick = { tab = t },+ icon = { Icon(t.icon(), contentDescription = null) },+ label = { Text(t.label) },+ )+ }+ }+ },+ ) { pad ->+ LazyColumn(+ Modifier.fillMaxSize().padding(pad),+ contentPadding = PaddingValues(start = 16.dp, end = 16.dp, top = 4.dp, bottom = 24.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp),+ ) {+ val snap = ui.snapshot+ val live = snap?.takeIf { !offline }+ when (tab) {+ TvTab.Overview -> {+ item { TvCard(state, live) }+ val restart = state.restarting[device.id]+ if (restart != null) {+ item { RestartingCard(restart, state.now) }+ } else if (device.state == DeviceState.NotAllowed) {+ item { NotAllowedCard(actions.reconnect) }+ } else if (offline) {+ item { OfflineCard(device, state.now, actions.reconnect) }+ }+ if (live != null) {+ item { SystemWidget(live) }+ } else if (offline && snap == null) {+ item { Muted(Copy.noStats(device.state)) }+ }+ if (!offline) {+ item {+ ActionTiles(+ actions,+ canDebloat = ui.lists is Suggestions.Pick || ui.lists is Suggestions.Ready,+ disabling = ui.busy == DISABLING,+ )+ }+ item { Panel("Suggested for this TV") { SuggestionsSummary(ui.lists) } }+ }+ }+ TvTab.Apps -> {+ val locked = ui.apps.count { it.protectedReason != null }+ item(key = "filter") { AppsFilter(ui.apps.size - locked, locked, onlyLocked) { onlyLocked = it } }+ val shown = ui.apps+ .filter { q.isEmpty() || it.label.lowercase().contains(q) || it.packageName.contains(q) }+ // A search looks through every app; the switch only narrows the plain list.+ .filter { q.isNotEmpty() || (it.protectedReason != null) == onlyLocked }+ .sortedWith(compareBy({ !it.enabled }, { it.system }, { it.label }))+ if (shown.isEmpty()) item { EmptyLine(q) }+ items(shown, key = { it.packageName }) { app ->+ AppRow(app, snap?.procs.orEmpty(), ui.pending, ui.busy == app.packageName, actions, homeLabel(ui.apps, app))+ }+ }+ TvTab.Files -> {+ if (offline) item { Muted("Connect to the TV to see its files.") }+ else {+ item {+ // The folder switch below picks where it lands, so no menu is needed here.+ @Suppress("DEPRECATION") // the AutoMirrored set isn't in icons-core+ FilledTonalButton(onClick = { actions.pickFile(ui.files.folder) }, Modifier.fillMaxWidth()) {+ Icon(Icons.Default.Send, contentDescription = null, Modifier.size(18.dp))+ Spacer(Modifier.width(8.dp))+ Text("Send a file to ${Copy.folder(ui.files.folder)}")+ }+ }+ item { FilesBlock(ui.files, state.now, actions) }+ }+ }+ TvTab.Tweaks -> {+ if (offline) item { Muted("Connect to the TV to change its settings.") }+ else item { Panel(Copy.TWEAKS) { TweaksBlock(ui, actions) } }+ item {+ Panel("Recent changes") {+ HistoryList(ui.history, state.now, actions.undo, restoring = ui.busy == RESTORING, onRestoreAll = actions.restoreAll)+ }+ }+ }+ }+ }+ if (!offline) ui.request?.let { RequestDialog(it, ui.busy == ANSWERING, actions.answerRequest, actions.dismissRequest) }+ ui.sideload?.let { SideloadDialog(it, actions) }+ ui.transfer?.let { TransferDialog(it, actions.cancelTransfer) }+ }+}++/** Apps the user can change by default; the switch's other side shows the ones Tellyscope protects. */+@Composable+private fun AppsFilter(changeable: Int, locked: Int, onlyLocked: Boolean, onChange: (Boolean) -> Unit) {+ SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) {+ listOf(false to "Changeable ($changeable)", true to "${Copy.CANT_CHANGE} ($locked)").forEachIndexed { i, (side, label) ->+ SegmentedButton(+ selected = onlyLocked == side,+ onClick = { onChange(side) },+ shape = SegmentedButtonDefaults.itemShape(i, 2),+ ) { Text(label, maxLines = 1, overflow = TextOverflow.Ellipsis) }+ }+ }+}++/** A titled card for a tab's block, not folded: each tab has room for it. */+@Composable+private fun Panel(title: String, body: @Composable () -> Unit) {+ Card(+ Modifier.fillMaxWidth(),+ colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow),+ ) {+ Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {+ Text(title, style = MaterialTheme.typography.titleMedium, modifier = Modifier.padding(bottom = 4.dp))+ body()+ }+ }+}++@Composable+private fun Muted(text: String) {+ Text(text, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+}++/** The app bar's title: which TV, and its menu of TV things (switch, add, rename, forget). */+@Composable+private fun TvTitle(state: UiState, actions: DeviceActions) {+ val device = state.selected ?: return+ var open by remember { mutableStateOf(false) }+ var forgetting by remember { mutableStateOf(false) }+ var renaming by remember { mutableStateOf(false) }+ if (forgetting) ForgetDialog(name(device), onForget = { forgetting = false; actions.forget(device.id) }, onDismiss = { forgetting = false })+ if (renaming) RenameDialog(device.nickname.orEmpty(), device.model ?: networkName(device), onSave = { renaming = false; actions.rename(device.id, it) }, onDismiss = { renaming = false })+ val offlineCount = state.devices.count { it.state != DeviceState.Online }+ Box {+ Row(+ Modifier.clip(MaterialTheme.shapes.large).clickable { open = true }.padding(vertical = 4.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(Modifier.weight(1f, fill = false)) {+ val title = name(device)+ Text(title, style = MaterialTheme.typography.titleLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)+ // Under a model-name title, the model would only say it twice.+ val maker = device.manufacturer ?: device.hit.maker+ val made = if (title == device.model) maker.orEmpty() else made(maker, device.model)+ if (made.isNotEmpty()) {+ Text(made, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)+ }+ }+ Icon(Icons.Default.ArrowDropDown, contentDescription = "Switch TV")+ }+ DropdownMenu(open, onDismissRequest = { open = false }) {+ state.devices+ .filter { state.showOffline || it.state == DeviceState.Online || it.id == state.selectedId }+ .forEach { d ->+ DropdownMenuItem(+ text = {+ Column {+ Text(name(d), maxLines = 1, overflow = TextOverflow.Ellipsis)+ Row(verticalAlignment = Alignment.CenterVertically) {+ StateDot(d.state)+ Spacer(Modifier.width(6.dp))+ Text(+ if (d.state == DeviceState.Online) Copy.state(d.state)+ else d.lastSeen?.let { "${Copy.state(d.state)}, seen ${Copy.ago(it, state.now)}" } ?: Copy.state(d.state),+ style = MaterialTheme.typography.labelSmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }+ }+ },+ leadingIcon = { Icon(DeviceIcons.of(deviceKind(d)), contentDescription = deviceKind(d).word()) },+ onClick = { open = false; actions.select(d.id) },+ )+ }+ HorizontalDivider()+ DropdownMenuItem(+ text = { Text("Show offline ($offlineCount)") },+ leadingIcon = { Checkbox(state.showOffline, onCheckedChange = null) },+ onClick = { actions.showOffline(!state.showOffline) },+ )+ DropdownMenuItem(text = { Text("Add a TV") }, leadingIcon = { Icon(Icons.Default.Add, null) }, onClick = { open = false; actions.addDevice() })+ DropdownMenuItem(text = { Text("Rename this TV") }, leadingIcon = { Icon(Icons.Default.Edit, null) }, onClick = { open = false; renaming = true })+ DropdownMenuItem(text = { Text("Forget this TV") }, leadingIcon = { Icon(Icons.Default.Delete, null) }, onClick = { open = false; forgetting = true })+ }+ }+}++/** The overflow: app-wide items, the same whichever TV is shown. */+@Composable+private fun AppMenu(state: UiState, actions: DeviceActions) {+ var open by remember { mutableStateOf(false) }+ var about by remember { mutableStateOf(false) }+ if (about) AboutDialog(+ when (val l = state.device.lists) {+ is Suggestions.Pick -> l.commit+ is Suggestions.Ready -> l.commit+ else -> null+ },+ onDismiss = { about = false },+ )+ Box {+ IconButton(onClick = { open = true }) { Icon(Icons.Default.MoreVert, contentDescription = "More options") }+ DropdownMenu(open, onDismissRequest = { open = false }) {+ DropdownMenuItem(text = { Text("Advanced") }, leadingIcon = { Icon(Icons.Default.List, null) }, onClick = { open = false; actions.advanced() })+ DropdownMenuItem(text = { Text("Settings") }, leadingIcon = { Icon(Icons.Default.Settings, null) }, onClick = { open = false; actions.settings() })+ DropdownMenuItem(text = { Text("About & licences") }, leadingIcon = { Icon(Icons.Default.Info, null) }, onClick = { open = false; about = true })+ }+ }+}diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.ktindex c8e332d..3c2d363 100644--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt@@ -14,6 +14,7 @@ import androidx.compose.ui.unit.dpimport androidx.compose.ui.test.junit4.v2.createComposeRuleimport androidx.compose.ui.test.assertIsEnabledimport androidx.compose.ui.test.assertIsNotEnabled+import androidx.compose.ui.test.assertIsSelectedimport androidx.compose.ui.test.onNodeWithContentDescriptionimport androidx.compose.ui.test.onNodeWithTextimport androidx.compose.ui.test.onAllNodesWithText@@ -47,7 +48,8 @@ import app.tellyscope.data.Suggestionsimport app.tellyscope.ui.AdvancedScreenimport app.tellyscope.ui.DebloatScreenimport app.tellyscope.ui.DeviceActions-import app.tellyscope.ui.DeviceScreen+import app.tellyscope.ui.DeviceTabsScreen+import app.tellyscope.ui.TvTabimport app.tellyscope.ui.Copyimport app.tellyscope.ui.TweaksBlockimport app.tellyscope.ui.DeviceUi@@ -185,30 +187,71 @@ class ScreenshotTest {return ready.copy(devices = ready.devices + others)}+ // Bottom-navigation mock-ups: the TV page as four tabs, light and dark, plus both app-bar menus.+ private fun tabsState(): UiState {+ val history = listOf(+ HistoryEntry(2, xgimi.ip, now - 40_000, Action.Disable, "com.xgimi.ota", "XGIMI Updates", Action.Enable, null),+ HistoryEntry(1, xgimi.ip, now - 5 * 60_000, Action.Stop, "com.netflix.ninja", "Netflix", Action.Open, now - 4 * 60_000),+ )+ val files = listOf(+ TvFile("subtitles.srt", 61_000, now - 40 * 60_000L),+ TvFile("kodi-21.1-armeabi-v7a.apk", 74_000_000, now - 5 * 3_600_000L),+ TvFile("holiday-2025.mp4", 812_000_000, now - 3 * 86_400_000L),+ )+ val tweaks = TvTweaks(dnsHost = TvSettings.ADGUARD, animationScale = null)+ return deviceState { copy(history = history, files = FilesUi(TvFolder.DOWNLOAD, files), tweaks = tweaks) }+ }++ private fun tabShots(tab: TvTab, name: String) {+ shot(name) { DeviceTabsScreen(tabsState(), DeviceActions(), startTab = tab) }+ }++ @Test fun tabs_overview() = tabShots(TvTab.Overview, "40_tabs_overview")+ @Test fun tabs_apps() = tabShots(TvTab.Apps, "41_tabs_apps")+ @Test fun tabs_files() = tabShots(TvTab.Files, "42_tabs_files")+ @Test fun tabs_tweaks() = tabShots(TvTab.Tweaks, "43_tabs_tweaks")+ @Test fun tabs_overview_dark() = shot("40_tabs_overview", dark = true) { DeviceTabsScreen(tabsState(), DeviceActions(), startTab = TvTab.Overview) }+ @Test fun tabs_apps_dark() = shot("41_tabs_apps", dark = true) { DeviceTabsScreen(tabsState(), DeviceActions(), startTab = TvTab.Apps) }+ @Test fun tabs_files_dark() = shot("42_tabs_files", dark = true) { DeviceTabsScreen(tabsState(), DeviceActions(), startTab = TvTab.Files) }+ @Test fun tabs_tweaks_dark() = shot("43_tabs_tweaks", dark = true) { DeviceTabsScreen(tabsState(), DeviceActions(), startTab = TvTab.Tweaks) }++ @Test fun tabs_tvMenu() {+ val open = {+ compose.onNodeWithContentDescription("Switch TV").performClick()+ compose.mainClock.advanceTimeBy(1_000)+ compose.onNodeWithText("Add a TV").assertExists()+ Unit+ }+ shot("44_tabs_tv_menu", screen = true, before = open) { DeviceTabsScreen(tabsState().copy(showOffline = true), DeviceActions()) }+ }++ @Test fun tabs_appMenu() {+ val open = {+ compose.onNodeWithContentDescription("More options").performClick()+ compose.mainClock.advanceTimeBy(1_000)+ compose.onNodeWithText("About & licences").assertExists()+ Unit+ }+ shot("45_tabs_app_menu", screen = true, before = open) { DeviceTabsScreen(tabsState(), DeviceActions()) }+ }+@Test fun device_overview() {- shot("04_device") { DeviceScreen(deviceState(), DeviceActions()) }+ shot("04_device") { DeviceTabsScreen(deviceState(), DeviceActions()) }// Plain words on the main page: no Details expander, no MB per app; numbers live on Advanced.compose.onNodeWithText("Details").assertDoesNotExist()- compose.onNodeWithText("Advanced").assertExists()+ compose.onNodeWithContentDescription("More options").assertExists() // Advanced is in there nowcompose.onNodeWithText("Running · ", substring = true).assertDoesNotExist()// The three main actions sit under the system widget, Debloat among them.for (t in listOf("Install app", "Debloat", "Send file")) compose.onNodeWithText(t).assertIsEnabled()for (t in listOf("Up for", "Last software update", "Internal storage", "Network")) compose.onNodeWithText(t).assertExists()}- @Test fun device_overview_dark() = shot("04_device", dark = true) { DeviceScreen(deviceState(), DeviceActions()) }-- @Test fun device_picker() = shot("04_device_picker", screen = true, before = {- compose.onNodeWithContentDescription("Switch TV").performClick()- compose.mainClock.advanceTimeBy(1_000)- compose.onNodeWithText("Add a TV").assertExists()- Unit- }) { DeviceScreen(deviceState().copy(showOffline = true), DeviceActions()) }+ @Test fun device_overview_dark() = shot("04_device", dark = true) { DeviceTabsScreen(deviceState(), DeviceActions()) }@Config(qualifiers = "w411dp-h1500dp-xxhdpi")@Test fun device_confirmDisable() {val state = deviceState { copy(pending = "com.xgimi.assistant" to Action.Disable) }- shot("05_device_confirm_disable") { DeviceScreen(state, DeviceActions()) }+ shot("05_device_confirm_disable") { DeviceTabsScreen(state, DeviceActions(), startTab = TvTab.Apps) }}@Test fun device_offline() {@@ -217,7 +260,7 @@ class ScreenshotTest {// The last stats this phone saw, 14 minutes before it went away.val last = fake.snapshot(off.id).copy(at = now - 14 * 60_000)shot("06_device_offline") {- DeviceScreen(base.copy(selectedId = off.id, device = DeviceUi(snapshot = last), showOffline = true), DeviceActions())+ DeviceTabsScreen(base.copy(selectedId = off.id, device = DeviceUi(snapshot = last), showOffline = true), DeviceActions())}// Old numbers don't speak for a TV that's away; what it is still does.compose.onNodeWithText("Up for").assertDoesNotExist()@@ -227,7 +270,7 @@ class ScreenshotTest {@Test fun device_storageFull() {val state = deviceState { copy(snapshot = snapshot?.copy(storageUsedGb = 29.1, storageTotalGb = 32.0)) }- shot("13_device_storage_full") { DeviceScreen(state, DeviceActions()) }+ shot("13_device_storage_full") { DeviceTabsScreen(state, DeviceActions()) }}// Tall enough that History is composed without scrolling: the lazy list never lays it out otherwise.@@ -237,12 +280,7 @@ class ScreenshotTest {HistoryEntry(2, xgimi.ip, now - 40_000, Action.Disable, "com.xgimi.ota", "XGIMI Updates", Action.Enable, null),HistoryEntry(1, xgimi.ip, now - 5 * 60_000, Action.Stop, "com.netflix.ninja", "Netflix", Action.Open, now - 4 * 60_000),)- val openHistory = {- compose.onNodeWithText("Apps").performClick() // fold the long list away- compose.onNodeWithText("History").performClick()- Unit- }- shot("07_device_history", before = openHistory) { DeviceScreen(deviceState { copy(history = history) }, DeviceActions()) }+ shot("07_device_history") { DeviceTabsScreen(deviceState { copy(history = history) }, DeviceActions(), startTab = TvTab.Tweaks) }}@Config(qualifiers = "w411dp-h2600dp-xxhdpi")@@ -250,15 +288,12 @@ class ScreenshotTest {val turnedOn = HistoryEntry(3, xgimi.ip, now - 20_000, Action.Enable, "com.xgimi.assistant", "XGIMI Assistant", Action.Disable, null)val undone = mutableListOf<HistoryEntry>()val openAndTap = {- compose.onNodeWithText("Apps").performClick()- compose.onNodeWithText("History").performClick()- compose.mainClock.advanceTimeBy(1_000)// The button says what it does, and a tap only asks.compose.onNodeWithText("Disable").performClick()Unit}shot("16_history_undo_disable", screen = true, before = openAndTap) {- DeviceScreen(deviceState { copy(history = listOf(turnedOn)) }, DeviceActions(undo = { undone += it }))+ DeviceTabsScreen(deviceState { copy(history = listOf(turnedOn)) }, DeviceActions(undo = { undone += it }), startTab = TvTab.Tweaks)}compose.onNodeWithText("Disable XGIMI Assistant?").assertExists()assertEquals(emptyList<HistoryEntry>(), undone)@@ -275,7 +310,7 @@ class ScreenshotTest {compose.mainClock.advanceTimeBy(1_000)}shot("26_apps_uninstall_offered", screen = true, before = { tap("Netflix"); tap("XGIMI Assistant"); Unit }) {- DeviceScreen(deviceState(), DeviceActions(propose = { pkg, a -> proposed += pkg to a }))+ DeviceTabsScreen(deviceState(), DeviceActions(propose = { pkg, a -> proposed += pkg to a }), startTab = TvTab.Apps)}// Netflix was installed by the user; XGIMI Assistant came with the TV and only gets Disable.compose.onAllNodesWithText("Uninstall").assertCountEquals(1)@@ -285,7 +320,7 @@ class ScreenshotTest {@Test fun apps_uninstallAsksInADialog() {val state = deviceState { copy(pending = "com.netflix.ninja" to Action.Uninstall) }- shot("27_apps_uninstall_confirm", screen = true) { DeviceScreen(state, DeviceActions()) }+ shot("27_apps_uninstall_confirm", screen = true) { DeviceTabsScreen(state, DeviceActions(), startTab = TvTab.Apps) }compose.onNodeWithText("Uninstall Netflix?").assertExists()compose.onNodeWithText("can't be undone", substring = true).assertExists()compose.onNodeWithText("Yes, uninstall it").assertExists()@@ -293,10 +328,10 @@ class ScreenshotTest {@Config(qualifiers = "w411dp-h2600dp-xxhdpi")@Test fun apps_protectedAreFoldedAway() {- shot("28_apps_protected_folded", screen = true) { DeviceScreen(deviceState(), DeviceActions()) }- compose.onNodeWithText("Can't be changed").assertExists()+ shot("28_apps_protected_folded", screen = true) { DeviceTabsScreen(deviceState(), DeviceActions(), startTab = TvTab.Apps) }+ compose.onNodeWithText("Changeable", substring = true).assertIsSelected()compose.onNodeWithText("System UI").assertDoesNotExist()- compose.onNodeWithText("Can't be changed").performClick()+ compose.onNodeWithText("Can't be changed", substring = true).performClick()compose.mainClock.advanceTimeBy(1_000)compose.onNodeWithText("System UI").assertExists()}@@ -388,13 +423,13 @@ class ScreenshotTest {@Test fun apps_helperNames() {val labels = listOf("YouTube", "Netflix", "Jellyfin", "Weather Box", "XGIMI Assistant")val apps = tvApps.zip(labels) { (pkg, color), label -> app(pkg, label, iconPng(color)) }- shot("09_apps_helper_names") { DeviceScreen(appsState(apps), DeviceActions()) }+ shot("09_apps_helper_names") { DeviceTabsScreen(appsState(apps), DeviceActions(), startTab = TvTab.Apps) }}@Test fun apps_fallbackNames() {// The helper was refused: bundled names where known, a humanised id otherwise, letter avatars.val apps = tvApps.map { (pkg, _) -> app(pkg, AppNames.fallback(pkg), null) }- shot("10_apps_fallback_names") { DeviceScreen(appsState(apps), DeviceActions()) }+ shot("10_apps_fallback_names") { DeviceTabsScreen(appsState(apps), DeviceActions(), startTab = TvTab.Apps) }}/** The Files section's body on its own: the section is collapsed on the full page. */@@ -422,16 +457,12 @@ class ScreenshotTest {HistoryEntry(2, xgimi.ip, now - 60_000, Action.Change, "ANIMATIONS", "Animations at 0.5×", Action.Change, null, mapOf("window_animation_scale" to null)),HistoryEntry(1, xgimi.ip, now - 90_000, Action.Change, "PRIVATE_DNS", "Private DNS set to ${TvSettings.ADGUARD}", Action.Change, null, mapOf("private_dns_mode" to "opportunistic")),)- shot("16_device_tweaks_history", before = {- compose.onNodeWithText("Apps").performClick()- compose.onNodeWithText("History").performClick()- Unit- }) { DeviceScreen(deviceState { copy(history = history) }, DeviceActions()) }+ shot("16_device_tweaks_history") { DeviceTabsScreen(deviceState { copy(history = history) }, DeviceActions(), startTab = TvTab.Tweaks) }}@Test fun device_connectionRequest() = shot("17_device_request", screen = true) {val request = ConnectionRequest("AB:CD:EF:01:23:45:67:89:AB:CD:EF:01:23:45:67:89")- DeviceScreen(deviceState { copy(request = request) }, DeviceActions())+ DeviceTabsScreen(deviceState { copy(request = request) }, DeviceActions())}private val dir = Files.createTempDirectory("shots").toFile()@@ -444,7 +475,7 @@ class ScreenshotTest {)private fun sideload(name: String, s: SideloadUi, dark: Boolean = false) =- shot(name, dark, screen = true) { DeviceScreen(deviceState { copy(sideload = s) }, DeviceActions()) }+ shot(name, dark, screen = true) { DeviceTabsScreen(deviceState { copy(sideload = s) }, DeviceActions()) }@Test fun sideload_new() = sideload("10_sideload_new", SideloadUi(SideloadUi.Step.Ready, split, null))@@ -472,7 +503,7 @@ class ScreenshotTest {@Test fun transfer() = shot("15_transfer", screen = true) {val t = TransferUi("holiday-2025.mp4", toTv = false, folder = TvFolder.DOWNLOAD, progress = Progress(301_000_000, 812_000_000))- DeviceScreen(deviceState { copy(transfer = t) }, DeviceActions())+ DeviceTabsScreen(deviceState { copy(transfer = t) }, DeviceActions())}@Test fun permission() = shot("08_permission") { PermissionScreen(denied = false, canAsk = true, {}, {}) }@@ -494,7 +525,7 @@ class ScreenshotTest {val base = deviceState()val off = base.devices.last().copy(state = DeviceState.NotAllowed)shot("12_device_not_allowed") {- DeviceScreen(base.copy(devices = base.devices.dropLast(1) + off, selectedId = off.id, device = DeviceUi()), DeviceActions())+ DeviceTabsScreen(base.copy(devices = base.devices.dropLast(1) + off, selectedId = off.id, device = DeviceUi()), DeviceActions())}}@@ -511,7 +542,7 @@ class ScreenshotTest {@Test fun device_restarting() {val state = deviceState().let { it.copy(restarting = mapOf(it.selectedId!! to Restart(now - 200_000, down = true))) }- shot("14_device_restarting") { DeviceScreen(state, DeviceActions()) }+ shot("14_device_restarting") { DeviceTabsScreen(state, DeviceActions()) }}@Test fun reboot() = shot("15_reboot", screen = true) { RebootDialog({}, {}) }@@ -650,12 +681,7 @@ class ScreenshotTest {HistoryEntry(2, xgimi.ip, now - 5 * 60_000, Action.Stop, "com.netflix.ninja", "Netflix", Action.Open, null),HistoryEntry(1, xgimi.ip, now - 2 * 3_600_000, Action.Stop, "com.google.android.youtube.tv", "YouTube", Action.Open, now - 3_500_000),)- val openHistory = {- compose.onNodeWithText("Apps").performClick() // fold the long list away- compose.onNodeWithText("History").performClick()- Unit- }- shot("22_readme_history", before = openHistory) { DeviceScreen(deviceState { copy(history = history) }, DeviceActions()) }+ shot("22_readme_history") { DeviceTabsScreen(deviceState { copy(history = history) }, DeviceActions(), startTab = TvTab.Tweaks) }compose.onNodeWithText("Restore everything (2)").assertExists()}@Test fun readme_install() {@@ -678,25 +704,15 @@ class ScreenshotTest {TvFile("holiday-2025.mp4", 812_000_000, now - 3 * 86_400_000L),TvFile("wallpaper-mountains.jpg", 2_400_000, now - 9 * 86_400_000L),)- val openFiles = {- compose.onNodeWithText("Apps").performClick() // fold the long list away- compose.onNodeWithText("Files on the TV").performClick()- Unit- }- shot("24_readme_files", before = openFiles) { DeviceScreen(deviceState { copy(files = FilesUi(TvFolder.DOWNLOAD, files)) }, DeviceActions()) }+ shot("24_readme_files") { DeviceTabsScreen(deviceState { copy(files = FilesUi(TvFolder.DOWNLOAD, files)) }, DeviceActions(), startTab = TvTab.Files) }compose.onNodeWithText("wallpaper-mountains.jpg").assertExists()}// Tall, like readme_history: frame.py scrolls it down to TV tweaks.@Config(qualifiers = "w411dp-h2600dp-xxhdpi")@Test fun readme_tweaks() {- val openTweaks = {- compose.onNodeWithText("Apps").performClick() // fold the long list away- compose.onNodeWithText(Copy.TWEAKS).performClick()- Unit- }val tweaks = TvTweaks(dnsHost = TvSettings.ADGUARD, animationScale = null)- shot("29_readme_tweaks", before = openTweaks) { DeviceScreen(deviceState { copy(tweaks = tweaks) }, DeviceActions()) }+ shot("29_readme_tweaks") { DeviceTabsScreen(deviceState { copy(tweaks = tweaks) }, DeviceActions(), startTab = TvTab.Tweaks) }compose.onNodeWithText(Copy.dnsState(TvSettings.ADGUARD)).assertExists()}@@ -709,13 +725,12 @@ class ScreenshotTest {val projectivy = { a: AppInfo -> a.copy(protectedReason = null, system = false, removable = true, homeInstead = stock.packageName) }copy(apps = listOf(stock) + apps.map { if (it.packageName == "com.spocky.projengmenu") projectivy(it) else it }, pending = "com.spocky.projengmenu" to Action.Home)}- val foldSuggested = { compose.onNodeWithText("Suggested for this TV").performClick(); Unit }- shot("30_readme_home", before = foldSuggested) { DeviceScreen(state, DeviceActions()) }+ shot("30_readme_home") { DeviceTabsScreen(state, DeviceActions(), startTab = TvTab.Apps) }compose.onNodeWithText("Yes, switch home screen").assertExists()}@Test fun readme_send() = shot("25_readme_send", screen = true) {val t = TransferUi("family-trip-2025.mp4", toTv = true, folder = TvFolder.MOVIES, progress = Progress(486_000_000, 812_000_000))- DeviceScreen(deviceState { copy(transfer = t) }, DeviceActions())+ DeviceTabsScreen(deviceState { copy(transfer = t) }, DeviceActions())}}