Skip to content

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.

Overview: the TV first, chips to switch, debloat counts

jesse-agent-362f550fca7d82d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6ae9ad..470e52a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ until this file has a section for its version.
## Unreleased
+- **Improved:** Overview puts the TV first, with chips to switch and debloat counts. [#64](../../pull/64)
- **Improved:** An offline TV keeps its maker and Android version after the app restarts. [#63](../../pull/63)
## 0.4.0 — 2026-10-24
diff --git a/NOTICE b/NOTICE
index 303f180..a7b28ab 100644
--- a/NOTICE
+++ b/NOTICE
@@ -24,7 +24,8 @@ License: Apache License 2.0
The TV and HDMI (streaming stick) device icons use the path data of the
"tv" and "settings_input_hdmi" icons, the Debloat button that of
"cleaning_services", the off-Wi-Fi screen that of "wifi_off", and the
-Apps, Files and Tweaks tabs those of "apps", "folder" and "tune".
+Apps, Files and Tweaks tabs those of "apps", "folder" and "tune", and the
+Upload files button that of "upload".
--------------------------------------------------------------------------------
cleanyourtv — https://github.com/Gathin23/cleanyourtv
diff --git a/adb/src/main/kotlin/app/tellyscope/adb/Remote.kt b/adb/src/main/kotlin/app/tellyscope/adb/Remote.kt
index 9f50e11..630964e 100644
--- a/adb/src/main/kotlin/app/tellyscope/adb/Remote.kt
+++ b/adb/src/main/kotlin/app/tellyscope/adb/Remote.kt
@@ -29,6 +29,15 @@ class Remote(private val session: AdbSession) {
/** False when the TV answered with an error. Throws if the link is gone. */
suspend fun press(key: RemoteKey): Boolean = session.shell("input keyevent ${key.code}").exitCode == 0
+ /**
+ * Opens the TV's own system update screen. Some builds have none, and older `am` reports a
+ * missing screen in its output with exit code 0, so both are checked.
+ */
+ suspend fun openUpdates(): Boolean {
+ val r = session.shell("am start -a android.settings.SYSTEM_UPDATE_SETTINGS 2>&1")
+ return r.exitCode == 0 && !r.output.contains("Error")
+ }
+
/** Types [text] into whatever box has focus on the TV. Check [typeable] first. */
suspend fun type(text: String): Boolean = session.shell(typeCommand(text)).exitCode == 0
diff --git a/app/src/main/java/app/tellyscope/MainActivity.kt b/app/src/main/java/app/tellyscope/MainActivity.kt
index 2df872f..c1a722e 100644
--- a/app/src/main/java/app/tellyscope/MainActivity.kt
+++ b/app/src/main/java/app/tellyscope/MainActivity.kt
@@ -244,6 +244,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {
remote = { remote = true },
debloat = { debloat = true },
advanced = { advanced = true },
+ checkUpdates = vm::checkUpdates,
setDns = vm::setDns,
setFastAnimations = vm::setFastAnimations,
clearCaches = vm::clearCaches,
diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
index 6f21c1e..a617b70 100644
--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
@@ -495,6 +495,8 @@ class AdbDeviceSource(context: Context) : DeviceSource {
override suspend fun reboot(deviceId: String) = Remote(session(deviceId)).reboot()
+ override suspend fun openUpdates(deviceId: String) = Remote(session(deviceId)).openUpdates()
+
override suspend fun tweaks(deviceId: String): TvTweaks {
val t = Tweaks(session(deviceId))
return TvSettings.tweaks(t.read(Tweak.PRIVATE_DNS), t.read(Tweak.ANIMATIONS), sdk(deviceId))
diff --git a/app/src/main/java/app/tellyscope/data/DeviceSource.kt b/app/src/main/java/app/tellyscope/data/DeviceSource.kt
index edd1e17..9177863 100644
--- a/app/src/main/java/app/tellyscope/data/DeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/DeviceSource.kt
@@ -115,6 +115,9 @@ interface DeviceSource {
/** Restarts the TV. The link drops and reconnects on its own once the TV is back. False if the TV refused. */
suspend fun reboot(deviceId: String): Boolean
+ /** Opens the TV's system update screen on the TV. False when the TV has no such screen. */
+ suspend fun openUpdates(deviceId: String): Boolean
+
/** Private DNS and animation speed as the TV has them now. */
suspend fun tweaks(deviceId: String): TvTweaks
diff --git a/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt b/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt
index a00242d..66cc879 100644
--- a/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt
@@ -308,6 +308,11 @@ class FakeDeviceSource(
return true
}
+ override suspend fun openUpdates(deviceId: String): Boolean {
+ delay(300)
+ return true
+ }
+
override suspend fun reboot(deviceId: String): Boolean {
delay(300)
remembered[deviceId]?.let { remembered[deviceId] = it.copy(state = DeviceState.Offline) }
diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.kt
index d7bdd50..107d7d3 100644
--- a/app/src/main/java/app/tellyscope/ui/Copy.kt
+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt
@@ -286,6 +286,8 @@ object Copy {
const val KEY_REFUSED = "The TV didn't take that key."
const val TYPE_REFUSED = "The TV didn't take the text. Select a text box on the TV first, then send again."
const val REMOTE_LOST = "Lost the TV. Check it's still on and connected."
+ const val NO_UPDATE_SCREEN = "This TV has no update screen Tellyscope can open. Look in its Settings, under System or About."
+ const val UPDATES_OPENED = "Opened the update screen on the TV. Look at the TV to check for updates."
const val REBOOT_REFUSED = "The TV said no to restarting. Use its own remote or power button instead."
const val REBOOT_IGNORED = "The TV didn't restart. Use its own remote or power button instead."
const val REMOTE_OFFLINE = "The TV is offline. The remote works again once it reconnects."
diff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
index 426519f..50d406d 100644
--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
@@ -96,6 +96,8 @@ data class DeviceActions(
val debloat: () -> Unit = {},
/** Opens the Advanced screen: every number, per-app CPU and RAM, processes and network. */
val advanced: () -> Unit = {},
+ /** Opens the TV's own system update screen. */
+ val checkUpdates: () -> Unit = {},
/** Ad-blocking Private DNS through the given hostname; null goes back to Automatic. */
val setDns: (String?) -> Unit = {},
val setFastAnimations: (Boolean) -> Unit = {},
@@ -111,55 +113,6 @@ data class DeviceActions(
/** Off while the remote is made faster: the device page hides its Remote button. */
internal const val REMOTE_ENABLED = false
-/**
- * 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
-internal fun TvCard(state: UiState, live: Snapshot?) {
- val device = state.selected ?: return
- val facts = listOfNotNull(
- "IP address" to device.hit.ip,
- live?.uptimeSeconds?.takeIf { it > 0 }?.let { "Up for" to Copy.upFor(it) },
- device.android?.let { "Android" to it },
- // Not live: the software doesn't change while the TV is away.
- state.device.snapshot?.softwareMonth?.let { "Last software update" to Copy.month(it) },
- )
- Card(
- Modifier.fillMaxWidth().padding(top = 4.dp),
- shape = MaterialTheme.shapes.extraLarge,
- colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow),
- ) {
- Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
- if (live != null) {
- HealthLine(Copy.health(live, heaviest(live, state.device.apps)))
- } else {
- Row(verticalAlignment = Alignment.CenterVertically) {
- StateDot(device.state)
- Spacer(Modifier.width(8.dp))
- Text(Copy.state(device.state), style = MaterialTheme.typography.titleMedium)
- }
- }
- Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
- facts.chunked(2).forEach { pair ->
- Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
- pair.forEach { (k, v) -> Fact(k, v, Modifier.weight(1f)) }
- if (pair.size == 1) Spacer(Modifier.weight(1f))
- }
- }
- }
- }
- }
-}
-
-@Composable
-private fun Fact(label: String, value: String, modifier: Modifier = Modifier) {
- Column(modifier) {
- Text(label, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
- Text(value, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
- }
-}
-
/**
* The TV's vitals in one small card: internal storage as a full bar, since it decides whether an
* install fits, then CPU, RAM, temperature and network speed as plain numbers.
@@ -356,20 +309,6 @@ internal fun heaviest(snap: Snapshot, apps: List<AppInfo>): List<String> {
.entries.sortedByDescending { it.value }.map { it.key }
}
-@Composable
-private fun HealthLine(h: Copy.Health) {
- Row(verticalAlignment = Alignment.CenterVertically) {
- Icon(
- if (h.ok) Icons.Default.CheckCircle else Icons.Default.Warning,
- contentDescription = null,
- Modifier.size(24.dp),
- tint = if (h.ok) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.error,
- )
- Spacer(Modifier.width(8.dp))
- Text(h.text, style = MaterialTheme.typography.titleMedium)
- }
-}
-
@Composable
internal fun EmptyLine(q: String) {
Text(
diff --git a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt b/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt
index c0aaed2..bcb4de0 100644
--- a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt
+++ b/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt
@@ -1,9 +1,39 @@
// 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.
+// Apps, Files and Tweaks icons are the Material Icons "apps", "folder" and "tune", and Upload is
+// "upload" (Apache-2.0), see NOTICE.
package app.tellyscope.ui
+import androidx.compose.material3.ExtendedFloatingActionButton
+import androidx.compose.material3.Button
+import androidx.compose.material3.MaterialShapes
+import androidx.compose.material3.toShape
+import androidx.compose.material3.ListItem
+import androidx.compose.material3.ListItemDefaults
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.foundation.lazy.rememberLazyListState
+import androidx.compose.runtime.LaunchedEffect
import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.layout.offset
+import androidx.compose.foundation.layout.widthIn
+import androidx.compose.material3.AssistChip
+import androidx.compose.material3.FilterChip
+import androidx.compose.ui.draw.alpha
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.icons.filled.CheckCircle
+import androidx.compose.material.icons.filled.Warning
+import androidx.compose.material3.Surface
+import androidx.compose.material3.LinearProgressIndicator
+import app.tellyscope.data.Device
+import app.tellyscope.data.Action
+import app.tellyscope.data.Snapshot
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -69,7 +99,11 @@ 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.SpanStyle
+import androidx.compose.ui.text.buildAnnotatedString
+import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import app.tellyscope.data.DeviceState
import app.tellyscope.data.Suggestions
@@ -103,8 +137,8 @@ private fun TvTab.icon() = when (this) {
/**
* 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.
+ * Overview leads with the TV itself, big and centred, and a chip per TV to switch; the other tabs
+ * name the TV in the app bar. Search (Apps only) and the overflow sit on the right.
*/
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@Composable
@@ -121,9 +155,24 @@ fun DeviceTabsScreen(
var onlyLocked by rememberSaveable { mutableStateOf(false) }
val q = state.query.trim().lowercase()
val offline = device.state != DeviceState.Online
+ val list = rememberLazyListState()
+ // "See changes" lands on Tweaks scrolled to Recent changes, the list's second item.
+ var toChanges by remember { mutableStateOf(false) }
+ LaunchedEffect(tab, toChanges) {
+ if (tab == TvTab.Tweaks && toChanges) { list.scrollToItem(1); toChanges = false }
+ }
Scaffold(
snackbarHost = { SnackbarHost(snackbar) },
+ // Each tab's main action as Material's extended FAB: install on Apps, upload on Files.
+ floatingActionButton = {
+ if (!offline) when (tab) {
+ TvTab.Apps -> ExtendedFloatingActionButton(onClick = actions.pickApp, icon = { Icon(Icons.Default.Add, null) }, text = { Text("Install app") })
+ @Suppress("DEPRECATION") // the AutoMirrored set isn't in icons-core
+ TvTab.Files -> ExtendedFloatingActionButton(onClick = { actions.pickFile(ui.files.folder) }, icon = { Icon(TileIcons.Upload, null) }, text = { Text("Upload files") })
+ else -> {}
+ }
+ },
topBar = {
if (searching) {
TopAppBar(
@@ -148,7 +197,8 @@ fun DeviceTabsScreen(
)
} else {
TopAppBar(
- title = { TvTitle(state, actions) },
+ // Overview shows the TV big below; the bar says which TV only on the other tabs.
+ title = { if (tab != TvTab.Overview) BarName(state) },
actions = {
if (REMOTE_ENABLED) TextButton(onClick = actions.remote, enabled = !offline) { Text("Remote") }
// Search only looks through apps, so it only shows on the Apps tab.
@@ -181,14 +231,15 @@ fun DeviceTabsScreen(
) { pad ->
LazyColumn(
Modifier.fillMaxSize().padding(pad),
- contentPadding = PaddingValues(start = 16.dp, end = 16.dp, top = 4.dp, bottom = 24.dp),
+ state = list,
+ contentPadding = PaddingValues(start = 16.dp, end = 16.dp, top = 4.dp, bottom = 96.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
val snap = ui.snapshot
val live = snap?.takeIf { !offline }
when (tab) {
TvTab.Overview -> {
- item { TvCard(state, live) }
+ item { Hero(state, live, actions) }
val restart = state.restarting[device.id]
if (restart != null) {
item { RestartingCard(restart, state.now) }
@@ -202,16 +253,22 @@ fun DeviceTabsScreen(
} else if (offline && snap == null) {
item { Muted(Copy.noStats(device.state)) }
}
+ val debloat = debloatState(ui)
if (!offline) {
item {
ActionTiles(
actions,
- canDebloat = ui.lists is Suggestions.Pick || ui.lists is Suggestions.Ready,
+ count = debloat.count,
+ todo = debloat.todo,
disabling = ui.busy == DISABLING,
+ // With nothing left on the list, Debloat leads to the apps for one-off changes.
+ onDebloat = if (debloat.todo) actions.debloat else ({ tab = TvTab.Apps }),
)
}
- item { Panel("Suggested for this TV") { SuggestionsSummary(ui.lists) } }
}
+ item { SectionTitle("Suggested for this TV") }
+ item { SuggestedCard(ui.lists, debloat, offline, onChanges = { toChanges = true; tab = TvTab.Tweaks }) }
+ item { AndroidCard(state, snap, offline, onUpdates = actions.checkUpdates) }
}
TvTab.Apps -> {
val locked = ui.apps.count { it.protectedReason != null }
@@ -229,15 +286,6 @@ fun DeviceTabsScreen(
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) }
}
}
@@ -291,77 +339,14 @@ 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,
- ) {
- val kind = deviceKind(device)
- Icon(DeviceIcons.of(kind), contentDescription = kind.word(), Modifier.padding(end = 12.dp))
- 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. */
+/** The overflow: this TV's own items first, named so it's clear which TV they touch, then the app-wide ones. */
@Composable
private fun AppMenu(state: UiState, actions: DeviceActions) {
var open by remember { mutableStateOf(false) }
var about by remember { mutableStateOf(false) }
+ var forgetting by remember { mutableStateOf(false) }
+ var renaming by remember { mutableStateOf(false) }
+ val device = state.selected ?: return
if (about) AboutDialog(
when (val l = state.device.lists) {
is Suggestions.Pick -> l.commit
@@ -370,12 +355,209 @@ private fun AppMenu(state: UiState, actions: DeviceActions) {
},
onDismiss = { about = 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 })
Box {
IconButton(onClick = { open = true }) { Icon(Icons.Default.MoreVert, contentDescription = "More options") }
DropdownMenu(open, onDismissRequest = { open = false }) {
+ Text(name(device), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp))
+ 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 })
+ HorizontalDivider()
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 })
}
}
}
+
+/** The bar on every tab but Overview: which TV, nothing to open. Switching happens on Overview. */
+@Composable
+private fun BarName(state: UiState) {
+ val device = state.selected ?: return
+ val kind = deviceKind(device)
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Icon(DeviceIcons.of(kind), contentDescription = kind.word(), Modifier.padding(end = 12.dp))
+ Text(name(device), style = MaterialTheme.typography.titleLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
+ }
+}
+/** The TV as Overview's hero: an Expressive cookie-shaped tile, its name, how it's doing, and the switcher. */
+@OptIn(ExperimentalMaterial3ExpressiveApi::class)
+@Composable
+private fun Hero(state: UiState, live: Snapshot?, actions: DeviceActions) {
+ val device = state.selected ?: return
+ val kind = deviceKind(device)
+ val c = MaterialTheme.colorScheme
+ // Offline: the tile greys out, so it agrees with the Offline pill.
+ val on = device.state == DeviceState.Online
+ Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ Box(
+ Modifier.size(80.dp).clip(MaterialShapes.Cookie9Sided.toShape()).background(if (on) c.primaryContainer else c.surfaceContainerHighest),
+ contentAlignment = Alignment.Center,
+ ) {
+ Icon(DeviceIcons.of(kind), contentDescription = kind.word(), Modifier.size(40.dp), tint = if (on) c.onPrimaryContainer else c.outline)
+ }
+ val title = name(device)
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
+ Text(title, style = MaterialTheme.typography.headlineMediumEmphasized, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(horizontal = 16.dp))
+ // 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.bodyMedium, color = c.onSurfaceVariant)
+ }
+ val health = live?.let { Copy.health(it, heaviest(it, state.device.apps)) }
+ Surface(shape = CircleShape, color = if (health?.ok == false) c.errorContainer else c.secondaryContainer) {
+ Row(Modifier.padding(horizontal = 12.dp, vertical = 4.dp), verticalAlignment = Alignment.CenterVertically) {
+ if (health != null) {
+ Icon(if (health.ok) Icons.Default.CheckCircle else Icons.Default.Warning, null, Modifier.size(16.dp), tint = if (health.ok) c.primary else c.error)
+ } else StateDot(device.state)
+ Spacer(Modifier.width(8.dp))
+ Text(health?.text ?: Copy.state(device.state), style = MaterialTheme.typography.labelLarge)
+ }
+ }
+ TvChips(state, actions)
+ }
+}
+
+/** One chip per TV to switch, offline ones dimmed, then "+ Device" as the last chip. */
+@Composable
+private fun TvChips(state: UiState, actions: DeviceActions) {
+ FlowRow(
+ Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterHorizontally),
+ itemVerticalAlignment = Alignment.CenterVertically,
+ ) {
+ if (state.devices.size > 1) state.devices.forEach { d ->
+ FilterChip(
+ selected = d.id == state.selectedId,
+ onClick = { actions.select(d.id) },
+ label = { Text(name(d), maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 104.dp)) },
+ leadingIcon = {
+ Box {
+ Icon(DeviceIcons.of(deviceKind(d)), contentDescription = deviceKind(d).word(), Modifier.size(18.dp))
+ Box(Modifier.align(Alignment.BottomEnd).offset(x = 3.dp, y = 3.dp)) { StateDot(d.state) }
+ }
+ },
+ modifier = if (d.state == DeviceState.Online) Modifier else Modifier.alpha(0.6f),
+ )
+ }
+ // Adding a TV sits with the TVs, as the last chip.
+ AssistChip(onClick = actions.addDevice, label = { Text("Device") }, leadingIcon = { Icon(Icons.Default.Add, contentDescription = "Add a", Modifier.size(18.dp)) })
+ }
+}
+
+/** Where the suggested list stands on this TV, worked out from the live app list. */
+internal data class DebloatState(
+ /** Apps on the list that are installed here and Tellyscope may turn off, on or off. */
+ val total: Int,
+ /** Of those, the ones still on. */
+ val on: Int,
+ /** Apps Tellyscope turned off that are on again, often after a TV update. */
+ val back: Int,
+ /** Apps on the list still on, plus any that came back: the number on the Debloat tile. */
+ val count: Int,
+ /** Debloat has something to do: apps to turn off, or a TV to pick. */
+ val todo: Boolean,
+)
+
+internal fun debloatState(ui: DeviceUi): DebloatState {
+ // History lives on this phone, so it only knows what this phone turned off.
+ val ours = ui.history.filter { it.action == Action.Disable && it.undoneAt == null }.map { it.packageName }.toSet()
+ val back = ui.apps.filter { it.enabled && it.packageName in ours }.map { it.packageName }.toSet()
+ val ready = ui.lists as? Suggestions.Ready
+ val listed = ready?.list?.let { l -> l.groups.flatMap { g -> g.packages.map { it.pkg } }.filter { it !in l.keep }.toSet() }.orEmpty()
+ val candidates = ui.apps.filter { it.packageName in listed && (!it.enabled || it.protectedReason == null) }
+ val on = candidates.filter { it.enabled }.map { it.packageName }.toSet()
+ val count = (on + back).size
+ return DebloatState(candidates.size, on.size, back.size, count, count > 0 || ui.lists is Suggestions.Pick)
+}
+
+@Composable
+private fun SectionTitle(text: String) {
+ Text(text, Modifier.padding(start = 4.dp, top = 4.dp), style = MaterialTheme.typography.titleMedium)
+}
+
+/**
+ * The list in one line of plain text, with See changes beside it. When apps Tellyscope turned off
+ * are on again, one red line says so; the Debloat tile above carries the count and the fix.
+ */
+@Composable
+private fun SuggestedCard(lists: Suggestions?, d: DebloatState, offline: Boolean, onChanges: () -> Unit) {
+ val c = MaterialTheme.colorScheme
+ val apps = { n: Int -> if (n == 1) "1 app" else "$n apps" }
+ Card(colors = CardDefaults.cardColors(containerColor = c.surfaceContainerLow), shape = MaterialTheme.shapes.large) {
+ Column(Modifier.padding(start = 16.dp, end = 8.dp, top = 8.dp, bottom = 12.dp)) {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text(
+ when (lists) {
+ is Suggestions.Ready -> when {
+ d.total == 0 -> "Nothing from the ${lists.list.name} list is on this TV"
+ d.on == 0 -> if (d.total == 1) "The suggested app is off" else "All ${d.total} suggested apps are off"
+ else -> "${d.total - d.on} of ${d.total} suggested apps are off"
+ }
+ is Suggestions.Pick -> "Tap Debloat to pick your TV"
+ Suggestions.Unavailable -> "Couldn't load the device lists"
+ null -> if (offline) "Connect to the TV to see its suggestions" else "Looking up this TV's list\u2026"
+ },
+ Modifier.weight(1f),
+ style = MaterialTheme.typography.bodyLarge,
+ )
+ TextButton(onClick = onChanges) { Text("See changes") }
+ }
+ if (d.back > 0) {
+ Text(
+ buildAnnotatedString {
+ withStyle(SpanStyle(fontWeight = FontWeight.SemiBold)) { append("Action required: ") }
+ append("${apps(d.back)} came back on")
+ },
+ Modifier.padding(end = 8.dp, bottom = 4.dp),
+ style = MaterialTheme.typography.bodyLarge, color = c.error,
+ )
+ }
+ val note = when {
+ lists is Suggestions.Unavailable -> "Check the phone's internet and open this TV again."
+ lists is Suggestions.Pick -> "Tellyscope doesn't know this model yet."
+ lists is Suggestions.Ready && !d.todo -> "Debloat now opens Apps for one-off changes."
+ else -> null
+ }
+ note?.let { Text(it, Modifier.padding(end = 8.dp), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant) }
+ if (lists is Suggestions.Ready || lists is Suggestions.Pick) {
+ Text("Lists adapted from cleanyourtv (MIT).", Modifier.padding(end = 8.dp), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)
+ }
+ }
+ }
+}
+
+/** Which Android and when it last updated, with a way to make the TV look for a newer one. */
+@Composable
+private fun AndroidCard(state: UiState, snap: Snapshot?, offline: Boolean, onUpdates: () -> Unit) {
+ val device = state.selected ?: return
+ Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow), shape = MaterialTheme.shapes.large) {
+ StatusRow(
+ Icons.Default.Info,
+ device.android?.let { "Android $it" } ?: "Android",
+ (snap?.softwareMonth ?: device.lastKnown?.softwareMonth)?.let { "Updated ${Copy.month(it)}" },
+ "Check for updates", !offline, onUpdates,
+ )
+ }
+}
+
+@Composable
+private fun StatusRow(icon: ImageVector, title: String, sub: String?, button: String, enabled: Boolean, onClick: () -> Unit) {
+ ListItem(
+ headlineContent = { Text(title) },
+ supportingContent = sub?.let { { Text(it) } },
+ leadingContent = { Icon(icon, contentDescription = null, tint = MaterialTheme.colorScheme.primary) },
+ trailingContent = { TextButton(onClick = onClick, enabled = enabled) { Text(button) } },
+ colors = ListItemDefaults.colors(containerColor = Color.Transparent),
+ )
+}
+
+
+private object TileIcons {
+ val Upload = icon("Upload", "M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z")
+
+ 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()
+}
diff --git a/app/src/main/java/app/tellyscope/ui/ListsCard.kt b/app/src/main/java/app/tellyscope/ui/ListsCard.kt
index 1e65fa7..2cd91ae 100644
--- a/app/src/main/java/app/tellyscope/ui/ListsCard.kt
+++ b/app/src/main/java/app/tellyscope/ui/ListsCard.kt
@@ -67,29 +67,6 @@ import app.tellyscope.data.listKind
import app.tellyscope.data.listMakers
import app.tellyscope.data.sourceName
-/** Body of the "Suggested for this TV" section: one line on what the list offers; the Debloat tile is the way in. */
-@Composable
-fun SuggestionsSummary(lists: Suggestions?) {
- when (lists) {
- null -> Muted("Looking up this TV's list…")
- Suggestions.Unavailable -> Muted(
- "Couldn't load the device lists. They download the first time you open a TV; check the phone's internet and open this TV again.",
- )
- is Suggestions.Pick -> {
- Text("Tellyscope doesn't know this model yet. Tap Debloat to pick your TV and see what's usually safe to turn off.", style = MaterialTheme.typography.bodyMedium)
- }
- is Suggestions.Ready -> {
- val n = lists.groups.sumOf { it.packages.size }
- if (n == 0) {
- Muted("Nothing on the list for ${lists.list.name} is still on here.")
- } else {
- Text("$n ${if (n == 1) "app" else "apps"} usually safe to turn off on this TV.", style = MaterialTheme.typography.bodyMedium)
- }
- }
- }
- if (lists is Suggestions.Pick || lists is Suggestions.Ready) Muted("Lists adapted from cleanyourtv (MIT).")
-}
-
@Composable
private fun Muted(text: String) {
Text(text, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
index a52c1c6..542b245 100644
--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
@@ -887,6 +887,22 @@ class TellyscopeViewModel(
return null
}
+ /** The TV shows its own update screen; Tellyscope can't see what it finds, so it only says where to look. */
+ fun checkUpdates() {
+ val id = _state.value.selectedId ?: return
+ viewModelScope.launch {
+ val ok = try {
+ source.openUpdates(id)
+ } catch (e: CancellationException) {
+ throw e
+ } catch (_: Exception) {
+ _notice.value = Copy.REMOTE_LOST
+ return@launch
+ }
+ _notice.value = if (ok) Copy.UPDATES_OPENED else Copy.NO_UPDATE_SCREEN
+ }
+ }
+
fun reboot() {
val id = _state.value.selectedId ?: return
viewModelScope.launch {
diff --git a/app/src/main/java/app/tellyscope/ui/Transfers.kt b/app/src/main/java/app/tellyscope/ui/Transfers.kt
index 12c8f89..1c9b7e8 100644
--- a/app/src/main/java/app/tellyscope/ui/Transfers.kt
+++ b/app/src/main/java/app/tellyscope/ui/Transfers.kt
@@ -18,6 +18,8 @@ import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.Send
import androidx.compose.material.icons.filled.Warning
import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.Badge
+import androidx.compose.material3.BadgedBox
import androidx.compose.material3.Button
import androidx.compose.material3.Checkbox
import androidx.compose.material3.DropdownMenu
@@ -60,13 +62,17 @@ private val Sticky = DialogProperties(dismissOnBackPress = false, dismissOnClick
/**
* The three things people come to a TV's page for, as big tiles under the system widget.
- * Debloat is the filled one: it's what most people open the app to do.
+ * Debloat is filled, with a count, while it has something to do; after that it looks like its
+ * neighbours and [onDebloat] leads somewhere quieter.
*/
@Composable
-fun ActionTiles(actions: DeviceActions, canDebloat: Boolean, disabling: Boolean) {
+fun ActionTiles(actions: DeviceActions, count: Int, todo: Boolean, disabling: Boolean, onDebloat: () -> Unit) {
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Tile(Icons.Default.Add, "Install app", actions.pickApp, Modifier.weight(1f))
- Tile(Broom, if (disabling) "Disabling…" else "Debloat", actions.debloat, Modifier.weight(1f), enabled = canDebloat && !disabling, primary = true)
+ Tile(
+ Broom, if (disabling) "Disabling…" else "Debloat", onDebloat, Modifier.weight(1f),
+ enabled = !disabling, primary = todo, badge = count.takeIf { todo && it > 0 },
+ )
// Where the file lands is the user's choice, every time, not whatever folder was last shown.
var choosing by remember { mutableStateOf(false) }
Box(Modifier.weight(1f)) {
@@ -92,6 +98,7 @@ private fun Tile(
modifier: Modifier = Modifier,
enabled: Boolean = true,
primary: Boolean = false,
+ badge: Int? = null,
) {
val c = MaterialTheme.colorScheme
Surface(
@@ -116,14 +123,16 @@ private fun Tile(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp),
) {
- Icon(icon, contentDescription = null, Modifier.size(28.dp))
+ BadgedBox(badge = { if (badge != null) Badge { Text(badge.toString()) } }) {
+ Icon(icon, contentDescription = null, Modifier.size(28.dp))
+ }
Text(label, style = MaterialTheme.typography.labelLarge, maxLines = 1)
}
}
}
/** Material Icons "cleaning_services" (Apache-2.0, see NOTICE); icons-core has no broom. */
-private val Broom = ImageVector.Builder("Broom", 24.dp, 24.dp, 24f, 24f)
+internal val Broom = ImageVector.Builder("Broom", 24.dp, 24.dp, 24f, 24f)
.addPath(
PathParser().parsePathString(
"M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5z" +
diff --git a/app/src/test/java/app/tellyscope/DebloatStateTest.kt b/app/src/test/java/app/tellyscope/DebloatStateTest.kt
new file mode 100644
index 0000000..c4224b5
--- /dev/null
+++ b/app/src/test/java/app/tellyscope/DebloatStateTest.kt
@@ -0,0 +1,67 @@
+// SPDX-License-Identifier: GPL-3.0-only
+
+package app.tellyscope
+
+import app.tellyscope.data.Action
+import app.tellyscope.data.AppInfo
+import app.tellyscope.data.DeviceList
+import app.tellyscope.data.HistoryEntry
+import app.tellyscope.data.ListGroup
+import app.tellyscope.data.ListPackage
+import app.tellyscope.data.Suggestions
+import app.tellyscope.data.suggest
+import app.tellyscope.ui.DeviceUi
+import app.tellyscope.ui.debloatState
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Test
+
+class DebloatStateTest {
+ private val list = DeviceList(
+ "x", "X", null, 30, keep = setOf("com.acme.keep"),
+ groups = listOf(ListGroup("Junk", listOf("com.acme.a", "com.acme.b", "com.acme.c", "com.acme.keep").map { ListPackage(it, null, false) })),
+ )
+
+ private fun app(pkg: String, enabled: Boolean, protected: String? = null) = AppInfo(pkg, pkg, null, true, enabled, protected, "1")
+
+ private fun turnedOff(pkg: String) = HistoryEntry(1, "tv", 0, Action.Disable, pkg, pkg, Action.Enable, null)
+
+ private fun ui(apps: List<AppInfo>, history: List<HistoryEntry> = emptyList()) =
+ DeviceUi(apps = apps, history = history, lists = Suggestions.Ready(null, list, 30, suggest(list, apps, 30), emptyList()))
+
+ @Test fun `an app on the list that came back on counts once`() {
+ // a came back after Tellyscope turned it off; b is still on; c is off.
+ val d = debloatState(ui(listOf(app("com.acme.a", true), app("com.acme.b", true), app("com.acme.c", false)), listOf(turnedOff("com.acme.a"))))
+ assertEquals(3, d.total)
+ assertEquals(2, d.on)
+ assertEquals(1, d.back)
+ assertEquals(2, d.count)
+ assertTrue(d.todo)
+ }
+
+ @Test fun `an app off the list that came back on adds to the count`() {
+ val d = debloatState(ui(listOf(app("com.acme.a", true), app("com.acme.b", false), app("com.other", true)), listOf(turnedOff("com.other"))))
+ assertEquals(1, d.on)
+ assertEquals(1, d.back)
+ assertEquals(2, d.count)
+ }
+
+ @Test fun `nothing left means nothing to do`() {
+ val d = debloatState(ui(listOf(app("com.acme.a", false), app("com.acme.b", false))))
+ assertEquals(2, d.total)
+ assertEquals(0, d.on)
+ assertEquals(0, d.count)
+ assertFalse(d.todo)
+ }
+
+ @Test fun `keep entries and protected apps are not suggestions`() {
+ val d = debloatState(ui(listOf(app("com.acme.keep", true), app("com.acme.a", true, protected = "system"))))
+ assertEquals(0, d.total)
+ assertFalse(d.todo)
+ }
+
+ @Test fun `an unknown TV still has something to do`() {
+ assertTrue(debloatState(DeviceUi(lists = Suggestions.Pick(null, emptyList()))).todo)
+ }
+}
diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
index a424654..c44e310 100644
--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt
+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
@@ -54,6 +54,7 @@ import app.tellyscope.ui.DebloatScreen
import app.tellyscope.ui.DeviceActions
import app.tellyscope.ui.DeviceTabsScreen
import app.tellyscope.ui.TvTab
+import app.tellyscope.data.LastKnown
import app.tellyscope.ui.Copy
import app.tellyscope.ui.TweaksBlock
import app.tellyscope.ui.DeviceUi
@@ -206,6 +207,46 @@ class ScreenshotTest {
return deviceState { copy(history = history, files = FilesUi(TvFolder.DOWNLOAD, files), tweaks = tweaks) }
}
+ // The 0.5.0 Overview: three TVs, one offline with saved facts.
+ private fun md3State(): UiState {
+ val s = tabsState()
+ val sel = s.selected!!.copy(nickname = "Projector")
+ val cast = Device(chromecast.ip, chromecast, DeviceState.Online, "Chromecast", "Google", "12", now, nickname = "Bedroom")
+ val boxTv = Device(box.ip, box, DeviceState.Offline, "X96 Max", "Amlogic", "9", now - 2 * 3_600_000L, nickname = "Kitchen",
+ lastKnown = LastKnown("Amlogic", null, "9", java.time.YearMonth.of(2021, 3), 9.6, 14.5))
+ return s.copy(devices = listOf(sel, cast, boxTv))
+ }
+ private fun md3(name: String, dark: Boolean, state: () -> UiState = ::md3State) =
+ shot(name, dark) { DeviceTabsScreen(state(), DeviceActions()) }
+ @Test fun md3_overview() = md3("60_md3_overview", false)
+ @Test fun md3_overview_dark() = md3("60_md3_overview", true)
+ @Test fun md3_offline() = md3("62_md3_offline", false) { md3State().let { it.copy(selectedId = it.devices[2].id, device = DeviceUi(history = it.device.history)) } }
+ @Test fun md3_offline_dark() = md3("62_md3_offline", true) { md3State().let { it.copy(selectedId = it.devices[2].id, device = DeviceUi(history = it.device.history)) } }
+ @Test fun md3_apps() { shot("64_md3_apps") { DeviceTabsScreen(md3State(), DeviceActions(), startTab = TvTab.Apps) } }
+ @Test fun md3_apps_dark() { shot("64_md3_apps", dark = true) { DeviceTabsScreen(md3State(), DeviceActions(), startTab = TvTab.Apps) } }
+ @Test fun md3_files() { shot("65_md3_files") { DeviceTabsScreen(md3State(), DeviceActions(), startTab = TvTab.Files) } }
+ @Test fun md3_files_dark() { shot("65_md3_files", dark = true) { DeviceTabsScreen(md3State(), DeviceActions(), startTab = TvTab.Files) } }
+ // Nothing came back: the TV still has off what Tellyscope turned off.
+ private fun md3Calm() = md3State().let { st -> st.copy(device = st.device.copy(apps = st.device.apps.map { if (it.packageName == "com.xgimi.ota") it.copy(enabled = false) else it })) }
+ @Test fun md3_calm() = md3("67_md3_calm", false, state = ::md3Calm)
+ @Test fun md3_calm_dark() = md3("67_md3_calm", true, state = ::md3Calm)
+ // Nothing left to do: the list's apps are all off and none came back, so no Debloat button.
+ // Everything on the list is off, so Debloat turns tonal and leads to Apps.
+ private val listed = setOf("com.xgimi.assistant", "com.google.android.tvrecommendations", "com.netflix.ninja")
+ private fun md3Clean() = md3Calm().let { st -> st.copy(device = st.device.copy(apps = st.device.apps.map { if (it.packageName in listed) it.copy(enabled = false) else it })) }
+ @Test fun md3_clean() = md3("68_md3_clean", false, state = ::md3Clean)
+ @Test fun md3_clean_dark() = md3("68_md3_clean", true, state = ::md3Clean)
+ // An offline TV's chip still switches to it: its page shows the saved facts and Reconnect.
+ @Test fun offlineChipSelects() {
+ val state = md3State()
+ var picked: String? = null
+ compose.setContent { TellyscopeTheme(dynamic = false) { DeviceTabsScreen(state, DeviceActions(select = { picked = it })) } }
+ compose.onNodeWithText("Kitchen").performClick()
+ assertEquals(state.devices[2].id, picked)
+ }
+ @Test fun md3_oneTv() = md3("63_md3_one_tv", false) { md3State().let { it.copy(devices = it.devices.take(1)) } }
+ @Test fun md3_oneTv_dark() = md3("63_md3_one_tv", true) { md3State().let { it.copy(devices = it.devices.take(1)) } }
+
private fun tabShots(tab: TvTab, name: String) {
shot(name) { DeviceTabsScreen(tabsState(), DeviceActions(), startTab = tab) }
}
@@ -219,19 +260,6 @@ class ScreenshotTest {
@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() = tvMenu(dark = false)
- @Test fun tabs_tvMenu_dark() = tvMenu(dark = true)
-
- private fun tvMenu(dark: Boolean) {
- val open = {
- compose.onNodeWithContentDescription("Switch TV").performClick()
- compose.mainClock.advanceTimeBy(1_000)
- compose.onNodeWithText("Add a TV").assertExists()
- Unit
- }
- shot("44_tabs_tv_menu", dark, screen = true, before = open) { DeviceTabsScreen(tabsState().copy(showOffline = true), DeviceActions()) }
- }
-
@Test fun tabs_appMenu() = appMenu(dark = false)
@Test fun tabs_appMenu_dark() = appMenu(dark = true)
@@ -274,7 +302,8 @@ class ScreenshotTest {
compose.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()
+ for (t in listOf("Internal storage", "Network", "Suggested for this TV", "Check for updates")) compose.onNodeWithText(t).assertExists()
+ compose.onNodeWithText("Updated ", substring = true).assertExists()
}
@Test fun device_overview_dark() = shot("04_device", dark = true) { DeviceTabsScreen(deviceState(), DeviceActions()) }
@@ -296,7 +325,7 @@ class ScreenshotTest {
// Old numbers don't speak for a TV that's away; what it is still does.
compose.onNodeWithText("Up for").assertDoesNotExist()
compose.onNodeWithText("Internal storage").assertDoesNotExist()
- compose.onNodeWithText("Last software update").assertExists()
+ compose.onNodeWithText("Updated ", substring = true).assertExists()
}
@Test fun device_storageFull() {
diff --git a/docs/screenshots/files.png b/docs/screenshots/files.png
index 426dff5..e5a42e4 100644
Binary files a/docs/screenshots/files.png and b/docs/screenshots/files.png differ
diff --git a/docs/screenshots/history.png b/docs/screenshots/history.png
index 5b048d2..f41dfca 100644
Binary files a/docs/screenshots/history.png and b/docs/screenshots/history.png differ
diff --git a/docs/screenshots/home.png b/docs/screenshots/home.png
index 2388b43..8039d47 100644
Binary files a/docs/screenshots/home.png and b/docs/screenshots/home.png differ
diff --git a/docs/screenshots/install.png b/docs/screenshots/install.png
index fb89285..91fb1af 100644
Binary files a/docs/screenshots/install.png and b/docs/screenshots/install.png differ
diff --git a/docs/screenshots/request.png b/docs/screenshots/request.png
index 5ad0cf2..6332beb 100644
Binary files a/docs/screenshots/request.png and b/docs/screenshots/request.png differ
diff --git a/docs/screenshots/send.png b/docs/screenshots/send.png
index 6ce1416..cb9c39d 100644
Binary files a/docs/screenshots/send.png and b/docs/screenshots/send.png differ
diff --git a/docs/screenshots/tv-page.png b/docs/screenshots/tv-page.png
index c0073b0..b7cea56 100644
Binary files a/docs/screenshots/tv-page.png and b/docs/screenshots/tv-page.png differ
diff --git a/docs/screenshots/tweaks.png b/docs/screenshots/tweaks.png
index 5a2b932..31e7ea1 100644
Binary files a/docs/screenshots/tweaks.png and b/docs/screenshots/tweaks.png differ
diff --git a/docs/screenshots/uninstall.png b/docs/screenshots/uninstall.png
index 4970b71..57dc121 100644
Binary files a/docs/screenshots/uninstall.png and b/docs/screenshots/uninstall.png differ