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.
Move user-visible text into strings.xml
jesse-agent-8217057c9d2fd0d
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 6128461..9059ef8 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -56,6 +56,7 @@ python3 docs/screenshots/frame.py- Kotlin official code style, as set up in `.editorconfig`.- Logic that doesn't need Android goes in `:adb`, with unit tests.- UI uses Material 3 Expressive components and the app theme. No hard-coded colors.+- New UI text goes in `app/src/main/res/values/strings.xml`, never as a literal in Kotlin. Compose code reads it with `stringResource`; the ViewModel and data layer return a `UiText` the screen resolves. Counts use `<plurals>`, and values go in as format arguments, not by joining strings.## Reporting a TVdiff --git a/app/src/main/java/app/tellyscope/MainActivity.kt b/app/src/main/java/app/tellyscope/MainActivity.ktindex 42418ac..d81f75e 100644--- a/app/src/main/java/app/tellyscope/MainActivity.kt+++ b/app/src/main/java/app/tellyscope/MainActivity.kt@@ -50,6 +50,7 @@ import app.tellyscope.data.DeviceStateimport app.tellyscope.data.FakeDeviceSourceimport app.tellyscope.data.FoldBookimport app.tellyscope.data.SeenBook+import app.tellyscope.data.UiTextimport app.tellyscope.data.KeyHapticsimport app.tellyscope.data.UpdateCheckimport app.tellyscope.ui.AccessActions@@ -400,7 +401,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {closeSideload = vm::closeSideload,reportInstall = { s ->vm.closeSideload()- vm.openReport(ReportKind.Problem, s.app?.let { "Tried to install ${it.label} ${it.info.versionName.orEmpty()}".trim() }.orEmpty(), s.detail)+ vm.openReport(ReportKind.Problem, s.app?.let { context.getString(R.string.vm_report_tried_install, it.label, it.info.versionName.orEmpty()).trim() }.orEmpty(), s.detail)},openInstalled = vm::openInstalled,folder = vm::folder,@@ -458,17 +459,18 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {internal fun Snackbars(host: SnackbarHostState,done: StateFlow<Done?>,- notice: StateFlow<String?>,+ notice: StateFlow<UiText?>,doneShown: () -> Unit,noticeShown: () -> Unit,undo: (Done) -> Unit,) {+ val res = LocalContext.current.resourcesLaunchedEffect(host, done) {done.filterNotNull().collect { d ->doneShown()val result = host.showSnackbar(- message = Copy.done(d.entry.action, d.entry.label),- actionLabel = d.entry.undo?.let(Copy::undo),+ message = Copy.done(d.entry.action, d.entry.label).resolve(res),+ actionLabel = d.entry.undo?.let(Copy::undo)?.resolve(res),duration = SnackbarDuration.Short,)if (result == SnackbarResult.ActionPerformed) undo(d)@@ -477,7 +479,7 @@ internal fun Snackbars(LaunchedEffect(host, notice) {notice.filterNotNull().collect { message ->noticeShown()- host.showSnackbar(message, duration = SnackbarDuration.Short)+ host.showSnackbar(message.resolve(res), duration = SnackbarDuration.Short)}}}@@ -489,6 +491,7 @@ internal fun Snackbars(*/@Composableinternal fun LoggedOutSnackbars(host: SnackbarHostState, devices: () -> List<Device>, selectedId: () -> String?, onView: (String) -> Unit) {+ val res = LocalContext.current.resourcesLaunchedEffect(host) {var seen: Set<String>? = nullsnapshotFlow { devices().filter { it.loggedOutAt != null } }.collect { out ->@@ -497,7 +500,7 @@ internal fun LoggedOutSnackbars(host: SnackbarHostState, devices: () -> List<Devseen = idsfresh.forEach { d ->launch {- val result = host.showSnackbar(Copy.loggedOutOf(name(d)), actionLabel = "View", duration = SnackbarDuration.Long)+ val result = host.showSnackbar(Copy.loggedOutOf(name(d)).resolve(res), actionLabel = res.getString(R.string.vm_logged_out_view), duration = SnackbarDuration.Long)if (result == SnackbarResult.ActionPerformed) onView(d.id)}}diff --git a/app/src/main/java/app/tellyscope/data/ActionFailed.kt b/app/src/main/java/app/tellyscope/data/ActionFailed.ktindex 59bec19..0b7be45 100644--- a/app/src/main/java/app/tellyscope/data/ActionFailed.kt+++ b/app/src/main/java/app/tellyscope/data/ActionFailed.kt@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-3.0-onlypackage app.tellyscope.data-/** A change the TV refused. [message] is one plain line for the snackbar; [details] is what the TV printed, for a problem report. */-class ActionFailed(message: String, val details: String) : IllegalStateException(message)+/** A change the TV refused. [text] is one plain line for the snackbar; [details] is what the TV printed, for a problem report. */+class ActionFailed(text: UiText, val details: String) : UiTextException(text)diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.ktindex d6dadfc..9d3793c 100644--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt@@ -7,6 +7,7 @@ import android.net.ConnectivityManagerimport android.net.LinkPropertiesimport android.net.Networkimport android.net.NetworkCapabilities+import app.tellyscope.Rimport app.tellyscope.adb.Accessimport app.tellyscope.adb.ActionResultimport app.tellyscope.adb.ApkInfo@@ -77,6 +78,8 @@ import app.tellyscope.adb.ScanHit as AdbHit*/class AdbDeviceSource(context: Context) : DeviceSource {private val appContext = context.applicationContext+ /** Our text in the app's language now, for what's saved: History labels, names stored with data. */+ private fun UiText.text(): String = this.resolve(appContext.resources)private val scope = CoroutineScope(SupervisorJob())private val links = ConcurrentHashMap<String, DeviceLink>()/** The TV on screen and its screen's refresh rates; every other TV reads at [StatsProfile.OTHER]. */@@ -476,7 +479,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {/** An app's name for a uid; system uids and unknown ones read as Android system. */private fun uidLabel(uid: Int, packages: Map<Int, List<String>>): String {- val pkg = packages[uid]?.takeIf { uid % 100_000 >= 10_000 }?.firstOrNull() ?: return AppNames.SYSTEM+ val pkg = packages[uid]?.takeIf { uid % 100_000 >= 10_000 }?.firstOrNull() ?: return AppNames.SYSTEM.text()return labels[pkg] ?: AppNames.fallback(pkg)}@@ -492,8 +495,8 @@ class AdbDeviceSource(context: Context) : DeviceSource {val actions = Actions(session(deviceId))val label = labels[packageName] ?: AppNames.fallback(packageName)val service = packageName.takeIf { it in serviceLaunchers }?.let { actions.homeService(it) }- ?: throw IllegalStateException("$label has no accessibility service")- if (!actions.grant(service)) throw IllegalStateException(serviceNotOn(label))+ ?: throw UiTextException(UiText(R.string.data_no_service, label))+ if (!actions.grant(service)) throw UiTextException(serviceNotOn(label))// Undo of the switch to it turns it off again, as if the switch had turned it on.openSwitch(deviceId, packageName)?.let { book.amend(it, mapOf("service" to service)) }Unit@@ -520,7 +523,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {return switchHome(deviceId, packageName, undoing, again ?: service)}if (action == Action.HomeBack) return homeBack(deviceId, packageName, undoing)- if (action == Action.Reset) return undoReset(deviceId, undoing ?: throw IllegalStateException("there's no reset to undo"))+ if (action == Action.Reset) return undoReset(deviceId, undoing ?: throw UiTextException(UiText(R.string.data_no_reset_to_undo)))undoing?.let { id -> book.entries(key).firstOrNull { it.id == id } }?.firstHomeService?.let { return firstHomeServiceOff(deviceId, packageName, it, undoing) }if (action == Action.Uninstall && Actions(shell).homeOptions()?.current == packageName) return uninstallHome(deviceId, packageName)@@ -539,9 +542,9 @@ class AdbDeviceSource(context: Context) : DeviceSource {// Disabling the home screen is refused anyway; offer no undo that can't work.undo = if (switch != null) null else r.undo?.let { Action.valueOf(it.name.lowercase().replaceFirstChar(Char::uppercase)) },undoing = undoing,- ).also { if (back == false) throw IllegalStateException(homeNotBack(it.label)) }+ ).also { if (back == false) throw UiTextException(homeNotBack(it.label)) }}- is ActionResult.Refused -> throw IllegalStateException(reasonText(r.reason))+ is ActionResult.Refused -> throw UiTextException(reasonText(r.reason))is ActionResult.Failed -> throw ActionFailed(failedText(action, labelOf(packageName)), r.output.ifEmpty { "(no output)" })}}@@ -569,14 +572,14 @@ class AdbDeviceSource(context: Context) : DeviceSource {/** Undo of a first home: [launcher] stays Home, as there's none to go back to; its [service] goes off. */private suspend fun firstHomeServiceOff(deviceId: String, launcher: String, service: String, undoing: Long): HistoryEntry {val label = labelOf(launcher)- if (!Actions(session(deviceId)).setService(service, false)) throw IllegalStateException(serviceStillOn(label))+ if (!Actions(session(deviceId)).setService(service, false)) throw UiTextException(serviceStillOn(label))return book.record(deviceId = key(deviceId),at = System.currentTimeMillis(),// A sentence of its own, like a setting's: nothing here for Restore or a later Undo.action = Action.Change,packageName = launcher,- label = "Turned off $label's accessibility service",+ label = UiText(R.string.data_history_service_off, label).text(),undo = null,undoing = undoing,)@@ -601,7 +604,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {val shell = session(deviceId)val system = Parsers.packages(shell.shell("pm list packages -s").output).map { it.name }.toSet()val disabled = Parsers.packages(shell.shell("pm list packages -d").output).map { it.name }.toSet()- val nothing = "there's no home screen to switch back to"+ val nothing = UiText(R.string.data_no_home_to_switch_back)if (fireOs(deviceId, FIRE_TV_LAUNCHER in system)) Actions(shell).fireServiceHolder(serviceLaunchers)?.let { held ->val (added, _) = held// Reverses the Make Home that turned the service on, so Restore leaves it alone.@@ -610,11 +613,11 @@ class AdbDeviceSource(context: Context) : DeviceSource {book.record(key, System.currentTimeMillis(), Action.HomeBack, added, to?.let(::labelOf) ?: labelOf(FIRE_TV_LAUNCHER), Action.Home, home, previous)}}- val options = Actions(shell).homeOptions() ?: throw IllegalStateException(nothing)- val added = options.current?.takeIf { it !in system } ?: throw IllegalStateException(nothing)+ val options = Actions(shell).homeOptions() ?: throw UiTextException(nothing)+ val added = options.current?.takeIf { it !in system } ?: throw UiTextException(nothing)val own = builtIns(system, disabled, options)val target = (if (pkg == added) homeBackTarget(added, book.entries(key), own) else pkg.takeIf { it in own }?.let { builtInTarget(it, book.entries(key)) })- ?: throw IllegalStateException(nothing)+ ?: throw UiTextException(nothing)return when (val r = Actions(shell).homeBack(target.pkg, target.activity)) {is HomeResult.Switched -> {// Off with Home: it would keep sending Home to [added]. Undo, a switch, turns it on again.@@ -633,12 +636,12 @@ class AdbDeviceSource(context: Context) : DeviceSource {undoing = undoing ?: target.reverses,previous = listOfNotNull(r.from?.let { "from" to it }, "to" to r.to, service?.takeIf { off == true }?.let { "service" to it }).toMap(),).also {- if (off == false) throw IllegalStateException(serviceNotOff(labels[added] ?: AppNames.fallback(added)))+ if (off == false) throw UiTextException(serviceNotOff(labels[added] ?: AppNames.fallback(added)))left?.let { throw ActionFailed(notShown(labels[target.pkg] ?: AppNames.fallback(target.pkg), it.reason), it.output) }}}- is HomeResult.Refused -> throw IllegalStateException(reasonText(r.reason))- is HomeResult.Failed -> throw ActionFailed(r.output.ifEmpty { "the TV refused" }, r.details)+ is HomeResult.Refused -> throw UiTextException(reasonText(r.reason))+ is HomeResult.Failed -> throw ActionFailed(tvSaid(r.output), r.details)}}@@ -725,7 +728,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {throw e} catch (e: Exception) {// A step that fails doesn't stop the rest: each one stands alone.- failed += ResetFailure(part, app, e.message ?: "the TV refused")+ failed += ResetFailure(part, app, e.why(R.string.data_tv_refused))null}}@@ -741,7 +744,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {} catch (e: CancellationException) {throw e} catch (e: Exception) {- failed += ResetFailure(ResetPart.Home, null, e.message ?: "the TV refused")+ failed += ResetFailure(ResetPart.Home, null, e.why(R.string.data_tv_refused))null}}@@ -749,7 +752,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {if (on.isEmpty() && back.isEmpty() && home == null) return@busy old?.id to failedfun merge(k: String, new: List<String>) = k to (ResetRecord.list(old?.previous, k) + new).distinct().joinToString(",")val previous = mapOf(merge(ResetRecord.ON, on), merge(ResetRecord.BACK, back)) + home.orEmpty()- val label = ResetRecord.label(ResetRecord.changes(old?.previous.orEmpty() + previous))+ val label = ResetRecord.label(ResetRecord.changes(old?.previous.orEmpty() + previous)).text()val id = if (old != null) old.id.also { book.amend(it, previous, label) }else book.record(key, System.currentTimeMillis(), Action.Reset, RESET, label, undo = Action.Reset, previous = previous).idid to failed@@ -762,19 +765,19 @@ class AdbDeviceSource(context: Context) : DeviceSource {* Try again Home may have moved already: then only the service and the hand-off are left to do,* and the entry already holds the move.*/- private suspend fun resetHome(actions: Actions, home: ResetHome): Pair<Map<String, String?>, String?> {+ private suspend fun resetHome(actions: Actions, home: ResetHome): Pair<Map<String, String?>, UiText?> {if (home.serviceOnly) {// On Try again the service may be off already: nothing left to record.val service = actions.homeService(home.from)?.takeIf { actions.serviceOn(it) } ?: return emptyMap<String, String?>() to null- if (!actions.setService(service, false)) throw IllegalStateException(fireServiceNotOff(home.fromLabel))+ if (!actions.setService(service, false)) throw UiTextException(fireServiceNotOff(home.fromLabel))val left = actions.currentHome()?.let { actions.handOff(home.from, it) }?.let { notShown(home.toLabel, it.reason) }return mapOf(ResetRecord.SERVICE to service) to left}val moved: Map<String, String?> = if (actions.currentHome()?.substringBefore('/') == home.to) emptyMap()else when (val r = actions.homeBack(home.to)) {is HomeResult.Switched -> listOfNotNull(ResetRecord.FROM to r.from, ResetRecord.TO to r.to).toMap()- is HomeResult.Refused -> throw IllegalStateException(reasonText(r.reason))- is HomeResult.Failed -> throw IllegalStateException(r.output.ifEmpty { "the TV refused" })+ is HomeResult.Refused -> throw UiTextException(reasonText(r.reason))+ is HomeResult.Failed -> throw UiTextException(tvSaid(r.output))}val service = home.from.takeIf { it in serviceLaunchers }?.let { actions.homeService(it) }?.takeIf { actions.serviceOn(it) }val off = service?.let { actions.setService(it, false) }@@ -793,12 +796,12 @@ class AdbDeviceSource(context: Context) : DeviceSource {private suspend fun undoReset(deviceId: String, id: Long): HistoryEntry {val key = key(deviceId)val entry = book.entries(key).firstOrNull { it.id == id && it.undoneAt == null }- ?: throw IllegalStateException("that reset is already undone")+ ?: throw UiTextException(UiText(R.string.data_reset_already_undone))val p = entry.previous.orEmpty()val shell = session(deviceId)val tv = TvReset(shell)val actions = Actions(shell)- val errors = mutableListOf<String>()+ val errors = mutableListOf<UiText>()var homeLeft = falsep[ResetRecord.TO]?.let { to ->val from = p[ResetRecord.FROM]@@ -806,7 +809,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {// Home first: the TV's own launcher can't go off while it's still Home.if (from == null || !actions.setHome(from)) {homeLeft = true- errors += "the TV kept ${labelOf(to.substringBefore('/'))} as the home screen"+ errors += UiText(R.string.data_reset_tv_kept_home, labelOf(to.substringBefore('/')))} else p[ResetRecord.SERVICE]?.let { if (!actions.grant(it)) errors += serviceNotOn(name) }}if (undoFireResetHome(actions, p) == false) errors += serviceNotOn(labelOf(p[ResetRecord.SERVICE].orEmpty().substringBefore('/')))@@ -819,7 +822,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {} catch (e: CancellationException) {throw e} catch (e: Exception) {- errors += "${labelOf(pkg)}: ${e.message ?: "the TV refused"}"+ errors += UiText(R.string.data_app_reason, labelOf(pkg), e.why(R.string.data_tv_refused))true}}@@ -827,16 +830,16 @@ class AdbDeviceSource(context: Context) : DeviceSource {val back = each(ResetRecord.list(p, ResetRecord.BACK), tv::remove)// Only the service left on: every change is back, so the reset is undone, with a warning.if (errors.isEmpty() || (on.isEmpty() && back.isEmpty() && !homeLeft)) {- val undone = book.record(key, System.currentTimeMillis(), Action.Change, RESET, "Put back what Reset TV changed", undo = null, undoing = id)+ val undone = book.record(key, System.currentTimeMillis(), Action.Change, RESET, UiText(R.string.data_history_reset_undone).text(), undo = null, undoing = id)if (errors.isEmpty()) return undone- throw IllegalStateException("put back every change, but ${errors.first()}")+ throw UiTextException(UiText(R.string.data_reset_undo_service_left, errors.first()))}val left = mapOf(ResetRecord.ON to on.joinToString(","), ResetRecord.BACK to back.joinToString(",")) +if (homeLeft) emptyMap() else mapOf(ResetRecord.FROM to null, ResetRecord.TO to null, ResetRecord.SERVICE to null)val before = ResetRecord.changes(p)val now = ResetRecord.changes(p + left)- book.amend(id, left, ResetRecord.label(now))- throw IllegalStateException("put back ${before - now} of $before changes. ${errors.first().replaceFirstChar(Char::uppercase)}. Undo again tries the rest")+ book.amend(id, left, ResetRecord.label(now).text())+ throw UiTextException(UiText.plural(R.plurals.data_reset_undo_partial, before, before - now, before, UiText.Capitalized(errors.first())))}override suspend fun suggestions(deviceId: String, apps: suspend () -> List<AppInfo>): Suggestions = try {@@ -870,9 +873,9 @@ class AdbDeviceSource(context: Context) : DeviceSource {keep.clear() // the old source's keep entriesscope.launch(Dispatchers.IO) { SharedLists.load(lists, fresh = true) }}- SourceResult.NotHttps -> throw IllegalStateException("the address has to start with https://")- SourceResult.Unreachable -> throw IllegalStateException("couldn't reach that address. Check it and the phone's internet")- SourceResult.NotAList -> throw IllegalStateException(NOT_A_LIST)+ SourceResult.NotHttps -> throw UiTextException(UiText(R.string.data_lists_not_https))+ SourceResult.Unreachable -> throw UiTextException(UiText(R.string.data_lists_unreachable))+ SourceResult.NotAList -> throw UiTextException(NOT_A_LIST)}}@@ -972,14 +975,14 @@ class AdbDeviceSource(context: Context) : DeviceSource {private suspend fun changeNow(deviceId: String, tweak: Tweak, values: Map<String, String?>, undoing: Long?): HistoryEntry {val t = Tweaks(session(deviceId))val strictDns = tweak == Tweak.PRIVATE_DNS && values["private_dns_mode"] == "hostname"- if (strictDns && (sdk(deviceId) ?: TvSettings.DNS_SDK) < TvSettings.DNS_SDK) throw IllegalStateException(TvSettings.DNS_TOO_OLD)+ if (strictDns && (sdk(deviceId) ?: TvSettings.DNS_SDK) < TvSettings.DNS_SDK) throw UiTextException(TvSettings.DNS_TOO_OLD)return applyTweak(t, tweak, values, strictDns) { label, previous ->book.record(deviceId = key(deviceId),at = System.currentTimeMillis(),action = Action.Change,packageName = tweak.name,- label = label,+ label = label.text(),undo = Action.Change,undoing = undoing,previous = previous,@@ -989,7 +992,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {override suspend fun clearCaches(deviceId: String): Long? {val freed = busy(deviceId, reread = true) { Tweaks(session(deviceId)).clearCaches() }- book.record(key(deviceId), System.currentTimeMillis(), Action.ClearCaches, "", TvSettings.CACHES, undo = null)+ book.record(key(deviceId), System.currentTimeMillis(), Action.ClearCaches, "", TvSettings.CACHES.text(), undo = null)return freed}@@ -1109,7 +1112,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {busy(deviceId) { Files(session(deviceId)).pull(folder, file, sink, onProgress) }private fun session(deviceId: String) =- links[deviceId]?.session ?: throw IllegalStateException("$deviceId is offline")+ links[deviceId]?.session ?: throw UiTextException(UiText(R.string.data_offline, deviceId))private fun device(id: String): Device {val link = links[id]@@ -1147,35 +1150,35 @@ class AdbDeviceSource(context: Context) : DeviceSource {else -> "closing"}- private fun serviceStillOn(app: String) =- "$app's accessibility service is still on. Turn it off in the TV's Settings → Accessibility"+ private fun serviceStillOn(app: String) = UiText(R.string.data_service_still_on, app)- private fun homeNotBack(app: String) =- "turned $app back on, but the TV kept the other home screen. Press Home on the remote to pick $app"+ private fun homeNotBack(app: String) = UiText(R.string.data_home_not_back, app)/** Copy from the protected-apps table in the UX copy doc. */- private fun reasonText(r: ProtectedReason) = when (r) {- ProtectedReason.HOME_SCREEN -> "this is your home screen"- ProtectedReason.SYSTEM -> "the TV needs this to work"- ProtectedReason.SETTINGS -> "you need this to change TV settings"- ProtectedReason.PLAY_SERVICES -> "most apps stop working without it"- ProtectedReason.KEYBOARD -> "you'd lose the on-screen keyboard"- ProtectedReason.TV_INPUTS_REMOTE -> "your remote or HDMI inputs could stop working"- ProtectedReason.SETUP_WIZARD -> "the TV may get stuck on restart without it"- ProtectedReason.UPDATES -> "the TV gets its updates through this"- ProtectedReason.UNKNOWN_HOME -> "this TV didn't say which app is its home screen, so Tellyscope won't change anything"- ProtectedReason.CAME_WITH_TV -> "it came with the TV, so it can only be disabled"- ProtectedReason.DISABLED_BY_TV -> "the TV turned this off itself, so it can't be turned back on from here"- }+ private fun reasonText(r: ProtectedReason) = UiText(+ when (r) {+ ProtectedReason.HOME_SCREEN -> R.string.data_protected_home_screen+ ProtectedReason.SYSTEM -> R.string.data_protected_system+ ProtectedReason.SETTINGS -> R.string.data_protected_settings+ ProtectedReason.PLAY_SERVICES -> R.string.data_protected_play_services+ ProtectedReason.KEYBOARD -> R.string.data_protected_keyboard+ ProtectedReason.TV_INPUTS_REMOTE -> R.string.data_protected_tv_inputs_remote+ ProtectedReason.SETUP_WIZARD -> R.string.data_protected_setup_wizard+ ProtectedReason.UPDATES -> R.string.data_protected_updates+ ProtectedReason.UNKNOWN_HOME -> R.string.data_protected_unknown_home+ ProtectedReason.CAME_WITH_TV -> R.string.data_protected_came_with_tv+ ProtectedReason.DISABLED_BY_TV -> R.string.data_protected_disabled_by_tv+ },+ )/** One line for a change the TV refused; what it printed goes in [ActionFailed.details]. */private fun failedText(action: Action, label: String) = when (action) {- Action.Stop -> "the TV wouldn't stop $label"- Action.Disable -> "the TV wouldn't turn $label off"- Action.Enable -> "the TV wouldn't turn $label on"- Action.Open -> "the TV wouldn't open $label"- Action.Uninstall -> "the TV wouldn't uninstall $label"- else -> "the TV refused"+ Action.Stop -> UiText(R.string.data_failed_stop, label)+ Action.Disable -> UiText(R.string.data_failed_disable, label)+ Action.Enable -> UiText(R.string.data_failed_enable, label)+ Action.Open -> UiText(R.string.data_failed_open, label)+ Action.Uninstall -> UiText(R.string.data_failed_uninstall, label)+ else -> UiText(R.string.data_tv_refused)}}@@ -1192,7 +1195,7 @@ internal suspend fun switchHome(withService: Boolean,serviceLaunchers: Set<String>,label: (String) -> String,- reason: (ProtectedReason) -> String,+ reason: (ProtectedReason) -> UiText,record: (packageName: String, undo: Action?, previous: Map<String, String?>) -> HistoryEntry,): HistoryEntry = when (val r = actions.makeHome(pkg)) {is HomeResult.Switched -> {@@ -1216,13 +1219,13 @@ internal suspend fun switchHome(("kept" to "true").takeIf { r.kept }, old?.takeIf { off == true }?.let { "fromService" to it },).toMap(),).also {- if (on == false) throw IllegalStateException(serviceNotOn(label(pkg)))- if (off == false) throw IllegalStateException(serviceNotOff(label(was!!)))+ if (on == false) throw UiTextException(serviceNotOn(label(pkg)))+ if (off == false) throw UiTextException(serviceNotOff(label(was!!)))left?.let { throw ActionFailed(notShown(label(pkg), it.reason), it.output) }}}- is HomeResult.Refused -> throw IllegalStateException(reason(r.reason))- is HomeResult.Failed -> throw ActionFailed(r.output.ifEmpty { "the TV refused" }, r.details)+ is HomeResult.Refused -> throw UiTextException(reason(r.reason))+ is HomeResult.Failed -> throw ActionFailed(tvSaid(r.output), r.details)}/**@@ -1239,11 +1242,11 @@ internal suspend fun fireServiceHome(label: (String) -> String,record: (previous: Map<String, String?>) -> HistoryEntry,): HistoryEntry {- if (!withService) throw IllegalStateException(fireNeedsService(label(pkg)))- val service = actions.homeService(pkg) ?: throw IllegalStateException("${label(pkg)} has no accessibility service")+ if (!withService) throw UiTextException(fireNeedsService(label(pkg)))+ val service = actions.homeService(pkg) ?: throw UiTextException(UiText(R.string.data_no_service, label(pkg)))val previous: Map<String, String?> = if (actions.serviceOn(service)) emptyMap()else if (actions.grant(service)) mapOf("service" to service)- else throw IllegalStateException(fireServiceNotOn(label(pkg)))+ else throw UiTextException(fireServiceNotOn(label(pkg)))// Amazon's launcher isn't stopped: it stays the default, and the service sends Home on from it.val left = actions.homeActivity(pkg)?.let { actions.handOff(null, it) }return record(previous).also { left?.let { throw ActionFailed(notShown(label(pkg), it.reason), it.output) } }@@ -1280,7 +1283,7 @@ internal suspend fun fireHomeBack(record: (to: String?, previous: Map<String, String?>) -> HistoryEntry,): HistoryEntry {val (pkg, service) = held- if (!actions.setService(service, false)) throw IllegalStateException(fireServiceNotOff(label(pkg)))+ if (!actions.setService(service, false)) throw UiTextException(fireServiceNotOff(label(pkg)))val to = actions.currentHome()val left = to?.let { actions.handOff(pkg, it) }return record(to?.substringBefore('/'), mapOf("service" to service)).also {@@ -1310,21 +1313,22 @@ internal suspend fun undoHomeSwitch(actions: Actions, switch: HistoryEntry): Boo/** The package name a reset's History entries carry: it changes the TV, not one app. */internal const val RESET = "reset"-private fun serviceNotOn(app: String) =- "$app is Home now, but its accessibility service didn't turn on, so the TV's Home button may still open its own launcher"+private fun serviceNotOn(app: String) = UiText(R.string.data_service_not_on, app)/** Home moved, but the old launcher didn't close or [app] didn't open: [why] is [HandOffFailed.reason]. */-private fun notShown(app: String, why: String) = "$app is Home now, but $why"+private fun notShown(app: String, why: String) = UiText(R.string.data_not_shown, app, why)/** Fire OS, after No to the service: without it, Home can't open [app]. */-private fun fireNeedsService(app: String) = "on Fire TV, Home can only open $app through its accessibility service, so nothing changed"+private fun fireNeedsService(app: String) = UiText(R.string.data_fire_needs_service, app)++private fun fireServiceNotOn(app: String) = UiText(R.string.data_fire_service_not_on, app)-private fun fireServiceNotOn(app: String) = "the TV didn't turn on $app's accessibility service, so nothing changed"+private fun fireServiceNotOff(app: String) = UiText(R.string.data_fire_service_not_off, app)-private fun fireServiceNotOff(app: String) = "the TV didn't turn off $app's accessibility service, so nothing changed"+private fun serviceNotOff(app: String) = UiText(R.string.data_service_not_off, app)-private fun serviceNotOff(app: String) =- "switched back, but $app's accessibility service is still on. Turn it off in the TV's Settings → Accessibility"+/** What the TV printed when it refused, else that it refused. */+private fun tvSaid(output: String) = output.ifEmpty { null }?.asUiText() ?: UiText(R.string.data_tv_refused)/*** Writes [values] and hands [record] the label and the old values for History. Strict Private DNS@@ -1337,11 +1341,11 @@ internal suspend fun applyTweak(tweak: Tweak,values: Map<String, String?>,strictDns: Boolean,- record: suspend (label: String, previous: Map<String, String?>) -> HistoryEntry,+ record: suspend (label: UiText, previous: Map<String, String?>) -> HistoryEntry,): HistoryEntry {// Only the keys being written: Undo must not touch the ones this change left alone.val before = t.read(tweak).filterKeys { it in values }- if (!t.write(tweak, values)) throw IllegalStateException("the TV didn't accept the change")+ if (!t.write(tweak, values)) throw UiTextException(UiText(R.string.data_tweak_refused))if (strictDns && !t.resolves()) {val restored = try {t.write(tweak, before)@@ -1350,9 +1354,9 @@ internal suspend fun applyTweak(} catch (_: Exception) {false}- if (restored) throw IllegalStateException(TvSettings.dnsUnreachable(values["private_dns_specifier"]))+ if (restored) throw UiTextException(TvSettings.dnsUnreachable(values["private_dns_specifier"]))record(TvSettings.label(tweak, values), before)- throw IllegalStateException(TvSettings.dnsStuck(values["private_dns_specifier"]))+ throw UiTextException(TvSettings.dnsStuck(values["private_dns_specifier"]))}return record(TvSettings.label(tweak, t.read(tweak)), before)}@@ -1368,9 +1372,10 @@ internal suspend fun uninstallAfterHomeBack(switchBack: suspend () -> HistoryEnt} catch (e: CancellationException) {throw e} catch (e: Exception) {- val why = e.message ?: "the TV refused"+ val why = e.why(R.string.data_tv_refused)// "switched back, but …": Home moved, its service didn't turn off.- throw IllegalStateException(if (why.startsWith("switched back")) "$why. Nothing was uninstalled" else "Home didn't switch back: $why. Nothing was uninstalled")+ val switchedBack = (why as? UiText.Res)?.id == R.string.data_service_not_off+ throw UiTextException(UiText(if (switchedBack) R.string.data_uninstall_after_service else R.string.data_uninstall_home_not_back, why))}return uninstall().also { dropUndo(back.id) }}diff --git a/app/src/main/java/app/tellyscope/data/AppNames.kt b/app/src/main/java/app/tellyscope/data/AppNames.ktindex 30eb1b2..ba328b9 100644--- a/app/src/main/java/app/tellyscope/data/AppNames.kt+++ b/app/src/main/java/app/tellyscope/data/AppNames.kt@@ -2,6 +2,7 @@package app.tellyscope.data+import app.tellyscope.Rimport app.tellyscope.adb.AppLabelimport app.tellyscope.adb.Parsersimport kotlinx.coroutines.Dispatchers@@ -91,7 +92,7 @@ class AppNames(private val dir: File) {if (label == pkg || label.startsWith("$pkg.")) fallback(pkg) else label/** What native daemons and system uids are listed as, in place of an app name. */- const val SYSTEM = "Android system"+ val SYSTEM: UiText = UiText(R.string.data_app_names_system)private val GENERIC = setOf("com", "net", "org", "io", "co", "android", "google", "tv", "app", "apps")diff --git a/app/src/main/java/app/tellyscope/data/DeviceLists.kt b/app/src/main/java/app/tellyscope/data/DeviceLists.ktindex 0222305..5f3a09f 100644--- a/app/src/main/java/app/tellyscope/data/DeviceLists.kt+++ b/app/src/main/java/app/tellyscope/data/DeviceLists.kt@@ -2,6 +2,7 @@package app.tellyscope.data+import app.tellyscope.Rimport kotlinx.coroutines.CancellationExceptionimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.sync.Mutex@@ -406,7 +407,7 @@ data class SharedFiles(val launchers: String?, val labels: String?, val streaminenum class SourceResult { Ok, NotHttps, Unreachable, NotAList }-const val NOT_A_LIST = "this source isn't a Tellyscope list"+val NOT_A_LIST: UiText = UiText(R.string.data_lists_not_a_list)/*** An `https://` folder address ending in `/`, or null for anything else. A pasted `index.json`diff --git a/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt b/app/src/main/java/app/tellyscope/data/FakeDeviceSource.ktindex d6f3af5..00048cf 100644--- a/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt+++ b/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt@@ -2,6 +2,8 @@package app.tellyscope.data+import android.content.res.Resources+import app.tellyscope.Rimport app.tellyscope.adb.AdbClientimport app.tellyscope.adb.AllowedKeyimport app.tellyscope.adb.ApkInfo@@ -30,14 +32,18 @@ import okio.Source/*** Stand-in [DeviceSource] for building the screens before the ADB module exists.- * [Scenario] switches between the flows worth looking at.+ * [Scenario] switches between the flows worth looking at. [resources] spell out History labels;+ * without them a label is the [UiText] as data, which no test reads.*/class FakeDeviceSource(private val scenario: Scenario = Scenario.Normal,private val clock: () -> Long = System::currentTimeMillis,private val random: Random = Random.Default,+ private val resources: Resources? = null,) : DeviceSource {+ private fun UiText.text(): String = resources?.let { this.resolve(it) } ?: toString()+enum class Scenario {Normal,/** Scan finds nothing: the brand guide. */@@ -205,7 +211,7 @@ class FakeDeviceSource(val reset = book.entries(deviceId).first { it.id == undoing }val on = ResetRecord.list(reset.previous, ResetRecord.ON)list.replaceAll { if (it.packageName in on) it.copy(enabled = false) else it }- return book.record(deviceId, clock(), Action.Change, packageName, "Put back what Reset TV changed", null, undoing)+ return book.record(deviceId, clock(), Action.Change, packageName, UiText(R.string.data_history_reset_undone).text(), null, undoing)}val i = list.indexOfFirst { it.packageName == packageName }val app = list[i]@@ -251,7 +257,7 @@ class FakeDeviceSource(}if (plan.turnOn.isEmpty()) return into to emptyList()val on = plan.turnOn.joinToString(",") { it.packageName }- val entry = book.record(deviceId, clock(), Action.Reset, "reset", ResetRecord.label(plan.changes), Action.Reset, previous = mapOf(ResetRecord.ON to on))+ val entry = book.record(deviceId, clock(), Action.Reset, "reset", ResetRecord.label(plan.changes).text(), Action.Reset, previous = mapOf(ResetRecord.ON to on))return entry.id to emptyList()}@@ -326,7 +332,7 @@ class FakeDeviceSource(override suspend fun listSource() = listSourceoverride suspend fun setListSource(url: String?) {- listSource = url?.let { normalize(it) ?: throw IllegalStateException("the address has to start with https://") }+ listSource = url?.let { normalize(it) ?: throw UiTextException(UiText(R.string.data_lists_not_https)) }}override suspend fun press(deviceId: String, key: RemoteKey): Boolean {@@ -382,12 +388,12 @@ class FakeDeviceSource(val s = settingsFor(deviceId)val before = values.keys.associateWith { s[it] }s.putAll(values)- return book.record(deviceId, clock(), Action.Change, tweak.name, TvSettings.label(tweak, s), Action.Change, undoing, before)+ return book.record(deviceId, clock(), Action.Change, tweak.name, TvSettings.label(tweak, s).text(), Action.Change, undoing, before)}override suspend fun clearCaches(deviceId: String): Long {delay(800)- book.record(deviceId, clock(), Action.ClearCaches, "", TvSettings.CACHES, undo = null)+ book.record(deviceId, clock(), Action.ClearCaches, "", TvSettings.CACHES.text(), undo = null)return 1_340_000}@@ -473,17 +479,17 @@ class FakeDeviceSource(val baseApps = listOf(- AppInfo("com.spocky.projengmenu", "Projectivy Launcher", 0xFF3D5AFE, false, true, "this is your home screen", "4.52", launchable = true),+ AppInfo("com.spocky.projengmenu", "Projectivy Launcher", 0xFF3D5AFE, false, true, UiText(R.string.data_protected_home_screen), "4.52", launchable = true),AppInfo("com.google.android.youtube.tv", "YouTube", 0xFFC4302B, false, true, null, "4.40.303", launchable = true),AppInfo("com.netflix.ninja", "Netflix", 0xFFB20710, false, true, null, "11.2.0", removable = true, launchable = true),AppInfo("org.jellyfin.androidtv", "Jellyfin", 0xFF7B5EA7, false, true, null, "0.17.4", removable = true, launchable = true),AppInfo("com.xgimi.assistant", "XGIMI Assistant", null, true, true, null, "2.1.8"),AppInfo("com.xgimi.ota", "XGIMI Updates", null, true, true, null, "1.4.0"),AppInfo("com.google.android.tvrecommendations", "TV Recommendations", null, true, false, null, "1.0"),- AppInfo("com.android.systemui", "System UI", null, true, true, "the TV needs this to draw the screen", "11"),- AppInfo("com.android.tv.settings", "Settings", null, true, true, "you need this to change TV settings", "11", launchable = true),- AppInfo("com.google.android.gms", "Google Play services", null, true, true, "most apps stop working without it", "24.38"),- AppInfo("com.google.android.inputmethod.latin", "Gboard", null, true, true, "you'd lose the on-screen keyboard", "14.1"),+ AppInfo("com.android.systemui", "System UI", null, true, true, UiText.Raw("the TV needs this to draw the screen"), "11"),+ AppInfo("com.android.tv.settings", "Settings", null, true, true, UiText(R.string.data_protected_settings), "11", launchable = true),+ AppInfo("com.google.android.gms", "Google Play services", null, true, true, UiText(R.string.data_protected_play_services), "24.38"),+ AppInfo("com.google.android.inputmethod.latin", "Gboard", null, true, true, UiText(R.string.data_protected_keyboard), "14.1"),)val baseProcs = listOf(diff --git a/app/src/main/java/app/tellyscope/data/HistoryBook.kt b/app/src/main/java/app/tellyscope/data/HistoryBook.ktindex 7c303ca..aca34fd 100644--- a/app/src/main/java/app/tellyscope/data/HistoryBook.kt+++ b/app/src/main/java/app/tellyscope/data/HistoryBook.kt@@ -2,6 +2,7 @@package app.tellyscope.data+import app.tellyscope.Rimport java.io.Fileimport java.net.URLDecoderimport java.net.URLEncoder@@ -234,12 +235,11 @@ suspend fun restoreEach(packages: List<String>, enable: suspend (String) -> Histthrow e} catch (e: Exception) {// A dropped connection counts too: the user still needs to know what already changed.- val why = e.message ?: "the TV refused"- throw IllegalStateException(- if (done.isEmpty()) "couldn't turn apps back on: $why"- else "turned ${done.size} ${if (done.size == 1) "app" else "apps"} back on, then stopped: $why",- e,- )+ val why = e.why(R.string.data_tv_refused)+ throw UiTextException(+ if (done.isEmpty()) UiText(R.string.data_restore_none, why)+ else UiText.plural(R.plurals.data_restore_some, done.size, done.size, why),+ ).apply { initCause(e) }}}return donediff --git a/app/src/main/java/app/tellyscope/data/Model.kt b/app/src/main/java/app/tellyscope/data/Model.ktindex d063dac..589b330 100644--- a/app/src/main/java/app/tellyscope/data/Model.kt+++ b/app/src/main/java/app/tellyscope/data/Model.kt@@ -115,7 +115,7 @@ data class AppInfo(val system: Boolean,val enabled: Boolean,/** Why this app can't be touched, in user words; null when actions are allowed. */- val protectedReason: String?,+ val protectedReason: UiText?,val version: String,/** The app's own icon as a PNG, from the TV; null shows the letter avatar. */val icon: ByteArray? = null,diff --git a/app/src/main/java/app/tellyscope/data/ResetPlan.kt b/app/src/main/java/app/tellyscope/data/ResetPlan.ktindex 6e81b59..4a68ec2 100644--- a/app/src/main/java/app/tellyscope/data/ResetPlan.kt+++ b/app/src/main/java/app/tellyscope/data/ResetPlan.kt@@ -2,6 +2,8 @@package app.tellyscope.data+import app.tellyscope.R+/** One app Reset TV changes, with the name it shows. */data class ResetApp(val packageName: String, val label: String)@@ -34,7 +36,7 @@ enum class ResetPart { TurnOn, BringBack, Home }data class ResetProgress(val part: ResetPart, val done: Int, val of: Int)/** A step that didn't work: the [app] it was for (none for Home) and the TV's [reason]. */-data class ResetFailure(val part: ResetPart, val app: ResetApp?, val reason: String)+data class ResetFailure(val part: ResetPart, val app: ResetApp?, val reason: UiText)/** History's record of a reset: what Undo turns off, removes and switches back. */internal object ResetRecord {@@ -44,7 +46,7 @@ internal object ResetRecord {const val TO = "to"const val SERVICE = "service"- fun label(changes: Int) = "Reset TV · $changes ${if (changes == 1) "change" else "changes"}"+ fun label(changes: Int) = UiText.plural(R.plurals.data_history_reset, changes)fun list(previous: Map<String, String?>?, key: String) = previous?.get(key)?.split(',')?.filter { it.isNotEmpty() }.orEmpty()diff --git a/app/src/main/java/app/tellyscope/data/TvSettings.kt b/app/src/main/java/app/tellyscope/data/TvSettings.ktindex f9d03d0..93bde3e 100644--- a/app/src/main/java/app/tellyscope/data/TvSettings.kt+++ b/app/src/main/java/app/tellyscope/data/TvSettings.kt@@ -2,6 +2,7 @@package app.tellyscope.data+import app.tellyscope.Rimport app.tellyscope.adb.Tweak/** What each TV tweak writes, and how History names it afterwards. */@@ -10,7 +11,7 @@ object TvSettings {const val ADGUARD = "dns.adguard-dns.com"const val FAST = "0.5"/** History's name for a cache clear: "Cleared app caches". */- const val CACHES = "app caches"+ val CACHES: UiText = UiText(R.string.data_history_app_caches)/** Android 9, the first with Private DNS. */const val DNS_SDK = 28@@ -29,25 +30,22 @@ object TvSettings {)/** History's line for a change that left the TV at [values]. */- fun label(tweak: Tweak, values: Map<String, String?>): String = when (tweak) {+ fun label(tweak: Tweak, values: Map<String, String?>): UiText = when (tweak) {Tweak.PRIVATE_DNS -> when (values["private_dns_mode"]) {- "hostname" -> "Private DNS set to ${values["private_dns_specifier"]}"- "off" -> "Private DNS turned off"- else -> "Private DNS set to Automatic"+ "hostname" -> UiText(R.string.data_history_dns_host, values["private_dns_specifier"].toString())+ "off" -> UiText(R.string.data_history_dns_off)+ else -> UiText(R.string.data_history_dns_automatic)}Tweak.ANIMATIONS -> when (val v = values["window_animation_scale"]?.toFloatOrNull()) {- null, 1f -> "Animations at normal speed"- 0f -> "Animations turned off"- else -> "Animations at ${v.toString().removeSuffix(".0")}×"+ null, 1f -> UiText(R.string.data_history_animations_normal)+ 0f -> UiText(R.string.data_history_animations_off)+ else -> UiText(R.string.data_history_animations_scale, v.toString().removeSuffix(".0"))}}- const val DNS_TOO_OLD = "Private DNS needs Android 9 or newer, and this TV is older"+ val DNS_TOO_OLD: UiText = UiText(R.string.data_dns_too_old)- fun dnsUnreachable(host: String?) =- "the TV couldn't look anything up through $host, so Private DNS was put back. The network may block encrypted DNS (port 853)"+ fun dnsUnreachable(host: String?) = UiText(R.string.data_dns_unreachable, host.toString())- fun dnsStuck(host: String?) =- "the TV couldn't look anything up through $host, and putting the old Private DNS back failed. " +- "The TV may be offline until you undo it in History"+ fun dnsStuck(host: String?) = UiText(R.string.data_dns_stuck, host.toString())}diff --git a/app/src/main/java/app/tellyscope/data/UiText.kt b/app/src/main/java/app/tellyscope/data/UiText.ktindex 3e25f50..5d8812c 100644--- a/app/src/main/java/app/tellyscope/data/UiText.kt+++ b/app/src/main/java/app/tellyscope/data/UiText.kt@@ -8,6 +8,7 @@ import androidx.annotation.PluralsResimport androidx.annotation.StringResimport androidx.compose.runtime.Composableimport androidx.compose.runtime.ReadOnlyComposable+import androidx.compose.ui.platform.LocalConfigurationimport androidx.compose.ui.platform.LocalContextimport app.tellyscope.R@@ -52,15 +53,18 @@ sealed interface UiText {private fun List<Any>.resolved(res: Resources): Array<Any> = map { if (it is UiText) it.resolve(res) else it }.toTypedArray()-/** Resolves in a composable, the way `stringResource` does. */+/** Resolves in a composable, the way `stringResource` does: again when the configuration changes. */@Composable@ReadOnlyComposable-fun UiText.resolve(): String = resolve(LocalContext.current.resources)+fun UiText.resolve(): String {+ LocalConfiguration.current+ return resolve(LocalContext.current.resources)+}fun String.asUiText(): UiText = UiText.Raw(this)/** A failure whose message is for the user; [text] is what the screen shows. */-class UiTextException(val text: UiText) : IllegalStateException()+open class UiTextException(val text: UiText) : IllegalStateException()/** What went wrong, for the user: our own wording when we threw it, else the message as it came. */fun Throwable.why(@StringRes fallback: Int): UiText = (this as? UiTextException)?.text ?: message?.asUiText() ?: UiText(fallback)diff --git a/app/src/main/java/app/tellyscope/ui/AccessUi.kt b/app/src/main/java/app/tellyscope/ui/AccessUi.ktindex 70b991e..88a9905 100644--- a/app/src/main/java/app/tellyscope/ui/AccessUi.kt+++ b/app/src/main/java/app/tellyscope/ui/AccessUi.kt@@ -82,6 +82,10 @@ import app.tellyscope.data.AccessClientimport app.tellyscope.data.AccessKeyimport app.tellyscope.data.DeviceStateimport app.tellyscope.data.TvAccess+import androidx.compose.ui.res.stringResource+import app.tellyscope.R+import app.tellyscope.data.UiText+import app.tellyscope.data.resolve/** What the Who has access screen and the warning can do. */data class AccessActions(@@ -190,27 +194,27 @@ fun AccessWarning(access: TvAccess, actions: AccessActions, onWho: () -> Unit, sIcon(AccessIcons.Shield, contentDescription = null, Modifier.padding(top = 2.dp).size(24.dp))Spacer(Modifier.width(16.dp))Column(Modifier.weight(1f)) {- Text(Copy.WARNING_TITLE, style = MaterialTheme.typography.titleMedium)- Text(Copy.WARNING_TEXT, style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = 4.dp))+ Text(Copy.WARNING_TITLE.resolve(), style = MaterialTheme.typography.titleMedium)+ Text(Copy.WARNING_TEXT.resolve(), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = 4.dp))}Icon(if (open) Icons.Default.KeyboardArrowUp else Icons.Default.KeyboardArrowDown,- contentDescription = if (open) "Show less" else "Show more",+ contentDescription = if (open) stringResource(R.string.access_show_less) else stringResource(R.string.access_show_more),Modifier.padding(start = 8.dp),)}if (open) {Column(Modifier.padding(start = 40.dp, top = 12.dp, end = 4.dp)) {HorizontalDivider(color = c.onErrorContainer.copy(alpha = 0.2f))- Text(Copy.CONNECTED_NOW, style = MaterialTheme.typography.labelMedium, modifier = Modifier.padding(top = 12.dp))+ Text(Copy.CONNECTED_NOW.resolve(), style = MaterialTheme.typography.labelMedium, modifier = Modifier.padding(top = 12.dp))others.forEach { o ->- Text(Copy.connectedFrom(if (o.who == AccessClient.Who.OnTv) Copy.ON_TV.lowercase() else o.address, o.connections), style = MaterialTheme.typography.bodyLarge)+ Text(Copy.connectedFrom(if (o.who == AccessClient.Who.OnTv) Copy.ON_TV.resolve().lowercase() else o.address, o.connections).resolve(), style = MaterialTheme.typography.bodyLarge)}Row(Modifier.padding(top = 8.dp).clip(RoundedCornerShape(8.dp)).clickable(onClick = onWho).padding(vertical = 4.dp),verticalAlignment = Alignment.CenterVertically,) {- Text(Copy.WHO_HAS_ACCESS, style = MaterialTheme.typography.labelLarge)+ Text(Copy.WHO_HAS_ACCESS.resolve(), style = MaterialTheme.typography.labelLarge)Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null, Modifier.size(18.dp))}}@@ -219,12 +223,12 @@ fun AccessWarning(access: TvAccess, actions: AccessActions, onWho: () -> Unit, sval border = BorderStroke(1.dp, c.onErrorContainer)val colors = ButtonDefaults.outlinedButtonColors(contentColor = c.onErrorContainer)OutlinedButton(onClick = { others.singleOrNull()?.let { actions.markMine(it.address) } ?: onWho() }, border = border, colors = colors) {- Text(Copy.ITS_MINE)+ Text(Copy.ITS_MINE.resolve())}OutlinedButton(onClick = actions.askRemove, border = border, colors = colors, contentPadding = ButtonDefaults.ButtonWithIconContentPadding) {Icon(AccessIcons.LockReset, contentDescription = null, Modifier.size(18.dp))Spacer(Modifier.width(8.dp))- Text(Copy.REMOVE_ACCESS)+ Text(Copy.REMOVE_ACCESS.resolve())}}}@@ -245,12 +249,12 @@ fun ConnectedDevicesCard(peripherals: List<Peripheral>, startOpen: Boolean = falmodifier = Modifier.fillMaxWidth().animateContentSize().testTag("connectedDevices"),) {Column(Modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 8.dp)) {- Text(Copy.DEVICES_TITLE, style = MaterialTheme.typography.titleMedium, modifier = Modifier.padding(bottom = 4.dp))+ Text(Copy.DEVICES_TITLE.resolve(), style = MaterialTheme.typography.titleMedium, modifier = Modifier.padding(bottom = 4.dp))if (peripherals.isEmpty()) {- Text(Copy.NO_DEVICES, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant, modifier = Modifier.padding(vertical = 8.dp))+ Text(Copy.NO_DEVICES.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant, modifier = Modifier.padding(vertical = 8.dp))} else if (open) {peripherals.groupBy { it.group }.forEach { (group, rows) ->- Text(Copy.group(group), style = MaterialTheme.typography.labelLarge, color = c.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp, bottom = 2.dp))+ Text(Copy.group(group).resolve(), style = MaterialTheme.typography.labelLarge, color = c.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp, bottom = 2.dp))rows.forEach { PeripheralRow(it, grouped = true) }}} else {@@ -258,7 +262,7 @@ fun ConnectedDevicesCard(peripherals: List<Peripheral>, startOpen: Boolean = fal}if (peripherals.size > COLLAPSED_ROWS) {TextButton(onClick = { open = !open }, contentPadding = PaddingValues(horizontal = 0.dp, vertical = 8.dp)) {- Text(if (open) Copy.SHOW_LESS else Copy.showAll(peripherals.size))+ Text(if (open) Copy.SHOW_LESS.resolve() else Copy.showAll(peripherals.size).resolve())}}}@@ -275,7 +279,7 @@ private fun PeripheralRow(p: Peripheral, grouped: Boolean) {Spacer(Modifier.width(16.dp))Text(p.name, Modifier.weight(1f), style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)Spacer(Modifier.width(8.dp))- Text(Copy.peripheralStatus(p, grouped), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(Copy.peripheralStatus(p, grouped).resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)}}@@ -296,13 +300,13 @@ fun AccessScreen(state: UiState, actions: AccessActions, snackbar: SnackbarHostSTopAppBar(title = {Column {- Text(if (flow) Copy.REMOVE_TITLE else Copy.WHO_HAS_ACCESS)+ Text(if (flow) Copy.REMOVE_TITLE.resolve() else Copy.WHO_HAS_ACCESS.resolve())Text(name(device), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)}},navigationIcon = {IconButton(onClick = if (flow) actions.close else actions.back) {- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = if (flow) Copy.WHO_HAS_ACCESS else "Back to the TV's page")+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = if (flow) Copy.WHO_HAS_ACCESS.resolve() else stringResource(R.string.access_back_to_tv))}},)@@ -311,32 +315,32 @@ fun AccessScreen(state: UiState, actions: AccessActions, snackbar: SnackbarHostSval body = Modifier.fillMaxSize().padding(pad)when (removal?.step) {null, Removal.Step.Confirm -> AccessList(ui.access, state.clock(), device.state == DeviceState.Online, actions, body)- Removal.Step.Revoking -> Waiting(Copy.REVOKING, body)- Removal.Step.Checking -> Waiting(Copy.CHECKING, body)+ Removal.Step.Revoking -> Waiting(Copy.REVOKING.resolve(), body)+ Removal.Step.Checking -> Waiting(Copy.CHECKING.resolve(), body)Removal.Step.Manual -> ManualGuide(actions, body)Removal.Step.Allow -> AllowPhone(removal, actions, body)Removal.Step.Done -> Outcome(- body, Verdict.Done, Copy.DONE_TITLE, Copy.DONE_TEXT,+ body, Verdict.Done, Copy.DONE_TITLE.resolve(), Copy.DONE_TEXT.resolve(),trust = true,- ) { Button(onClick = { actions.close(); actions.back() }) { Text(Copy.backTo(name(device))) } }+ ) { Button(onClick = { actions.close(); actions.back() }) { Text(Copy.backTo(name(device)).resolve()) } }Removal.Step.StillConnected -> if (removal.open) {// Only a restart ends an open connection, so it leads; Who has access steps down to a link.Outcome(- body, Verdict.Still, Copy.STILL_TITLE, Copy.stillOpenText(removal.still ?: Copy.UNNAMED_COMPUTER, name(device)),- link = { TextButton(onClick = actions.close) { Text(Copy.WHO_HAS_ACCESS) } },+ body, Verdict.Still, Copy.STILL_TITLE.resolve(), Copy.stillOpenText((removal.still ?: Copy.UNNAMED_COMPUTER).resolve(), name(device)).resolve(),+ link = { TextButton(onClick = actions.close) { Text(Copy.WHO_HAS_ACCESS.resolve()) } },) {- OutlinedButton(onClick = actions.checkAgain) { Text(Copy.CHECK_AGAIN) }- Button(onClick = actions.restart) { Text(Copy.RESTART_TV) }+ OutlinedButton(onClick = actions.checkAgain) { Text(Copy.CHECK_AGAIN.resolve()) }+ Button(onClick = actions.restart) { Text(Copy.RESTART_TV.resolve()) }}} else {- Outcome(body, Verdict.Still, Copy.STILL_TITLE, Copy.stillText(removal.still ?: Copy.UNNAMED_COMPUTER, name(device))) {- OutlinedButton(onClick = actions.close) { Text(Copy.WHO_HAS_ACCESS) }- Button(onClick = actions.retry) { Text(Copy.TRY_AGAIN) }+ Outcome(body, Verdict.Still, Copy.STILL_TITLE.resolve(), Copy.stillText((removal.still ?: Copy.UNNAMED_COMPUTER).resolve(), name(device)).resolve()) {+ OutlinedButton(onClick = actions.close) { Text(Copy.WHO_HAS_ACCESS.resolve()) }+ Button(onClick = actions.retry) { Text(Copy.TRY_AGAIN.resolve()) }}}- Removal.Step.Restarting -> Waiting(Copy.RESTARTING_TO_CHECK, body)- Removal.Step.Unconfirmed -> Outcome(body, Verdict.Unknown, Copy.UNCONFIRMED_TITLE, Copy.UNCONFIRMED_TEXT) {- Button(onClick = actions.close) { Text(Copy.DONE) }+ Removal.Step.Restarting -> Waiting(Copy.RESTARTING_TO_CHECK.resolve(), body)+ Removal.Step.Unconfirmed -> Outcome(body, Verdict.Unknown, Copy.UNCONFIRMED_TITLE.resolve(), Copy.UNCONFIRMED_TEXT.resolve()) {+ Button(onClick = actions.close) { Text(Copy.DONE.resolve()) }}}}@@ -354,15 +358,15 @@ private fun ConfirmRemoval(actions: AccessActions) {AlertDialog(onDismissRequest = actions.close,icon = { Icon(AccessIcons.LockReset, contentDescription = null, tint = c.error) },- title = { Text(Copy.CONFIRM_TITLE, textAlign = TextAlign.Center) },+ title = { Text(Copy.CONFIRM_TITLE.resolve(), textAlign = TextAlign.Center) },text = {Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {- Text(Copy.CONFIRM_TEXT)- Text(Copy.CONFIRM_REMOTE)+ Text(Copy.CONFIRM_TEXT.resolve())+ Text(Copy.CONFIRM_REMOTE.resolve())}},- confirmButton = { Button(onClick = actions.remove, colors = ButtonDefaults.buttonColors(containerColor = c.error, contentColor = c.onError)) { Text(Copy.CONFIRM_BUTTON) } },- dismissButton = { TextButton(onClick = actions.close) { Text(Copy.CANCEL) } },+ confirmButton = { Button(onClick = actions.remove, colors = ButtonDefaults.buttonColors(containerColor = c.error, contentColor = c.onError)) { Text(Copy.CONFIRM_BUTTON.resolve()) } },+ dismissButton = { TextButton(onClick = actions.close) { Text(Copy.CANCEL.resolve()) } },)}@@ -371,23 +375,23 @@ private fun ConfirmRemoval(actions: AccessActions) {private fun AccessList(access: TvAccess?, now: Long, online: Boolean, actions: AccessActions, modifier: Modifier) {val c = MaterialTheme.colorSchemeLazyColumn(modifier, contentPadding = PaddingValues(start = 16.dp, end = 16.dp, bottom = 32.dp)) {- item { Text(Copy.ACCESS_INTRO, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant, modifier = Modifier.padding(bottom = 16.dp)) }+ item { Text(Copy.ACCESS_INTRO.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant, modifier = Modifier.padding(bottom = 16.dp)) }section(Copy.CONNECTED_NOW)when (val list = access?.connected) {- null -> item { Muted(if (access == null) "Checking…" else Copy.CANT_CHECK_CONNECTED) }+ null -> item { Muted(if (access == null) stringResource(R.string.access_checking) else Copy.CANT_CHECK_CONNECTED.resolve()) }else -> segmented(list) { ConnectedRow(it, actions) }}item { Spacer(Modifier.height(24.dp)) }section(Copy.ALLOWED_COMPUTERS)when (val list = access?.allowed) {- null -> item { Muted(if (access == null) "Checking…" else Copy.CANT_CHECK_ALLOWED) }- emptyList<AccessKey>() -> item { Muted(Copy.NOBODY_ALLOWED) }+ null -> item { Muted(if (access == null) stringResource(R.string.access_checking) else Copy.CANT_CHECK_ALLOWED.resolve()) }+ emptyList<AccessKey>() -> item { Muted(Copy.NOBODY_ALLOWED.resolve()) }else -> segmented(list) { AllowedRow(it, now, actions) }}item {Column(Modifier.padding(top = 16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(Copy.ACCESS_FOOT_LINK, style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)- Text(Copy.ACCESS_FOOT_ALL, style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(Copy.ACCESS_FOOT_LINK.resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(Copy.ACCESS_FOOT_ALL.resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)OutlinedButton(onClick = actions.askRemove,enabled = online,@@ -397,15 +401,15 @@ private fun AccessList(access: TvAccess?, now: Long, online: Boolean, actions: A) {Icon(AccessIcons.LockReset, contentDescription = null, Modifier.size(18.dp))Spacer(Modifier.width(8.dp))- Text(Copy.REMOVE_ACCESS)+ Text(Copy.REMOVE_ACCESS.resolve())}}}}}-private fun LazyListScope.section(title: String) = item {- Text(title, style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, modifier = Modifier.padding(bottom = 8.dp))+private fun LazyListScope.section(title: UiText) = item {+ Text(title.resolve(), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, modifier = Modifier.padding(bottom = 8.dp))}/** An MD3 segmented list: 2 dp apart, 16 dp outer corners and 4 dp inner ones. */@@ -430,8 +434,8 @@ private fun ConnectedRow(client: AccessClient, actions: AccessActions) {AccessRow(icon = if (phone) AccessIcons.Phone else AccessIcons.Lan,title = when (client.who) {- AccessClient.Who.Phone -> Copy.THIS_PHONE- AccessClient.Who.OnTv -> Copy.ON_TV+ AccessClient.Who.Phone -> Copy.THIS_PHONE.resolve()+ AccessClient.Who.OnTv -> Copy.ON_TV.resolve()else -> client.address},chip = when (client.who) {@@ -442,22 +446,22 @@ private fun ConnectedRow(client: AccessClient, actions: AccessActions) {) {if (phone || client.who == AccessClient.Who.OnTv) Sub(client.address)// Not in yet, so no connection count: it isn't using the TV.- if (client.who != AccessClient.Who.Waiting) Sub(Copy.connections(client.connections))+ if (client.who != AccessClient.Who.Waiting) Sub(Copy.connections(client.connections).resolve())when (client.who) {AccessClient.Who.Waiting -> {- Text(Copy.WAITING_LINE, style = MaterialTheme.typography.bodyMedium)- Sub(Copy.WAITING_TEXT)+ Text(Copy.WAITING_LINE.resolve(), style = MaterialTheme.typography.bodyMedium)+ Sub(Copy.WAITING_TEXT.resolve())Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.CenterEnd) {- FilledTonalButton(onClick = actions.showRequest) { Text(Copy.ANSWER) }+ FilledTonalButton(onClick = actions.showRequest) { Text(Copy.ANSWER.resolve()) }}}AccessClient.Who.Other, AccessClient.Who.OnTv -> {- Text(Copy.NOT_THIS_PHONE, style = MaterialTheme.typography.bodyMedium, color = c.error)+ Text(Copy.NOT_THIS_PHONE.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.error)Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.CenterEnd) {- FilledTonalButton(onClick = { actions.markMine(client.address) }) { Text(Copy.ITS_MINE) }+ FilledTonalButton(onClick = { actions.markMine(client.address) }) { Text(Copy.ITS_MINE.resolve()) }}}- AccessClient.Who.Mine -> Sub(Copy.YOURS)+ AccessClient.Who.Mine -> Sub(Copy.YOURS.resolve())AccessClient.Who.Phone -> {}}}@@ -473,22 +477,22 @@ private fun AllowedRow(key: AccessKey, now: Long, actions: AccessActions) {"laptop" in name.lowercase() || "book" in name.lowercase() -> AccessIcons.Laptopelse -> AccessIcons.Desktop},- title = if (key.phone) Copy.THIS_PHONE else name ?: Copy.UNNAMED_COMPUTER,+ title = if (key.phone) Copy.THIS_PHONE.resolve() else name ?: Copy.UNNAMED_COMPUTER.resolve(),chip = if (key.phone) Chip.Tellyscope else if (key.new) Chip.New else null,) {Text(Copy.shortFingerprint(key.fingerprint), style = MaterialTheme.typography.bodyMedium.copy(fontFamily = FontFamily.Monospace), color = MaterialTheme.colorScheme.onSurfaceVariant)- Sub(Copy.lastSeen(key.lastSeen, now))+ Sub(Copy.lastSeen(key.lastSeen, now).resolve())if (key.new) {- Text(Copy.NEW_KEY_TEXT, style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = 4.dp))+ Text(Copy.NEW_KEY_TEXT.resolve(), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = 4.dp))Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.CenterEnd) {- FilledTonalButton(onClick = { actions.markKeyMine(key.fingerprint) }) { Text(Copy.ITS_MINE) }+ FilledTonalButton(onClick = { actions.markKeyMine(key.fingerprint) }) { Text(Copy.ITS_MINE.resolve()) }}}}}/** Beside a row's title: this phone is Tellyscope, filled; Waiting and New are neutral outlines, a state and not an alarm. */-private enum class Chip(val text: String) { Tellyscope(Copy.TELLYSCOPE), Waiting(Copy.WAITING_CHIP), New(Copy.NEW_CHIP) }+private enum class Chip(val text: UiText) { Tellyscope(Copy.TELLYSCOPE), Waiting(Copy.WAITING_CHIP), New(Copy.NEW_CHIP) }@Composableprivate fun AccessRow(icon: ImageVector, title: String, chip: Chip?, lines: @Composable () -> Unit) {@@ -508,7 +512,7 @@ private fun AccessRow(icon: ImageVector, title: String, chip: Chip?, lines: @ComcontentColor = if (filled) c.onSecondaryContainer else c.onSurfaceVariant,border = if (filled) null else BorderStroke(1.dp, c.outline),) {- Text(chip.text, style = MaterialTheme.typography.labelMedium, modifier = Modifier.padding(horizontal = 8.dp, vertical = 2.dp))+ Text(chip.text.resolve(), style = MaterialTheme.typography.labelMedium, modifier = Modifier.padding(horizontal = 8.dp, vertical = 2.dp))}}}@@ -542,36 +546,36 @@ private fun AllowPhone(removal: Removal, actions: AccessActions, modifier: ModifhorizontalAlignment = Alignment.CenterHorizontally,) {LoadingIndicator(Modifier.size(96.dp))- Text(Copy.ALLOW_TITLE, style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center, modifier = Modifier.padding(top = 32.dp))+ Text(Copy.ALLOW_TITLE.resolve(), style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center, modifier = Modifier.padding(top = 32.dp))Text(buildAnnotatedString {- append(Copy.ALLOW_TEXT_A)- withStyle(SpanStyle(fontWeight = FontWeight.SemiBold)) { append(Copy.ALLOW_ALWAYS) }- append(Copy.ALLOW_TEXT_B)- withStyle(SpanStyle(fontWeight = FontWeight.SemiBold)) { append(Copy.ALLOW_BUTTON) }+ append(Copy.ALLOW_TEXT_A.resolve())+ withStyle(SpanStyle(fontWeight = FontWeight.SemiBold)) { append(Copy.ALLOW_ALWAYS.resolve()) }+ append(Copy.ALLOW_TEXT_B.resolve())+ withStyle(SpanStyle(fontWeight = FontWeight.SemiBold)) { append(Copy.ALLOW_BUTTON.resolve()) }append(".")},style = MaterialTheme.typography.bodyLarge, color = c.onSurfaceVariant, textAlign = TextAlign.Center,modifier = Modifier.padding(top = 12.dp),)if (removal.refused) {- Text(Copy.REFUSED, style = MaterialTheme.typography.bodyLarge, color = c.error, textAlign = TextAlign.Center, modifier = Modifier.padding(top = 16.dp))- Button(onClick = actions.askAgain, Modifier.padding(top = 8.dp)) { Text(Copy.ASK_AGAIN) }+ Text(Copy.REFUSED.resolve(), style = MaterialTheme.typography.bodyLarge, color = c.error, textAlign = TextAlign.Center, modifier = Modifier.padding(top = 16.dp))+ Button(onClick = actions.askAgain, Modifier.padding(top = 8.dp)) { Text(Copy.ASK_AGAIN.resolve()) }}removal.fingerprint?.let { fp ->Surface(shape = MaterialTheme.shapes.large, color = c.surfaceContainerHigh, modifier = Modifier.fillMaxWidth().padding(top = 24.dp)) {Column(Modifier.padding(16.dp)) {- Text(Copy.FINGERPRINT_LABEL, style = MaterialTheme.typography.labelLarge, color = c.onSurfaceVariant)+ Text(Copy.FINGERPRINT_LABEL.resolve(), style = MaterialTheme.typography.labelLarge, color = c.onSurfaceVariant)Text(fp.replace(":", ":"),style = MaterialTheme.typography.titleMedium.copy(fontFamily = FontFamily.Monospace),modifier = Modifier.padding(vertical = 8.dp),)- Text(Copy.FINGERPRINT_HINT, style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(Copy.FINGERPRINT_HINT.resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)}}}- TextButton(onClick = actions.close, Modifier.padding(top = 16.dp)) { Text(Copy.STOP_WAITING) }+ TextButton(onClick = actions.close, Modifier.padding(top = 16.dp)) { Text(Copy.STOP_WAITING.resolve()) }}}@@ -580,16 +584,16 @@ private fun AllowPhone(removal: Removal, actions: AccessActions, modifier: Modifprivate fun ManualGuide(actions: AccessActions, modifier: Modifier) {val c = MaterialTheme.colorSchemeColumn(modifier.verticalScroll(rememberScrollState()).padding(horizontal = 24.dp, vertical = 16.dp)) {- Text(Copy.MANUAL_INTRO, style = MaterialTheme.typography.bodyLarge, color = c.onSurfaceVariant)- Step(1, Copy.MANUAL_STEP_1, Copy.MANUAL_STEP_1_TEXT) {+ Text(Copy.MANUAL_INTRO.resolve(), style = MaterialTheme.typography.bodyLarge, color = c.onSurfaceVariant)+ Step(1, Copy.MANUAL_STEP_1.resolve(), Copy.MANUAL_STEP_1_TEXT.resolve()) {Button(onClick = actions.openDeveloperOptions, contentPadding = ButtonDefaults.ButtonWithIconContentPadding) {Icon(OpenInNew, contentDescription = null, Modifier.size(18.dp))Spacer(Modifier.width(8.dp))- Text(Copy.OPEN_ON_TV)+ Text(Copy.OPEN_ON_TV.resolve())}}- Step(2, Copy.MANUAL_STEP_2, Copy.MANUAL_STEP_2_TEXT) {- OutlinedButton(onClick = actions.revokedByHand) { Text(Copy.MANUAL_DONE) }+ Step(2, Copy.MANUAL_STEP_2.resolve(), Copy.MANUAL_STEP_2_TEXT.resolve()) {+ OutlinedButton(onClick = actions.revokedByHand) { Text(Copy.MANUAL_DONE.resolve()) }}}}@@ -644,7 +648,7 @@ private fun Outcome(Row(Modifier.padding(16.dp)) {Icon(AccessIcons.ShieldNote, contentDescription = null, tint = c.onSurfaceVariant)Spacer(Modifier.width(16.dp))- Text(Copy.TRUST_WARNING, style = MaterialTheme.typography.bodyLarge)+ Text(Copy.TRUST_WARNING.resolve(), style = MaterialTheme.typography.bodyLarge)}}}diff --git a/app/src/main/java/app/tellyscope/ui/AdvancedScreen.kt b/app/src/main/java/app/tellyscope/ui/AdvancedScreen.ktindex 2bc6822..15c58fd 100644--- a/app/src/main/java/app/tellyscope/ui/AdvancedScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/AdvancedScreen.kt@@ -2,6 +2,7 @@package app.tellyscope.ui+import androidx.annotation.StringResimport androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickable@@ -42,15 +43,19 @@ import androidx.compose.ui.Modifierimport androidx.compose.ui.Alignmentimport androidx.compose.ui.draw.alphaimport androidx.compose.ui.draw.clip+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.AppInfoimport app.tellyscope.data.AppNamesimport app.tellyscope.data.DeviceStateimport app.tellyscope.data.NetworkInfoimport app.tellyscope.data.Procimport app.tellyscope.data.Snapshot+import app.tellyscope.data.resolveimport app.tellyscope.ui.theme.SmallNumberimport app.tellyscope.ui.theme.StatNumber@@ -70,18 +75,20 @@ fun AdvancedScreen(val snap = ui.snapshotval offline = device.state != DeviceState.Onlineval procs = snap?.procs.orEmpty()- val byApp = remember(ui.apps, procs) {+ val androidSystem = Copy.ANDROID_SYSTEM.resolve()+ val byApp = remember(ui.apps, procs, androidSystem) {val labels = ui.apps.associate { it.packageName to it.label }- procs.groupBy { p -> p.packageName?.let { labels[it] ?: AppNames.fallback(it) } ?: Copy.ANDROID_SYSTEM }+ procs.groupBy { p -> p.packageName?.let { labels[it] ?: AppNames.fallback(it) } ?: androidSystem }}+ val res = LocalContext.current.resourcesScaffold(snackbarHost = { SnackbarHost(snackbar) },topBar = {TopAppBar(- title = { Text(Copy.ADVANCED_MONITOR) },+ title = { Text(Copy.ADVANCED_MONITOR.resolve()) },navigationIcon = {- IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back to the TV's page") }+ IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.advanced_back)) }},)},@@ -94,12 +101,12 @@ fun AdvancedScreen(item {Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer)) {Column(Modifier.fillMaxWidth().padding(16.dp)) {- Text("This TV", style = MaterialTheme.typography.titleSmall, modifier = Modifier.padding(bottom = 4.dp))+ Text(stringResource(R.string.advanced_this_tv), style = MaterialTheme.typography.titleSmall, modifier = Modifier.padding(bottom = 4.dp))listOfNotNull(- "IP address" to device.hit.ip,- "Port" to device.hit.port.toString(),- (device.manufacturer ?: device.hit.maker)?.let { "Maker" to it },- device.hit.hostname?.let { "Network name" to it },+ stringResource(R.string.advanced_ip_address) to device.hit.ip,+ stringResource(R.string.advanced_port) to device.hit.port.toString(),+ (device.manufacturer ?: device.hit.maker)?.let { stringResource(R.string.advanced_maker) to it },+ device.hit.hostname?.let { stringResource(R.string.advanced_network_name) to it },).forEach { (k, v) -> KeyValue(k, v) }}}@@ -110,7 +117,7 @@ fun AdvancedScreen(} else {item {Text(- if (offline) Copy.noStats(device.state) else "Loading stats…",+ if (offline) Copy.noStats(device.state).resolve() else stringResource(R.string.advanced_loading),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,)@@ -118,11 +125,11 @@ fun AdvancedScreen(}// A TV that lists no processes gets no charts: no bars beats an empty card.if (byApp.isNotEmpty()) {- item { UsageCard("CPU by app", byApp.map { (n, ps) -> n to ps.sumOf { it.cpuPercent } }, fmt = { "%.0f%%".format(it) }) }- item { UsageCard("RAM by app", byApp.map { (n, ps) -> n to ps.sumOf { it.ramMb }.toDouble() }, fmt = { Copy.mb(it.toInt()) }) }- item { Block("Processes") { ProcessTable(snap?.procs.orEmpty(), ui.apps) } }+ item { UsageCard(stringResource(R.string.advanced_cpu_by_app), byApp.map { (n, ps) -> n to ps.sumOf { it.cpuPercent } }, fmt = { res.getString(R.string.advanced_percent_whole, it) }) }+ item { UsageCard(stringResource(R.string.advanced_ram_by_app), byApp.map { (n, ps) -> n to ps.sumOf { it.ramMb }.toDouble() }, fmt = { Copy.mb(it.toInt()).resolve(res) }) }+ item { Block(stringResource(R.string.advanced_processes)) { ProcessTable(snap?.procs.orEmpty(), ui.apps) } }}- ui.network?.let { n -> item { Block("Network") { NetworkBlock(n) } } }+ ui.network?.let { n -> item { Block(stringResource(R.string.advanced_network)) { NetworkBlock(n) } } }}}}@@ -144,22 +151,22 @@ private fun Block(title: String, body: @Composable () -> Unit) {@Composableprivate fun Stats(s: Snapshot, staleSince: Long?) {val cells = listOf(- "CPU" to "${s.cpuPercent}%",- "On for" to Copy.uptime(s.uptimeSeconds),- "Screen" to s.screenOn?.let { if (it) "On" else "Off" },+ stringResource(R.string.advanced_cpu) to stringResource(R.string.advanced_percent, s.cpuPercent),+ stringResource(R.string.advanced_on_for) to Copy.uptime(s.uptimeSeconds).resolve(),+ stringResource(R.string.advanced_screen) to s.screenOn?.let { stringResource(if (it) R.string.advanced_screen_on else R.string.advanced_screen_off) },)Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer)) {Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {if (staleSince != null) {Text(- "As of ${Copy.ago(s.at, staleSince)}",+ stringResource(R.string.advanced_as_of, Copy.ago(s.at, staleSince).resolve()),style = MaterialTheme.typography.labelLarge,color = MaterialTheme.colorScheme.onSurfaceVariant,)}Column(Modifier.alpha(if (staleSince != null) 0.5f else 1f), verticalArrangement = Arrangement.spacedBy(16.dp)) {- Meter("Memory", s.ramUsedMb / 1024.0, s.ramTotalMb / 1024.0)- s.storageUsedGb?.let { u -> s.storageTotalGb?.let { t -> Meter("Storage", u, t) } }+ Meter(stringResource(R.string.advanced_memory), s.ramUsedMb / 1024.0, s.ramTotalMb / 1024.0)+ s.storageUsedGb?.let { u -> s.storageTotalGb?.let { t -> Meter(stringResource(R.string.advanced_storage), u, t) } }Row(Modifier.fillMaxWidth()) {cells.forEach { (label, value) ->Column(Modifier.weight(1f)) {@@ -180,9 +187,9 @@ private fun Meter(label: String, usedGb: Double, totalGb: Double) {Row(verticalAlignment = Alignment.Bottom) {Column(Modifier.weight(1f)) {Text(label, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)- Text("${(frac * 100).toInt()}% used", style = StatNumber)+ Text(stringResource(R.string.advanced_percent_used, (frac * 100).toInt()), style = StatNumber)}- Text(Copy.gbOf(usedGb, totalGb), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(Copy.gbOf(usedGb, totalGb).resolve(), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant)}LinearProgressIndicator(progress = { frac },@@ -207,7 +214,8 @@ private fun UsageCard(title: String, rows: List<Pair<String, Double>>, fmt: (Douprivate fun Bars(rows: List<Pair<String, Double>>, fmt: (Double) -> String, top: Int = 6) {val sorted = rows.sortedByDescending { it.second }val rest = sorted.drop(top).sumOf { it.second }- val shown = sorted.take(top) + if (rest > 0) listOf("Other" to rest) else emptyList()+ val other = stringResource(R.string.advanced_other)+ val shown = sorted.take(top) + if (rest > 0) listOf(other to rest) else emptyList()val max = shown.maxOfOrNull { it.second }?.coerceAtLeast(1.0) ?: 1.0shown.forEach { (name, v) ->val frac by animateFloatAsState((v / max).toFloat(), MaterialTheme.motionScheme.defaultSpatialSpec(), label = "bar")@@ -227,14 +235,14 @@ private fun Bars(rows: List<Pair<String, Double>>, fmt: (Double) -> String, top:private fun ProcessTable(procs: List<Proc>, apps: List<AppInfo>) {val labels = apps.associate { it.packageName to it.label }val groups = procs- .groupBy { p -> p.packageName?.let { labels[it] ?: AppNames.fallback(it) } ?: Copy.ANDROID_SYSTEM }+ .groupBy { p -> p.packageName?.let { labels[it] ?: AppNames.fallback(it) } ?: Copy.ANDROID_SYSTEM.resolve() }.toList().sortedByDescending { (_, ps) -> ps.sumOf { it.cpuPercent } }if (groups.isEmpty()) return EmptyLine("")Row {- Text("App", Modifier.weight(1f), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)- Text("CPU", Modifier.width(56.dp), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End)- Text("RAM", Modifier.width(72.dp), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End)+ Text(stringResource(R.string.advanced_app), Modifier.weight(1f), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.advanced_cpu), Modifier.width(56.dp), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End)+ Text(stringResource(R.string.advanced_ram), Modifier.width(72.dp), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End)}groups.forEach { (name, ps) ->var open by rememberSaveable(name) { mutableStateOf(false) }@@ -244,14 +252,14 @@ private fun ProcessTable(procs: List<Proc>, apps: List<AppInfo>) {if (ps.size > 1) "$name ×${ps.size}" else name,Modifier.weight(1f), style = MaterialTheme.typography.bodyMedium, maxLines = 1, overflow = TextOverflow.Ellipsis,)- Text("%.0f%%".format(ps.sumOf { it.cpuPercent }), Modifier.width(56.dp), style = SmallNumber, textAlign = TextAlign.End)- Text(Copy.mb(ps.sumOf { it.ramMb }), Modifier.width(72.dp), style = SmallNumber, textAlign = TextAlign.End)+ Text(stringResource(R.string.advanced_percent_whole, ps.sumOf { it.cpuPercent }), Modifier.width(56.dp), style = SmallNumber, textAlign = TextAlign.End)+ Text(Copy.mb(ps.sumOf { it.ramMb }).resolve(), Modifier.width(72.dp), style = SmallNumber, textAlign = TextAlign.End)}if (open) ps.forEach { p ->Row(Modifier.padding(start = 12.dp, top = 2.dp)) {Text("${p.pid} ${p.name}", Modifier.weight(1f), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text("%.1f%%".format(p.cpuPercent), Modifier.width(56.dp), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End)- Text(Copy.mb(p.ramMb), Modifier.width(72.dp), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End)+ Text(stringResource(R.string.advanced_percent_tenths, p.cpuPercent), Modifier.width(56.dp), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End)+ Text(Copy.mb(p.ramMb).resolve(), Modifier.width(72.dp), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End)}}}@@ -262,17 +270,18 @@ private fun ProcessTable(procs: List<Proc>, apps: List<AppInfo>) {private fun NetworkBlock(n: NetworkInfo) {// Already the technical screen: every fact shows, nothing behind a Details tap.listOfNotNull(- "Connection" to listOfNotNull(if (n.iface == "wifi" || n.iface.startsWith("wlan")) "Wi-Fi" else "Ethernet", n.ssid).joinToString(" · "),- n.rssi?.let { "Signal" to "${signalWord(it).replaceFirstChar(Char::uppercase)} ($it dBm)" },- "IP address" to n.ip,- n.mac?.let { "MAC" to it },- n.linkMbps?.let { "Link speed" to "$it Mbps" },+ stringResource(R.string.advanced_connection) to listOfNotNull(stringResource(if (n.iface == "wifi" || n.iface.startsWith("wlan")) R.string.advanced_wifi else R.string.advanced_ethernet), n.ssid).joinToString(" · "),+ n.rssi?.let { stringResource(R.string.advanced_signal) to stringResource(signalWord(it), it) },+ stringResource(R.string.advanced_ip_address) to n.ip,+ n.mac?.let { stringResource(R.string.advanced_mac) to it },+ n.linkMbps?.let { stringResource(R.string.advanced_link_speed) to stringResource(R.string.advanced_mbps, it) },).forEach { (k, v) -> KeyValue(k, v) }Spacer(Modifier.height(8.dp))- Text("Data used", style = MaterialTheme.typography.titleSmall)- Bars(n.traffic.map { it.app to (it.rxMb + it.txMb).toDouble() }, fmt = { Copy.mb(it.toInt()) })+ Text(stringResource(R.string.advanced_data_used), style = MaterialTheme.typography.titleSmall)+ val res = LocalContext.current.resources+ Bars(n.traffic.map { it.app to (it.rxMb + it.txMb).toDouble() }, fmt = { Copy.mb(it.toInt()).resolve(res) })Spacer(Modifier.height(8.dp))- Text("Open connections", style = MaterialTheme.typography.titleSmall)+ Text(stringResource(R.string.advanced_open_connections), style = MaterialTheme.typography.titleSmall)if (n.sockets.isEmpty()) EmptyLine("")n.sockets.forEach { s ->Row(Modifier.padding(vertical = 2.dp)) {@@ -282,9 +291,12 @@ private fun NetworkBlock(n: NetworkInfo) {}}+/** The signal in words, with its dBm as the resource's argument. */+@StringResprivate fun signalWord(rssi: Int) = when {- rssi >= -55 -> "strong"- rssi >= -67 -> "good"- rssi >= -75 -> "weak"- else -> "very weak"+ rssi >= -55 -> R.string.advanced_signal_strong+ rssi >= -67 -> R.string.advanced_signal_good+ rssi >= -75 -> R.string.advanced_signal_weak+ else -> R.string.advanced_signal_very_weak}+diff --git a/app/src/main/java/app/tellyscope/ui/AppsTabs.kt b/app/src/main/java/app/tellyscope/ui/AppsTabs.ktindex 9f2981e..077a3c0 100644--- a/app/src/main/java/app/tellyscope/ui/AppsTabs.kt+++ b/app/src/main/java/app/tellyscope/ui/AppsTabs.kt@@ -2,6 +2,7 @@package app.tellyscope.ui+import androidx.annotation.StringResimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Row@@ -17,12 +18,15 @@ import androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.AppInfoimport app.tellyscope.data.Proc+import app.tellyscope.data.resolve/** The Apps tab's own tabs: what's running now, what the user installed, and what came with the TV. */-enum class AppsTab(val label: String) { Running("Running"), Installed("Installed"), BuiltIn("Built-in") }+enum class AppsTab(@StringRes val label: Int) { Running(R.string.apps_tab_running), Installed(R.string.apps_tab_installed), BuiltIn(R.string.apps_tab_built_in) }/** One Apps tab's list: the apps the user can change, then the [system] ones they can't, under their own header. */data class AppsSplit(val apps: List<AppInfo>, val system: List<AppInfo>)@@ -61,12 +65,13 @@ internal fun SystemHeader(count: Int, folded: Boolean, onFold: (Boolean) -> UnitverticalAlignment = Alignment.CenterVertically,) {Column(Modifier.weight(1f)) {- Text("${Copy.SYSTEM} ($count)", style = MaterialTheme.typography.titleSmall)- Text(Copy.SYSTEM_WHY, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.apps_system_count, Copy.SYSTEM.resolve(), count), style = MaterialTheme.typography.titleSmall)+ Text(Copy.SYSTEM_WHY.resolve(), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}Icon(if (folded) Icons.Default.KeyboardArrowDown else Icons.Default.KeyboardArrowUp,- contentDescription = if (folded) "Show system apps" else "Hide system apps",+ contentDescription = stringResource(if (folded) R.string.apps_show_system else R.string.apps_hide_system),+)}}diff --git a/app/src/main/java/app/tellyscope/ui/ConnectScreen.kt b/app/src/main/java/app/tellyscope/ui/ConnectScreen.ktindex 6f65eec..2bc32a7 100644--- a/app/src/main/java/app/tellyscope/ui/ConnectScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/ConnectScreen.kt@@ -53,6 +53,10 @@ import app.tellyscope.data.ScanHitimport app.tellyscope.data.ScanKindimport app.tellyscope.ui.theme.SmallNumberimport app.tellyscope.ui.theme.StatNumber+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResource+import app.tellyscope.R+import app.tellyscope.data.resolve/*** One TV, one thing at a time: the pairing code, the Allow box on the TV, or why it didn't answer.@@ -78,7 +82,7 @@ fun ConnectScreen(topBar = {TopAppBar(title = {},- navigationIcon = { IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") } },+ navigationIcon = { IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.connect_back)) } },)},bottomBar = {@@ -89,25 +93,24 @@ fun ConnectScreen() {when (row) {RowState.NotAllowed -> {- TextButton(onClick = onBack) { Text("Back to TVs") }- Button(onClick = onRetry) { Text("Try again") }+ TextButton(onClick = onBack) { Text(stringResource(R.string.connect_back_to_tvs)) }+ Button(onClick = onRetry) { Text(stringResource(R.string.connect_try_again)) }}is RowState.Code -> {- TextButton(onClick = onBack) { Text("Cancel") }+ TextButton(onClick = onBack) { Text(stringResource(R.string.connect_cancel)) }val missing = CODE_LENGTH - row.input.length// The button says what's missing instead of sitting there disabled with no reason.Button(onClick = onPair, enabled = !row.busy && missing == 0) {Text(when {- row.busy -> "Pairing…"- missing == 0 -> "Pair"- missing == 1 -> "1 more digit"- else -> "$missing more digits"+ row.busy -> stringResource(R.string.connect_pairing)+ missing == 0 -> stringResource(R.string.connect_pair)+ else -> pluralStringResource(R.plurals.connect_more_digits, missing, missing)},)}}- else -> TextButton(onClick = onBack) { Text("Cancel") }+ else -> TextButton(onClick = onBack) { Text(stringResource(R.string.connect_cancel)) }}}},@@ -119,25 +122,25 @@ fun ConnectScreen(Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {Icon(DeviceIcons.Tv, null, Modifier.size(18.dp), tint = MaterialTheme.colorScheme.onSurfaceVariant)Text(- title ?: listOfNotNull(hit.hostname ?: "Android device", hit.maker).distinct().joinToString(" · "),+ title ?: listOfNotNull(hit.hostname ?: stringResource(R.string.connect_android_device), hit.maker).distinct().joinToString(" · "),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,)}when (row) {is RowState.Code -> {- Text("Type the pairing code", style = MaterialTheme.typography.headlineMedium)+ Text(stringResource(R.string.connect_code_title), style = MaterialTheme.typography.headlineMedium)Text(- "On the TV, open the pairing screen and type the 6 digits it shows.",+ stringResource(R.string.connect_code_text),style = MaterialTheme.typography.bodyLarge,color = MaterialTheme.colorScheme.onSurfaceVariant,)- InfoBox { Text(marked(brand.pair ?: brands.first().pair.orEmpty()), style = MaterialTheme.typography.bodyMedium) }+ InfoBox { Text(marked(stringResource(brand.pair ?: brands.first().pair!!)), style = MaterialTheme.typography.bodyMedium) }Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {CodeBoxes(row.input, onChange = onCode, enabled = !row.busy, isError = row.error != null)}- row.error?.let { Text(it, color = MaterialTheme.colorScheme.error, style = MaterialTheme.typography.bodyMedium) }- row.detail?.let { Details(listOf("From the TV" to it)) }+ row.error?.let { Text(it.resolve(), color = MaterialTheme.colorScheme.error, style = MaterialTheme.typography.bodyMedium) }+ row.detail?.let { Details(listOf(stringResource(R.string.connect_from_tv) to it)) }}RowState.NotAllowed -> {Surface(Modifier.size(64.dp), shape = CircleShape, color = MaterialTheme.colorScheme.errorContainer) {@@ -145,34 +148,34 @@ fun ConnectScreen(Icon(Icons.Default.Warning, null, Modifier.size(32.dp), tint = MaterialTheme.colorScheme.onErrorContainer)}}- Text("No answer from the TV", style = MaterialTheme.typography.headlineMedium)+ Text(stringResource(R.string.connect_no_answer), style = MaterialTheme.typography.headlineMedium)Text(- "The TV didn't accept the connection.",+ stringResource(R.string.connect_not_accepted),style = MaterialTheme.typography.bodyLarge,color = MaterialTheme.colorScheme.onSurfaceVariant,)Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {listOf(- "Is the TV on and awake?",- "Was the box on the TV closed, or Deny pressed? Try again and it asks once more.",- "Some TVs switch debugging off after a restart. Turn it back on.",- ).forEach { Text("• $it", style = MaterialTheme.typography.bodyMedium) }+ stringResource(R.string.connect_check_awake),+ stringResource(R.string.connect_check_denied),+ stringResource(R.string.connect_check_restart),+ ).forEach { Text(stringResource(R.string.connect_bullet, it), style = MaterialTheme.typography.bodyMedium) }}}// Wireless debugging TVs that already know this phone connect without asking.is RowState.Waiting -> if (hit.kind == ScanKind.Wireless) Connecting() else {- Text("Allow on your TV", style = MaterialTheme.typography.headlineMedium)+ Text(stringResource(R.string.connect_allow_title), style = MaterialTheme.typography.headlineMedium)Text(marked(- if (phoneKey != null) "A box pops up on your TV. Check its key matches this phone's, tick **Always allow**, then select **Allow**."- else "A box pops up on your TV. Tick **Always allow**, then select **Allow**.",+ if (phoneKey != null) stringResource(R.string.connect_allow_text_key)+ else stringResource(R.string.connect_allow_text),),style = MaterialTheme.typography.bodyLarge,color = MaterialTheme.colorScheme.onSurfaceVariant,)phoneKey?.let { key ->InfoBox {- Text("This phone's key", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.connect_phone_key), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)// Two lines of eight pairs, so it reads like the TV's and compares at a glance.Text(key.split(':').chunked(8).joinToString("\n") { it.joinToString(":") },@@ -185,7 +188,7 @@ fun ConnectScreen(LoadingIndicator(Modifier.size(32.dp))Spacer(Modifier.width(12.dp))Text(- "Waiting for the TV… ${((now - row.since) / 1000).coerceAtLeast(0)} s",+ stringResource(R.string.connect_waiting, ((now - row.since) / 1000).coerceAtLeast(0)),style = SmallNumber,color = MaterialTheme.colorScheme.onSurfaceVariant,)@@ -200,11 +203,11 @@ fun ConnectScreen(@OptIn(ExperimentalMaterial3ExpressiveApi::class)@Composableprivate fun Connecting() {- Text("Connecting", style = MaterialTheme.typography.headlineMedium)+ Text(stringResource(R.string.connect_connecting), style = MaterialTheme.typography.headlineMedium)Row(verticalAlignment = Alignment.CenterVertically) {LoadingIndicator(Modifier.size(48.dp))Spacer(Modifier.width(12.dp))- Text("Reaching the TV…", style = MaterialTheme.typography.bodyLarge)+ Text(stringResource(R.string.connect_reaching), style = MaterialTheme.typography.bodyLarge)}}@@ -233,9 +236,9 @@ private fun TvPrompt(key: String?) {Modifier.fillMaxWidth(0.84f).background(Color(0xFF1C2222), RoundedCornerShape(12.dp)).padding(horizontal = 14.dp, vertical = 12.dp),verticalArrangement = Arrangement.spacedBy(8.dp),) {- Text("Allow USB debugging?", color = Color.White, style = MaterialTheme.typography.titleSmall)+ Text(stringResource(R.string.connect_tv_allow_title), color = Color.White, style = MaterialTheme.typography.titleSmall)if (key != null) {- Text("The computer's RSA key fingerprint is:", color = Color(0xFFBEC8C8), fontSize = 9.sp, lineHeight = 12.sp)+ Text(stringResource(R.string.connect_tv_fingerprint), color = Color(0xFFBEC8C8), fontSize = 9.sp, lineHeight = 12.sp)Text(key.split(':').chunked(8).joinToString(":\n") { it.joinToString(":") },color = Color.White,@@ -249,13 +252,13 @@ private fun TvPrompt(key: String?) {Box(Modifier.size(16.dp).background(accent, RoundedCornerShape(3.dp)), contentAlignment = Alignment.Center) {Icon(Icons.Default.Check, null, Modifier.size(14.dp), tint = Color(0xFF003738))}- Text("Always allow from this computer", color = Color(0xFFE3E9E9), fontSize = 11.sp)+ Text(stringResource(R.string.connect_tv_always), color = Color(0xFFE3E9E9), fontSize = 11.sp)}Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {- Text("Cancel", color = accent, fontSize = 12.sp, modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp))+ Text(stringResource(R.string.connect_tv_cancel), color = accent, fontSize = 12.sp, modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp))// Focused, the way the remote shows it.Text(- "Allow",+ stringResource(R.string.connect_tv_allow),color = Color(0xFF003738),fontSize = 12.sp,modifier = Modifier.background(accent, CircleShape).padding(horizontal = 12.dp, vertical = 6.dp),@@ -272,10 +275,11 @@ private const val CODE_LENGTH = 6/** One box per digit, on the number keypad. A single hidden field underneath, so paste and delete just work. */@Composableprivate fun CodeBoxes(code: String, onChange: (String) -> Unit, enabled: Boolean, isError: Boolean) {+ val label = stringResource(R.string.connect_code_description)BasicTextField(value = code,onValueChange = onChange,- modifier = Modifier.semantics { contentDescription = "Pairing code" },+ modifier = Modifier.semantics { contentDescription = label },enabled = enabled,singleLine = true,keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword),diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.ktindex 363e7a0..6733296 100644--- a/app/src/main/java/app/tellyscope/ui/Copy.kt+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt@@ -2,6 +2,7 @@package app.tellyscope.ui+import app.tellyscope.Rimport app.tellyscope.adb.InstallKindimport app.tellyscope.adb.InstallRefusalimport app.tellyscope.adb.Peripheral@@ -13,6 +14,7 @@ import app.tellyscope.data.ResetPartimport app.tellyscope.data.ResetProgressimport app.tellyscope.data.Snapshotimport app.tellyscope.data.TvSettings+import app.tellyscope.data.UiTextimport app.tellyscope.data.sourceNameimport java.text.SimpleDateFormatimport java.time.Instant@@ -28,23 +30,23 @@ import java.util.Locale* reviewed in one place: every button says what it does before it runs.*/object Copy {- fun button(action: Action) = when (action) {- Action.Stop -> "Stop"- Action.Disable -> "Disable"- Action.Enable -> "Turn on"- Action.Open -> "Open"- Action.Uninstall -> "Uninstall"+ fun button(action: Action): UiText = when (action) {+ Action.Stop -> UiText(R.string.copy_button_stop)+ Action.Disable -> UiText(R.string.copy_button_disable)+ Action.Enable -> UiText(R.string.copy_button_enable)+ Action.Open -> UiText(R.string.copy_button_open)+ Action.Uninstall -> UiText(R.string.copy_button_uninstall)Action.Change, Action.ClearCaches, Action.Home, Action.HomeBack, Action.Reset -> error("$action has its own button")}- fun confirm(action: Action) = when (action) {- Action.Stop -> "Yes, stop it"- Action.Disable -> "Yes, disable it"- Action.Enable -> "Yes, turn it on"- Action.Open -> "Yes, open it"- Action.Uninstall -> "Yes, uninstall it"- Action.Home -> "Yes, switch home screen"- Action.HomeBack -> "Yes, switch back"+ fun confirm(action: Action): UiText = when (action) {+ Action.Stop -> UiText(R.string.copy_confirm_stop)+ Action.Disable -> UiText(R.string.copy_confirm_disable)+ Action.Enable -> UiText(R.string.copy_confirm_enable)+ Action.Open -> UiText(R.string.copy_confirm_open)+ Action.Uninstall -> UiText(R.string.copy_confirm_uninstall)+ Action.Home -> UiText(R.string.copy_confirm_home)+ Action.HomeBack -> UiText(R.string.copy_confirm_home_back)Action.Change, Action.ClearCaches, Action.Reset -> error("$action isn't an app action")}@@ -52,260 +54,263 @@ object Copy {* Names the package next to the label: the label comes from the app itself, and any app can* call itself "Settings". The package id is what actually gets changed.*/- fun explain(action: Action, app: String, pkg: String) = "$app ($pkg)".let { who ->- when (action) {- Action.Stop -> "Stops $who until you open it again."- Action.Disable -> "Hides $who and stops it running. Nothing is deleted; you can turn it back on here."- Action.Enable -> "Turns $who back on."- Action.Open -> "Opens $who on the TV."- Action.Uninstall -> "Removes $who and everything saved in it. This can't be undone; to get it back, install it again."- Action.Change, Action.ClearCaches, Action.Home, Action.HomeBack, Action.Reset -> error("$action isn't a one-app action")- }+ fun explain(action: Action, app: String, pkg: String): UiText = when (action) {+ Action.Stop -> UiText(R.string.copy_explain_stop, app, pkg)+ Action.Disable -> UiText(R.string.copy_explain_disable, app, pkg)+ Action.Enable -> UiText(R.string.copy_explain_enable, app, pkg)+ Action.Open -> UiText(R.string.copy_explain_open, app, pkg)+ Action.Uninstall -> UiText(R.string.copy_explain_uninstall, app, pkg)+ Action.Change, Action.ClearCaches, Action.Home, Action.HomeBack, Action.Reset -> error("$action isn't a one-app action")}- fun done(action: Action, app: String) = when (action) {- Action.Stop -> "Stopped $app"- Action.Disable -> "Disabled $app"- Action.Enable -> "Turned on $app"- Action.Open -> "Opened $app"- Action.Uninstall -> "Uninstalled $app"+ fun done(action: Action, app: String): UiText = when (action) {+ Action.Stop -> UiText(R.string.copy_done_stop, app)+ Action.Disable -> UiText(R.string.copy_done_disable, app)+ Action.Enable -> UiText(R.string.copy_done_enable, app)+ Action.Open -> UiText(R.string.copy_done_open, app)+ Action.Uninstall -> UiText(R.string.copy_done_uninstall, app)// A setting's label is the whole sentence: "Private DNS set to …", as is a reset's.- Action.Change, Action.Reset -> app- Action.ClearCaches -> "Cleared $app"- Action.Home -> "Made $app Home"- Action.HomeBack -> "Switched home back to $app"+ Action.Change, Action.Reset -> UiText.Raw(app)+ Action.ClearCaches -> UiText(R.string.copy_done_clear_caches, app)+ Action.Home -> UiText(R.string.copy_done_home, app)+ Action.HomeBack -> UiText(R.string.copy_done_home_back, app)}/** Said in the confirm before Stop, Disable or Uninstall of an app the TV's list keeps. */- const val KEEP_WARNING = "This TV's list says to keep this."+ val KEEP_WARNING = UiText(R.string.copy_keep_warning)/** Where the lists come from, for the Debloat screen and the snackbar after a change. */- fun listSource(custom: String?) =- if (custom == null) "Lists from tellyscope-devices, built from cleanyourtv" else "Lists from ${sourceName(custom)}"+ fun listSource(custom: String?): UiText =+ if (custom == null) UiText(R.string.copy_list_source_default) else UiText(R.string.copy_list_source_custom, sourceName(custom))/** The Home screen card at the top of Tweaks: every launcher on the TV, and which one Home opens. */- const val HOME_SCREEN = "Home screen"+ val HOME_SCREEN = UiText(R.string.copy_home_screen)- fun opensOnHome(app: String) = "$app opens when you press Home."+ fun opensOnHome(app: String) = UiText(R.string.copy_opens_on_home, app)- const val NO_DEFAULT = "No default: pick one below."- const val ADDED = "Added"+ val NO_DEFAULT = UiText(R.string.copy_no_default)+ val ADDED = UiText(R.string.copy_added)- fun builtIn(off: Boolean) = "Built into the TV" + if (off) " · turned off" else ""+ fun builtIn(off: Boolean) = UiText(if (off) R.string.copy_built_in_off else R.string.copy_built_in)- const val CURRENT = "Current"- const val KEEPS_HOME = "Keeps Home with its accessibility service"- const val MAKE_HOME = "Make Home"- const val GET_LAUNCHER = "Get another launcher"- const val GET_LAUNCHER_TEXT = "Install one from the Play Store, like Projectivy or FLauncher. Switch back any time."- const val GET_PROJECTIVY_TEXT = "Install Projectivy. Switch back any time."+ val CURRENT = UiText(R.string.copy_current)+ val KEEPS_HOME = UiText(R.string.copy_keeps_home)+ val MAKE_HOME = UiText(R.string.copy_make_home)+ val GET_LAUNCHER = UiText(R.string.copy_get_launcher)+ val GET_LAUNCHER_TEXT = UiText(R.string.copy_get_launcher_text)+ val GET_PROJECTIVY_TEXT = UiText(R.string.copy_get_projectivy_text)/** The Apps tab's launcher rows: switching lives in the card, this opens it. */- const val HOME_SETTINGS = "Home screen settings"+ val HOME_SETTINGS = UiText(R.string.copy_home_settings)- fun makeHomeTitle(app: String) = "Make $app the home screen?"+ fun makeHomeTitle(app: String) = UiText(R.string.copy_make_home_title, app)/** A launcher the user added in place of the TV's own, which is turned off: otherwise many TVs switch back by themselves. */- fun explainReplace(app: String, current: String, currentPkg: String, service: Boolean) = buildString {- append("Home opens $app. To stop the TV switching back by itself, Tellyscope turns off $current, the TV's built-in launcher.")- append("\n\nThat's the only launcher it ever turns off. Launchers you added stay on, so you can switch between them any time.")- append("\n\nUndo in History turns $current back on.")- if (currentPkg in GOOGLE_HOMES) append("\n\nSome Google TV features, like the Apps row and the Live tab, are part of $current and go away with it.")- if (service) append("\n\nNext, you choose whether to turn on its accessibility service.")- }+ fun explainReplace(app: String, current: String, currentPkg: String, service: Boolean): UiText = UiText.Join(+ listOfNotNull(+ UiText(R.string.copy_explain_replace_opens, app, current),+ UiText(R.string.copy_explain_replace_only),+ UiText(R.string.copy_explain_replace_undo, current),+ if (currentPkg in GOOGLE_HOMES) UiText(R.string.copy_google_features, current) else null,+ if (service) UiText(R.string.copy_next_service) else null,+ ),+ "\n\n",+ )/*** Away from [current], a launcher the user added: it stays on, only its accessibility service* goes off when it has one on, since that would take Home straight back. [off]: [app] is the* TV's own launcher, turned off by an earlier switch.*/- fun explainLeave(app: String, off: Boolean, current: String, currentService: Boolean, service: Boolean) = buildString {- append(if (off) "Tellyscope turns $app back on and makes it open when you press Home." else "Tellyscope makes $app open when you press Home.")- append("\n\n")- if (currentService) append("It also turns off $current's accessibility service, which would otherwise take Home straight back. ")- append("$current stays installed and on, so you can make it Home again any time.")- append("\n\nUndo in History makes $current Home again")- append(if (currentService) " and turns its service back on." else ".")- if (service) append("\n\nNext, you choose whether to turn on its accessibility service.")- }+ fun explainLeave(app: String, off: Boolean, current: String, currentService: Boolean, service: Boolean): UiText = UiText.Join(+ listOfNotNull(+ UiText(if (off) R.string.copy_explain_leave_turns_on else R.string.copy_explain_leave_makes, app),+ UiText.Join(+ listOfNotNull(+ if (currentService) UiText(R.string.copy_explain_leave_service, current) else null,+ UiText(R.string.copy_explain_leave_stays, current),+ ),+ " ",+ ),+ UiText(if (currentService) R.string.copy_explain_leave_undo_service else R.string.copy_explain_leave_undo, current),+ if (service) UiText(R.string.copy_next_service) else null,+ ),+ "\n\n",+ )/*** The home switch touches two apps, so it names both. The old launcher is disabled, not just* replaced: otherwise many TVs switch back to it by themselves.*/- fun explainHome(app: String, pkg: String, current: String, currentPkg: String, service: Boolean = false) = buildString {- append("Makes $app ($pkg) open when you press Home, then disables $current ($currentPkg) so the TV can't switch back by itself. ")- append("Undo in History turns $current back on and makes it Home again.")- if (currentPkg in GOOGLE_HOMES) append("\n\nSome Google TV features, like the Apps row and the Live tab, are part of $current and go away with it.")- if (service) append("\n\nNext, you choose whether to turn on its accessibility service.")- }+ fun explainHome(app: String, pkg: String, current: String, currentPkg: String, service: Boolean = false): UiText = UiText.Join(+ listOfNotNull(+ UiText(R.string.copy_explain_home, app, pkg, current, currentPkg),+ if (currentPkg in GOOGLE_HOMES) UiText(R.string.copy_google_features, current) else null,+ if (service) UiText(R.string.copy_next_service) else null,+ ),+ "\n\n",+ )/** Fire OS: Amazon's launcher can't be turned off or replaced, so [app]'s accessibility service holds Home instead. */- fun explainFireHome(app: String, pkg: String, current: String) =- "Makes Home open $app ($pkg) through its accessibility service. Fire OS won't let $current be turned off or replaced, " +- "so it stays on and nothing else changes. Undo in History turns the service off.\n\nNext, you choose whether to turn on its accessibility service."+ fun explainFireHome(app: String, pkg: String, current: String): UiText = UiText.Join(+ listOf(UiText(R.string.copy_explain_fire_home, app, pkg, current), UiText(R.string.copy_next_service)),+ "\n\n",+ )/** No default home and no launcher of the TV's own on: nothing is turned off, so Undo can only turn its service off. */- fun explainFirstHome(app: String, pkg: String, service: Boolean = false) = buildString {- append("Makes $app ($pkg) open when you press Home. The TV has no default home screen now, and nothing else is turned off.")- if (service) append("\n\nNext, you choose whether to turn on its accessibility service.")- }+ fun explainFirstHome(app: String, pkg: String, service: Boolean = false): UiText = UiText.Join(+ listOfNotNull(+ UiText(R.string.copy_explain_first_home, app, pkg),+ if (service) UiText(R.string.copy_next_service) else null,+ ),+ "\n\n",+ )/** The separate yes for a launcher's accessibility service: what it does, what it can see, how it goes. */- fun serviceTitle(app: String) = "Turn on $app's accessibility service?"+ fun serviceTitle(app: String) = UiText(R.string.copy_service_title, app)- fun explainService(app: String, other: String) =- "It keeps the Home button opening $app. Without it, this TV's Home button may still open $other.\n\n" +- "An accessibility service can see what's on screen. Turn it on only if you trust $app.\n\n" +- "Undo in History, or making another launcher Home, turns it off."+ fun explainService(app: String, other: String) = UiText(R.string.copy_explain_service, app, other)- const val TURN_IT_ON = "Turn it on"- const val SWITCH_WITHOUT = "Switch without it"- const val NOT_NOW = "Not now"- const val TURN_ON = "Turn on"- const val GOT_IT = "Got it"- const val SERVICE_OFF = "Accessibility service off"+ val TURN_IT_ON = UiText(R.string.copy_turn_it_on)+ val SWITCH_WITHOUT = UiText(R.string.copy_switch_without)+ val NOT_NOW = UiText(R.string.copy_not_now)+ val TURN_ON = UiText(R.string.copy_turn_on)+ val GOT_IT = UiText(R.string.copy_got_it)+ val SERVICE_OFF = UiText(R.string.copy_service_off)/** The TV page's card while the launcher on Home has its service off; [other] is the launcher Home may still open. */- fun serviceOffTitle(other: String?) = "Home may open ${other ?: TV_OWN_LAUNCHER}"+ fun serviceOffTitle(other: String?) = UiText(R.string.copy_service_off_title, other ?: TV_OWN_LAUNCHER)- const val TV_OWN_LAUNCHER = "the TV's own launcher"+ val TV_OWN_LAUNCHER = UiText(R.string.copy_tv_own_launcher)/** Install a home screen: the Apps tab's card, the picker, the wait for the Store, and its dead ends. */- const val BETTER_HOME = "Get a better home screen"+ val BETTER_HOME = UiText(R.string.copy_better_home)/** [fire]: Fire OS, where there's no Play Store and Tellyscope installs it. */- fun betterHomeText(current: String?, fire: Boolean = false) =- "Swap ${current ?: "the TV's home screen"} for a launcher without ads" +- if (fire) "; switch back any time." else ". Free on the Play Store; switch back any time."-- const val CHOOSE_ONE = "Choose one"- const val INSTALL_ONE = "Install it"- const val CHOOSE_HOME = "Choose a home screen"- const val CHOOSE_HOME_TEXT = "Each one replaces the TV's home screen. Tellyscope opens it in the Play Store on the TV; you install it with the remote."+ fun betterHomeText(current: String?, fire: Boolean = false) = UiText(+ if (fire) R.string.copy_better_home_text_fire else R.string.copy_better_home_text,+ current ?: UiText(R.string.copy_the_tvs_home_screen),+ )++ val CHOOSE_ONE = UiText(R.string.copy_choose_one)+ val INSTALL_ONE = UiText(R.string.copy_install_one)+ val CHOOSE_HOME = UiText(R.string.copy_choose_home)+ val CHOOSE_HOME_TEXT = UiText(R.string.copy_choose_home_text)/** After [CHOOSE_HOME_TEXT] when Download directly is offered. */- const val CAN_DOWNLOAD = "Some can also be downloaded directly."- const val NO_LAUNCHER_LIST = "Couldn't load the list of home screens. Check the phone's internet and try again."- const val RECOMMENDED = "Recommended"+ val CAN_DOWNLOAD = UiText(R.string.copy_can_download)+ val NO_LAUNCHER_LIST = UiText(R.string.copy_no_launcher_list)+ val RECOMMENDED = UiText(R.string.copy_recommended)/** The picker's section for launchers on the TV that Recommended doesn't list. */- const val ON_THIS_TV = "On this TV"- const val INSTALLED = "Installed"- const val HOME_NOW = "Home now"+ val ON_THIS_TV = UiText(R.string.copy_on_this_tv)+ val INSTALLED = UiText(R.string.copy_installed)+ val HOME_NOW = UiText(R.string.copy_home_now)/** Shows a launcher on the TV, from the picker. */- const val OPEN = "Open"- const val USES_SERVICE = "Uses an accessibility service"- const val NO_SERVICE = "Open source · no accessibility service"+ val OPEN = UiText(R.string.copy_open)+ val USES_SERVICE = UiText(R.string.copy_uses_service)+ val NO_SERVICE = UiText(R.string.copy_no_service)/** Under the picker's list: any other launcher works too, and comes back as On this TV. */- const val OTHER_LAUNCHER = "Prefer another launcher? Install it from the Play Store on your TV, then come back here. It shows up under $ON_THIS_TV."- const val NOT_AFFILIATED = "Tellyscope isn't affiliated with any of these launchers or their developers."- const val GET_FROM_STORE = "Get it from Play Store"- const val STORE_RECOMMENDED = "Play Store recommended: it updates itself"- const val DOWNLOAD_DIRECTLY = "Download directly"- const val INSTALL_HOME = "Install a home screen"- const val INSTALL_IT = "Install it on your TV"+ val OTHER_LAUNCHER = UiText(R.string.copy_other_launcher, ON_THIS_TV)+ val NOT_AFFILIATED = UiText(R.string.copy_not_affiliated)+ val GET_FROM_STORE = UiText(R.string.copy_get_from_store)+ val STORE_RECOMMENDED = UiText(R.string.copy_store_recommended)+ val DOWNLOAD_DIRECTLY = UiText(R.string.copy_download_directly)+ val INSTALL_HOME = UiText(R.string.copy_install_home)+ val INSTALL_IT = UiText(R.string.copy_install_it)- fun installItText(name: String) =- "The Play Store is open on the TV, on $name's page. Use the remote to select Install. Tellyscope moves on by itself once it's installed."+ fun installItText(name: String) = UiText(R.string.copy_install_it_text, name)- fun storeOn(tv: String) = "Play Store on $tv"+ fun storeOn(tv: String) = UiText(R.string.copy_store_on, tv)- const val WAITING_INSTALL = "Waiting for install…"- const val DOWNLOADS_TAKE = "Downloads can take a minute. Tellyscope can't see the download, only when it's done."- const val OPEN_STORE_AGAIN = "Open Play Store again"- const val MAKE_IT_HOME = "Make it the home screen?"+ val WAITING_INSTALL = UiText(R.string.copy_waiting_install)+ val DOWNLOADS_TAKE = UiText(R.string.copy_downloads_take)+ val OPEN_STORE_AGAIN = UiText(R.string.copy_open_store_again)+ val MAKE_IT_HOME = UiText(R.string.copy_make_it_home)- fun isInstalled(name: String) = "$name is installed."+ fun isInstalled(name: String) = UiText(R.string.copy_is_installed, name)- fun launcherLater(name: String) = "$name is installed. To use it later, choose $MAKE_HOME on it in Tweaks, under $HOME_SCREEN."+ fun launcherLater(name: String) = UiText(R.string.copy_launcher_later, name, MAKE_HOME, HOME_SCREEN)- fun launcherInstalled(name: String) = "$name is installed. Press Home on the remote to pick it."+ fun launcherInstalled(name: String) = UiText(R.string.copy_launcher_installed, name)- fun launcherIsHome(name: String) = "$name is already your home screen."+ fun launcherIsHome(name: String) = UiText(R.string.copy_launcher_is_home, name)- const val NO_STORE = "The Play Store didn't open"+ val NO_STORE = UiText(R.string.copy_no_store)- fun noStoreText(tv: String, name: String) =- "$tv didn't open the Play Store for Tellyscope. On the TV, open the Play Store yourself and search for $name. " +- "Tellyscope keeps watching and moves on once it's installed."+ fun noStoreText(tv: String, name: String) = UiText(R.string.copy_no_store_text, tv, name)- const val CHOOSE_ANOTHER = "Choose another"+ val CHOOSE_ANOTHER = UiText(R.string.copy_choose_another)- fun notInstalled(name: String) = "$name isn't installed"+ fun notInstalled(name: String) = UiText(R.string.copy_not_installed, name)/** The Store closed without an install: back on the picker, still chosen. */- fun wasntInstalled(name: String) = "$name wasn't installed"+ fun wasntInstalled(name: String) = UiText(R.string.copy_wasnt_installed, name)/** Install Projectivy on Fire OS: Tellyscope downloads it from its developer's GitHub and installs it over adb. */- const val INSTALL_PROJECTIVY = "Install Projectivy"- const val FIRE_INSTALL_TEXT = "A home screen without ads. Tellyscope installs it on the TV for you; there's nothing to do on the TV."+ val INSTALL_PROJECTIVY = UiText(R.string.copy_install_projectivy)+ val FIRE_INSTALL_TEXT = UiText(R.string.copy_fire_install_text)- fun downloadsFrom(name: String) = "Tellyscope downloads $name from the developer's own release page:"+ fun downloadsFrom(name: String) = UiText(R.string.copy_downloads_from, name)- fun release(version: String, size: Long) = "Release $version · ${bytes(size)}"+ fun release(version: String, size: Long) = UiText(R.string.copy_release, version, bytes(size))- const val WHERE_FROM = "Where it comes from"- const val SIGNED_CHECK =- "Tellyscope checks it's signed by Projectivy's developer before installing it on the TV. Tellyscope isn't affiliated with Projectivy."- const val DOWNLOAD_AND_INSTALL = "Download and install"+ val WHERE_FROM = UiText(R.string.copy_where_from)+ val SIGNED_CHECK = UiText(R.string.copy_signed_check)+ val DOWNLOAD_AND_INSTALL = UiText(R.string.copy_download_and_install)/** Download directly on a TV with the Play Store: what Tellyscope checks, what it doesn't, and the safer way. */- fun downloadDirectly(name: String) = "Download $name directly?"+ fun downloadDirectly(name: String) = UiText(R.string.copy_download_directly_title, name)- const val DIRECT_CHECK =- "Tellyscope checks the app carries the developer's signature. It does not scan the app for malicious code, and the app won't update on its own."- const val STORE_SAFER = "Getting it from Play Store is safer and keeps it updated."- const val DOWNLOAD_ANYWAY = "Download anyway"- const val STORE_INSTEAD = "Get it from the Play Store on the TV instead."+ val DIRECT_CHECK = UiText(R.string.copy_direct_check)+ val STORE_SAFER = UiText(R.string.copy_store_safer)+ val DOWNLOAD_ANYWAY = UiText(R.string.copy_download_anyway)+ val STORE_INSTEAD = UiText(R.string.copy_store_instead)/** Install Projectivy's steps, one panel: download (or the picked file), the check, the install. */- fun installing(name: String) = "Installing $name"- const val STEP_DOWNLOAD = "Download from GitHub"- const val STEP_DOWNLOADED = "Downloaded"- fun downloading(percent: Int, done: Long, total: Long) = "Downloading · $percent% · ${bytes(done)} of ${bytes(total)}"- const val STEP_PICKED = "Picked a file"- const val STEP_CHECK = "Check it's Projectivy"- const val STEP_CHECKING = "Checking it's Projectivy…"- const val STEP_CHECKED = "It's Projectivy"- const val STEP_CHECKED_TEXT = "Signed by its developer"- const val STEP_FAILED = "Not Projectivy"- const val STEP_FAILED_TEXT = "Package name or signature didn't match"- fun installOn(tv: String) = "Install on $tv"-- fun installingOn(tv: String) = "Installing on $tv…"+ fun installing(name: String) = UiText(R.string.copy_installing, name)+ val STEP_DOWNLOAD = UiText(R.string.copy_step_download)+ val STEP_DOWNLOADED = UiText(R.string.copy_step_downloaded)+ fun downloading(percent: Int, done: Long, total: Long) = UiText(R.string.copy_downloading, percent, bytes(done), bytes(total))+ val STEP_PICKED = UiText(R.string.copy_step_picked)+ val STEP_CHECK = UiText(R.string.copy_step_check)+ val STEP_CHECKING = UiText(R.string.copy_step_checking)+ val STEP_CHECKED = UiText(R.string.copy_step_checked)+ val STEP_CHECKED_TEXT = UiText(R.string.copy_step_checked_text)+ val STEP_FAILED = UiText(R.string.copy_step_failed)+ val STEP_FAILED_TEXT = UiText(R.string.copy_step_failed_text)+ fun installOn(tv: String) = UiText(R.string.copy_install_on, tv)++ fun installingOn(tv: String) = UiText(R.string.copy_installing_on, tv)/** X while it downloads: nothing is on the TV yet. */- const val STOP_TITLE = "Stop the download?"- const val STOP_TEXT = "Nothing is on the TV yet. You can start again any time."- const val STOP = "Stop"- const val KEEP_DOWNLOADING = "Keep downloading"-- const val NOT_PROJECTIVY = "That download isn't Projectivy"- const val NOT_PROJECTIVY_TEXT =- "The file from GitHub didn't match Projectivy's package name or its developer's signature, so Tellyscope installed nothing on the TV."- const val NOT_PROJECTIVY_FILE = "That file isn't Projectivy"- const val NOT_PROJECTIVY_FILE_TEXT =- "It didn't match Projectivy's package name or its developer's signature, so Tellyscope installed nothing on the TV."- const val CANT_READ_FILE = "Tellyscope couldn't read that file. Pick it again, or download it again."- fun cantInstall(name: String) = "Couldn't install $name"+ val STOP_TITLE = UiText(R.string.copy_stop_title)+ val STOP_TEXT = UiText(R.string.copy_stop_text)+ val STOP = UiText(R.string.copy_stop)+ val KEEP_DOWNLOADING = UiText(R.string.copy_keep_downloading)++ val NOT_PROJECTIVY = UiText(R.string.copy_not_projectivy)+ val NOT_PROJECTIVY_TEXT = UiText(R.string.copy_not_projectivy_text)+ val NOT_PROJECTIVY_FILE = UiText(R.string.copy_not_projectivy_file)+ val NOT_PROJECTIVY_FILE_TEXT = UiText(R.string.copy_not_projectivy_file_text)+ val CANT_READ_FILE = UiText(R.string.copy_cant_read_file)+ fun cantInstall(name: String) = UiText(R.string.copy_cant_install, name)/** Couldn't download: GitHub's limit for the network ([until] is a clock time), or no way to reach it. */- const val NO_DOWNLOAD = "Couldn't download Projectivy"- const val NO_DOWNLOAD_OFFLINE = "The phone can't reach GitHub. Check its internet, then try again."+ val NO_DOWNLOAD = UiText(R.string.copy_no_download)+ val NO_DOWNLOAD_OFFLINE = UiText(R.string.copy_no_download_offline)fun noDownloadLimited(until: String?) =- "GitHub is limiting downloads from your network ${if (until != null) "until $until" else "for a while"}. Try again then, or download it yourself."- const val OR_YOURSELF = "Or download it yourself"- const val YOURSELF_PAGE = "Download the app file (.apk) from the release page in your browser."- fun yourselfPick(file: String?) = "Come back and pick ${file ?: "it"}. Tellyscope checks it's Projectivy before installing it."- const val LATEST_RELEASE = "Latest release"- const val PICK_DOWNLOADED = "Pick the downloaded file"- const val PICK_ANOTHER = "Pick another file"- const val TRY_DOWNLOAD_AGAIN = "Try download again"-- const val NOT_INSTALLED_TEXT =- "The Play Store closed on the TV before it was installed. If the Store said it isn't available for this TV, choose another launcher."+ if (until != null) UiText(R.string.copy_no_download_limited_until, until) else UiText(R.string.copy_no_download_limited)+ val OR_YOURSELF = UiText(R.string.copy_or_yourself)+ val YOURSELF_PAGE = UiText(R.string.copy_yourself_page)+ fun yourselfPick(file: String?) = if (file != null) UiText(R.string.copy_yourself_pick_file, file) else UiText(R.string.copy_yourself_pick)+ val LATEST_RELEASE = UiText(R.string.copy_latest_release)+ val PICK_DOWNLOADED = UiText(R.string.copy_pick_downloaded)+ val PICK_ANOTHER = UiText(R.string.copy_pick_another)+ val TRY_DOWNLOAD_AGAIN = UiText(R.string.copy_try_download_again)++ val NOT_INSTALLED_TEXT = UiText(R.string.copy_not_installed_text)/** The Tweaks row that reopens it after Not now on the card. */- fun serviceOffText(app: String) = "$app's accessibility service is off, so the TV can take Home back."+ fun serviceOffText(app: String) = UiText(R.string.copy_service_off_text, app)private val GOOGLE_HOMES = setOf("com.google.android.tvlauncher", "com.google.android.apps.tv.launcherx")@@ -313,45 +318,44 @@ object Copy {* Force-stop has no true undo, and undoing a Turn on disables the app; the button says what it* actually does.*/- fun undo(undo: Action) = when (undo) {- Action.Open -> "Open again"+ fun undo(undo: Action): UiText = when (undo) {+ Action.Open -> UiText(R.string.copy_open_again)Action.Disable -> button(Action.Disable)- else -> "Undo"+ else -> UiText(R.string.copy_undo)}- fun ago(at: Long, now: Long): String {+ fun ago(at: Long, now: Long): UiText {val s = ((now - at) / 1000).coerceAtLeast(0)return when {- s < 10 -> "just now"- s < 60 -> "$s s ago"- s < 3600 -> "${s / 60} min ago"- s < 86_400 -> "${s / 3600} h ago"- else -> "${s / 86_400} d ago"+ s < 10 -> UiText(R.string.copy_just_now)+ s < 60 -> UiText.plural(R.plurals.copy_seconds_ago, s.toInt())+ s < 3600 -> UiText.plural(R.plurals.copy_minutes_ago, (s / 60).toInt())+ s < 86_400 -> UiText.plural(R.plurals.copy_hours_ago, (s / 3600).toInt())+ else -> UiText.plural(R.plurals.copy_days_ago, (s / 86_400).toInt())}}- fun uptime(s: Long): String {+ fun uptime(s: Long): UiText {val d = s / 86_400val h = (s % 86_400) / 3600val m = (s % 3600) / 60return when {- d > 0 -> "${d}d ${h}h"- h > 0 -> "${h}h ${m}m"- else -> "${m}m"+ d > 0 -> UiText(R.string.copy_uptime_days_hours, d, h)+ h > 0 -> UiText(R.string.copy_uptime_hours_minutes, h, m)+ else -> UiText(R.string.copy_uptime_minutes, m)}}/** Uptime for people: the largest unit or two, spelled out. */- fun upFor(s: Long): String {- fun n(v: Long, unit: String) = "$v $unit${if (v == 1L) "" else "s"}"- val d = s / 86_400- val h = (s % 86_400) / 3600- val m = (s % 3600) / 60+ fun upFor(s: Long): UiText {+ val d = UiText.plural(R.plurals.copy_days, (s / 86_400).toInt())+ val h = UiText.plural(R.plurals.copy_hours, ((s % 86_400) / 3600).toInt())+ val m = UiText.plural(R.plurals.copy_minutes, ((s % 3600) / 60).toInt())return when {- d > 0 && h > 0 -> "${n(d, "day")}, ${n(h, "hour")}"- d > 0 -> n(d, "day")- h > 0 -> n(h, "hour")- else -> n(m, "minute")+ s / 86_400 > 0 && (s % 86_400) / 3600 > 0 -> UiText(R.string.copy_days_hours, d, h)+ s / 86_400 > 0 -> d+ (s % 86_400) / 3600 > 0 -> h+ else -> m}}@@ -359,97 +363,99 @@ object Copy {fun month(m: YearMonth): String = m.format(DateTimeFormatter.ofPattern("MMMM yyyy"))/** Network speed in the same units as [bytes], so a download's size and speed line up. */- fun speed(bytesPerSec: Long) = bytes(bytesPerSec) + "/s"+ fun speed(bytesPerSec: Long) = UiText(R.string.copy_speed, bytes(bytesPerSec))- fun mb(v: Int) = if (v >= 1024) "%.1f GB".format(v / 1024.0) else "$v MB"+ fun mb(v: Int) = if (v >= 1024) UiText(R.string.copy_size_gb, v / 1024.0) else UiText(R.string.copy_size_mb_whole, v)- fun uninstallTitle(app: String) = "Uninstall $app?"+ fun uninstallTitle(app: String) = UiText(R.string.copy_uninstall_title, app)/** The confirm for the launcher on Home: Home goes back first, and a failed step stops it. */- fun uninstallHome(app: String, back: String, service: Boolean) = listOfNotNull(- "$app is your home screen. Before removing it, Tellyscope:",- "1. Makes $back the home screen again, turning it back on if it's off.",- "2. Turns off $app's accessibility service.".takeIf { service },- "${if (service) 3 else 2}. Uninstalls it, with everything saved in it. This can't be undone.",- "If a step fails, Tellyscope stops there, says which one, and doesn't uninstall.",- ).joinToString("\n\n")+ fun uninstallHome(app: String, back: String, service: Boolean): UiText = UiText.Join(+ listOfNotNull(+ UiText(R.string.copy_uninstall_home_intro, app),+ UiText(R.string.copy_uninstall_home_back, back),+ if (service) UiText(R.string.copy_uninstall_home_service, app) else null,+ UiText(R.string.copy_uninstall_home_remove, if (service) 3 else 2),+ UiText(R.string.copy_uninstall_home_fails),+ ),+ "\n\n",+ )/** The Apps tabs' header over the apps the TV needs, and why they're apart. */- const val SYSTEM = "System"- const val SYSTEM_WHY = "Needed by the TV · can't be changed"+ val SYSTEM = UiText(R.string.copy_system)+ val SYSTEM_WHY = UiText(R.string.copy_system_why)/** Debloat with nothing left on the list: what's done, what's next, then Apps. */- const val GATE_TITLE = "Everything on the list is off"- const val GATE_DONE = "All the apps the cleanyourtv list suggests for this TV are already off."- const val GATE_LAUNCHER = "To trim it further, switch to a minimal home screen. It replaces the TV's own, with its ads and suggestions."- const val GATE_APPS = "You can still choose, app by app, what to keep or turn off in Apps."- const val GO_TO_APPS = "Go to Apps"- const val DONT_SHOW_AGAIN = "Don't show again"+ val GATE_TITLE = UiText(R.string.copy_gate_title)+ val GATE_DONE = UiText(R.string.copy_gate_done)+ val GATE_LAUNCHER = UiText(R.string.copy_gate_launcher)+ val GATE_APPS = UiText(R.string.copy_gate_apps)+ val GO_TO_APPS = UiText(R.string.copy_go_to_apps)+ val DONT_SHOW_AGAIN = UiText(R.string.copy_dont_show_again)/** Apps, while the TV's app list is being read. */- const val READING_APPS = "Reading the TV's apps…"- const val READING_APPS_LINE = "This takes a few seconds."+ val READING_APPS = UiText(R.string.copy_reading_apps)+ val READING_APPS_LINE = UiText(R.string.copy_reading_apps_line)/** Running, with no word from the TV. */- const val TV_OFFLINE = "TV offline"- const val RUNNING_OFFLINE = "Running apps show here once the TV is connected."+ val TV_OFFLINE = UiText(R.string.copy_tv_offline)+ val RUNNING_OFFLINE = UiText(R.string.copy_running_offline)- const val ANDROID_SYSTEM = AppNames.SYSTEM+ val ANDROID_SYSTEM = AppNames.SYSTEM/** The word next to the status dot, so the state never rests on colour alone. */- fun state(s: DeviceState) = when (s) {- DeviceState.Online -> "Connected"- DeviceState.Offline -> "Offline"- DeviceState.NotAllowed -> "Not allowed"- DeviceState.Waiting -> "Connecting"- DeviceState.NeedsPairing -> "Needs the pairing code"- DeviceState.Found -> "Not connected"+ fun state(s: DeviceState): UiText = when (s) {+ DeviceState.Online -> UiText(R.string.copy_state_online)+ DeviceState.Offline -> UiText(R.string.copy_state_offline)+ DeviceState.NotAllowed -> UiText(R.string.copy_state_not_allowed)+ DeviceState.Waiting -> UiText(R.string.copy_state_waiting)+ DeviceState.NeedsPairing -> UiText(R.string.copy_state_needs_pairing)+ DeviceState.Found -> UiText(R.string.copy_state_found)}/** Under 10 GB a whole number hides too much: a 1.5 GB TV isn't a 2 GB one. */fun gbOf(used: Double, total: Double) =- if (total < 10) "%.1f of %.1f GB".format(used, total) else "%.1f of %.0f GB".format(used, total)+ if (total < 10) UiText(R.string.copy_gb_of_small, used, total) else UiText(R.string.copy_gb_of, used, total)/** Free storage in plain words, rounded down so it never promises room that isn't there; null if unknown. */- fun free(s: Snapshot): String? = free(s.storageUsedGb, s.storageTotalGb)+ fun free(s: Snapshot): UiText? = free(s.storageUsedGb, s.storageTotalGb)/** [free] from the two numbers, for a TV's saved facts as well as a live reading. */- fun free(used: Double?, total: Double?): String? {+ fun free(used: Double?, total: Double?): UiText? {val gb = used?.let { u -> total?.let { t -> (t - u).coerceAtLeast(0.0) } } ?: return null- return if (gb < 10) "%.1f GB free".format(Math.floor(gb * 10) / 10) else "${gb.toInt()} GB free"+ return if (gb < 10) UiText(R.string.copy_free_gb_small, Math.floor(gb * 10) / 10) else UiText(R.string.copy_free_gb, gb.toInt())}/** An offline TV that has never sent stats; a refusing TV is on, it just hasn't allowed us. */fun noStats(s: DeviceState) =- if (s == DeviceState.NotAllowed) "Stats show up once the TV allows this phone."- else "No stats yet. They show up once the TV is back on."-- const val WRONG_CODE = "That code didn't work. Check the 6 digits on the TV and try again."- const val UNREACHABLE = "The TV didn't answer. Check it's on and on the same Wi-Fi as this phone, then try again."- const val PAIR_INSTEAD = "The TV didn't let this phone in yet. Pair it once with the code from the TV."- const val LOGGED_OUT = "You were logged out"- const val LOGGED_OUT_WHY =- "The TV removed this phone's access. Tellyscope disconnected and stopped asking, so nothing pops up on the TV until you connect again."- val LOGGED_OUT_CAUSES = listOf(- "Revoke USB debugging authorisations was chosen on the TV.",- "Remove all other access was used from another phone, or from another Tellyscope build on this phone.",+ if (s == DeviceState.NotAllowed) UiText(R.string.copy_no_stats_not_allowed)+ else UiText(R.string.copy_no_stats)++ val WRONG_CODE = UiText(R.string.copy_wrong_code)+ val UNREACHABLE = UiText(R.string.copy_unreachable)+ val PAIR_INSTEAD = UiText(R.string.copy_pair_instead)+ val LOGGED_OUT = UiText(R.string.copy_logged_out)+ val LOGGED_OUT_WHY = UiText(R.string.copy_logged_out_why)+ val LOGGED_OUT_CAUSES: List<UiText> = listOf(+ UiText(R.string.copy_logged_out_cause_revoke),+ UiText(R.string.copy_logged_out_cause_remove),)- fun loggedOutOf(name: String) = "Logged out of $name"+ fun loggedOutOf(name: String) = UiText(R.string.copy_logged_out_of, name)/** When the TV took the access back, on the logged-out page. */- fun loggedOutAt(at: Long, now: Long): String {+ fun loggedOutAt(at: Long, now: Long): UiText {// Calendar days, so 23:00 reads "yesterday" the next morning.val zone = ZoneId.systemDefault()val days = ChronoUnit.DAYS.between(Instant.ofEpochMilli(at).atZone(zone).toLocalDate(), Instant.ofEpochMilli(now).atZone(zone).toLocalDate())return when {- now - at < 5 * 60_000 -> "Logged out just now"- days == 0L -> "Logged out today, " + SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date(at))- days == 1L -> "Logged out yesterday"- else -> "Logged out $days days ago"+ now - at < 5 * 60_000 -> UiText(R.string.copy_logged_out_just_now)+ days == 0L -> UiText(R.string.copy_logged_out_today, SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date(at)))+ days == 1L -> UiText(R.string.copy_logged_out_yesterday)+ else -> UiText.plural(R.plurals.copy_logged_out_days_ago, days.toInt())}}- data class Health(val ok: Boolean, val text: String)+ data class Health(val ok: Boolean, val text: UiText)/*** The one line at the top of a TV's page: the most pressing problem, or that all is well.@@ -458,316 +464,343 @@ object Copy {fun health(s: Snapshot, heaviest: List<String>): Health {val storage = s.storageUsedGb?.let { u -> s.storageTotalGb?.takeIf { it > 0 }?.let { u / it } }val ram = if (s.ramTotalMb > 0) s.ramUsedMb.toDouble() / s.ramTotalMb else null- val most = heaviest.take(2).takeIf { it.isNotEmpty() }?.let { ": ${it.joinToString(" and ")} use the most" }.orEmpty()+ val most = heaviest.take(2)return when {- storage != null && storage >= FULL -> Health(false, "Storage almost full")- ram != null && ram >= FULL -> Health(false, "Memory almost full$most")- else -> Health(true, "Running fine")+ storage != null && storage >= FULL -> Health(false, UiText(R.string.copy_health_storage_full))+ ram != null && ram >= FULL -> Health(+ false,+ when (most.size) {+ 0 -> UiText(R.string.copy_health_memory_full)+ 1 -> UiText(R.string.copy_health_memory_full_one, most[0])+ else -> UiText(R.string.copy_health_memory_full_two, most[0], most[1])+ },+ )+ else -> Health(true, UiText(R.string.copy_health_fine))}}const val FULL = 0.9- fun bytes(v: Long): String = when {- v >= 1L shl 30 -> "%.1f GB".format(v / (1L shl 30).toDouble())- v >= 1L shl 20 -> "%.1f MB".format(v / (1L shl 20).toDouble())- v >= 1L shl 10 -> "${v shr 10} KB"- else -> "$v bytes"+ fun bytes(v: Long): UiText = when {+ v >= 1L shl 30 -> UiText(R.string.copy_size_gb, v / (1L shl 30).toDouble())+ v >= 1L shl 20 -> UiText(R.string.copy_size_mb, v / (1L shl 20).toDouble())+ v >= 1L shl 10 -> UiText(R.string.copy_size_kb, v shr 10)+ else -> UiText.plural(R.plurals.copy_size_bytes, v.toInt(), v)+ }++ /** [bytes] without a trailing ".0": 12 GB rather than 12.0 GB. */+ private fun bytesWhole(v: Long): UiText {+ fun tenths(unit: Long) = Math.round(v * 10.0 / unit)+ return when {+ v >= 1L shl 30 && tenths(1L shl 30) % 10 == 0L -> UiText(R.string.copy_size_gb_whole, tenths(1L shl 30) / 10)+ v in (1L shl 20) until (1L shl 30) && tenths(1L shl 20) % 10 == 0L -> UiText(R.string.copy_size_mb_whole, tenths(1L shl 20) / 10)+ else -> bytes(v)+ }}- fun folder(f: TvFolder) = when (f) {- TvFolder.DOWNLOAD -> "Download"- TvFolder.MOVIES -> "Movies"+ fun folder(f: TvFolder): UiText = when (f) {+ TvFolder.DOWNLOAD -> UiText(R.string.copy_folder_download)+ TvFolder.MOVIES -> UiText(R.string.copy_folder_movies)}// Sideload- fun installButton(kind: InstallKind) = when (kind) {- InstallKind.NEW -> "Install"- InstallKind.UPDATE -> "Update"- InstallKind.REINSTALL -> "Reinstall"- InstallKind.DOWNGRADE -> "Install older version"+ fun installButton(kind: InstallKind): UiText = when (kind) {+ InstallKind.NEW -> UiText(R.string.copy_install_new)+ InstallKind.UPDATE -> UiText(R.string.copy_install_update)+ InstallKind.REINSTALL -> UiText(R.string.copy_install_reinstall)+ InstallKind.DOWNGRADE -> UiText(R.string.copy_install_downgrade)}- fun installKind(kind: InstallKind, onTv: String?, picked: String?) = when (kind) {- InstallKind.NEW -> "Not on this TV yet. This installs it."- InstallKind.UPDATE -> "Updates the TV's copy" + versions(onTv, picked) + ". Its settings stay."- InstallKind.REINSTALL -> "The TV already has this version" + (onTv?.let { " ($it)" } ?: "") + ". This installs it again over itself."- InstallKind.DOWNGRADE -> "This is older than the one on the TV" +- (if (onTv != null && picked != null) " ($picked here, $onTv on the TV)" else "") +- ". Android normally refuses that, and the app's saved data may not work with the older version."+ fun installKind(kind: InstallKind, onTv: String?, picked: String?): UiText = when (kind) {+ InstallKind.NEW -> UiText(R.string.copy_install_kind_new)+ InstallKind.UPDATE ->+ if (onTv != null && picked != null) UiText(R.string.copy_install_kind_update_versions, onTv, picked)+ else UiText(R.string.copy_install_kind_update)+ InstallKind.REINSTALL ->+ onTv?.let { UiText(R.string.copy_install_kind_reinstall_version, it) } ?: UiText(R.string.copy_install_kind_reinstall)+ InstallKind.DOWNGRADE ->+ if (onTv != null && picked != null) UiText(R.string.copy_install_kind_downgrade_versions, picked, onTv)+ else UiText(R.string.copy_install_kind_downgrade)}- private fun versions(onTv: String?, picked: String?) =- if (onTv != null && picked != null) " from $onTv to $picked" else ""+ val ALLOW_DOWNGRADE = UiText(R.string.copy_allow_downgrade)+ val INSTALL_KEEP_OPEN = UiText(R.string.copy_install_keep_open)- const val ALLOW_DOWNGRADE = "Install the older version anyway"- const val INSTALL_KEEP_OPEN = "Keep Tellyscope open until it's done."-- fun installed(kind: InstallKind, app: String) = when (kind) {- InstallKind.UPDATE -> "Updated $app."- InstallKind.REINSTALL -> "Reinstalled $app."- InstallKind.NEW, InstallKind.DOWNGRADE -> "Installed $app."+ fun installed(kind: InstallKind, app: String): UiText = when (kind) {+ InstallKind.UPDATE -> UiText(R.string.copy_installed_update, app)+ InstallKind.REINSTALL -> UiText(R.string.copy_installed_reinstall, app)+ InstallKind.NEW, InstallKind.DOWNGRADE -> UiText(R.string.copy_installed_new, app)}- fun installRefused(reason: InstallRefusal, app: String) = when (reason) {- InstallRefusal.SIGNATURE ->- "The $app on the TV comes from a different developer, so Android won't replace it. If you're sure, uninstall it first: from Apps here if you installed it, or on the TV."- InstallRefusal.DOWNGRADE -> "The TV has a newer $app and won't go back to an older one."- InstallRefusal.NO_SPACE -> "The TV is out of space. Disable or uninstall something there, then try again."- InstallRefusal.TV_SAID_NO ->- "The TV blocked the install. Look in the TV's security settings for installing apps from unknown sources, or for app verification, then try again."- InstallRefusal.TV_TOO_OLD -> "$app needs a newer version of Android than this TV has."- InstallRefusal.WRONG_CPU ->- "This $app is built for a different kind of processor. Look for a version made for this TV, often marked armeabi-v7a or arm64-v8a."- InstallRefusal.APP_TOO_OLD -> "$app was made for a very old version of Android, and this TV won't install it."- InstallRefusal.MISSING_FEATURE -> "$app needs something this TV doesn't have, like a touchscreen or a camera."- InstallRefusal.MISSING_PARTS ->- "$app comes in several parts and one is missing. Pick all of its .apk files together, or its .apks bundle."- InstallRefusal.TEST_ONLY -> "This is a developer test build of $app, which the TV won't install."- InstallRefusal.CONFLICT -> "Another app on the TV already uses something $app needs, so the TV refused it."- InstallRefusal.BROKEN -> "This file isn't a working app. It may be damaged or only half downloaded; try getting it again."- InstallRefusal.UNKNOWN -> "The TV didn't install $app."+ fun installRefused(reason: InstallRefusal, app: String): UiText = when (reason) {+ InstallRefusal.SIGNATURE -> UiText(R.string.copy_install_refused_signature, app)+ InstallRefusal.DOWNGRADE -> UiText(R.string.copy_install_refused_downgrade, app)+ InstallRefusal.NO_SPACE -> UiText(R.string.copy_install_refused_no_space)+ InstallRefusal.TV_SAID_NO -> UiText(R.string.copy_install_refused_tv_said_no)+ InstallRefusal.TV_TOO_OLD -> UiText(R.string.copy_install_refused_tv_too_old, app)+ InstallRefusal.WRONG_CPU -> UiText(R.string.copy_install_refused_wrong_cpu, app)+ InstallRefusal.APP_TOO_OLD -> UiText(R.string.copy_install_refused_app_too_old, app)+ InstallRefusal.MISSING_FEATURE -> UiText(R.string.copy_install_refused_missing_feature, app)+ InstallRefusal.MISSING_PARTS -> UiText(R.string.copy_install_refused_missing_parts, app)+ InstallRefusal.TEST_ONLY -> UiText(R.string.copy_install_refused_test_only, app)+ InstallRefusal.CONFLICT -> UiText(R.string.copy_install_refused_conflict, app)+ InstallRefusal.BROKEN -> UiText(R.string.copy_install_refused_broken)+ InstallRefusal.UNKNOWN -> UiText(R.string.copy_install_refused_unknown, app)}- const val NOT_AN_APP = "That file isn't an Android app. Pick an .apk, several split .apk files, or an .apks or .xapk bundle."- const val SIDELOAD_LOST = "Lost the TV partway through. Check it's still on and connected, then try again."+ val NOT_AN_APP = UiText(R.string.copy_not_an_app)+ val SIDELOAD_LOST = UiText(R.string.copy_sideload_lost)// Filesfun sent(name: String, savedAs: String, f: TvFolder) =- if (savedAs == name) "Sent $name to ${folder(f)}" else "Sent to ${folder(f)} as $savedAs, since $name was already there"+ if (savedAs == name) UiText(R.string.copy_sent, name, folder(f)) else UiText(R.string.copy_sent_renamed, folder(f), savedAs, name)- fun saved(name: String) = "Saved $name to your phone"- fun sendFailed(name: String) = "Couldn't send $name. Check the TV is still connected and has space."- fun saveFailed(name: String) = "Couldn't save $name. Check the TV is still connected and the phone has space."+ fun saved(name: String) = UiText(R.string.copy_saved, name)+ fun sendFailed(name: String) = UiText(R.string.copy_send_failed, name)+ fun saveFailed(name: String) = UiText(R.string.copy_save_failed, name)- const val CANCELLED_SEND = "Cancelled. Nothing was left on the TV."- const val CANCELLED_SAVE = "Cancelled. Nothing was saved."- const val CANT_READ = "Couldn't read that file on your phone."- const val CANT_UNDO = "This version of Tellyscope can't undo that setting."- const val FILES_LOST = "Couldn't read this folder. Check the TV is still connected."+ val CANCELLED_SEND = UiText(R.string.copy_cancelled_send)+ val CANCELLED_SAVE = UiText(R.string.copy_cancelled_save)+ val CANT_READ = UiText(R.string.copy_cant_read)+ val CANT_UNDO = UiText(R.string.copy_cant_undo)+ val FILES_LOST = UiText(R.string.copy_files_lost)// Remote- 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_WAKE = "works again once it reconnects"- const val TYPE_HINT = "Select a text box on the TV, like a search box, then type here."- const val BACKSPACE = "Delete the last letter you typed on the TV"- const val SCREEN_OFF = "Screen off"- const val SCREEN_ON = "Screen on"- const val SCREEN_OFF_WAKE = "tap any key to wake"- const val SCREEN_OFF_TIP = "Turns off the TV's picture. The app stays connected; any key wakes it."- const val SCREEN_OFF_REFUSED = "This TV can't turn its picture off from Tellyscope."- const val SCREEN_ON_REFUSED = "The TV's picture didn't come back on. Try again, or restart the TV."-- fun cantType(text: String): String {+ val KEY_REFUSED = UiText(R.string.copy_key_refused)+ val TYPE_REFUSED = UiText(R.string.copy_type_refused)+ val REMOTE_LOST = UiText(R.string.copy_remote_lost)+ val NO_UPDATE_SCREEN = UiText(R.string.copy_no_update_screen)+ val UPDATES_OPENED = UiText(R.string.copy_updates_opened)+ val REBOOT_REFUSED = UiText(R.string.copy_reboot_refused)+ val REBOOT_IGNORED = UiText(R.string.copy_reboot_ignored)+ val REMOTE_OFFLINE_WAKE = UiText(R.string.copy_remote_offline_wake)+ val TYPE_HINT = UiText(R.string.copy_type_hint)+ val BACKSPACE = UiText(R.string.copy_backspace)+ val SCREEN_OFF = UiText(R.string.copy_screen_off)+ val SCREEN_ON = UiText(R.string.copy_screen_on)+ val SCREEN_OFF_WAKE = UiText(R.string.copy_screen_off_wake)+ val SCREEN_OFF_TIP = UiText(R.string.copy_screen_off_tip)+ val SCREEN_OFF_REFUSED = UiText(R.string.copy_screen_off_refused)+ val SCREEN_ON_REFUSED = UiText(R.string.copy_screen_on_refused)++ fun cantType(text: String): UiText {val odd = text.firstOrNull { it !in ' '..'~' }return when {- text.isEmpty() -> "Type something first."- text.length > app.tellyscope.adb.Remote.MAX_TEXT -> "That's too long to send in one go. Send up to ${app.tellyscope.adb.Remote.MAX_TEXT} characters at a time."- odd == '\n' || odd == '\t' -> "The TV can only take one line at a time."- odd != null -> "The TV can only type plain letters, numbers and symbols, not \u201c$odd\u201d."- else -> "The TV reads \u201c%s\u201d as a space, so it can't type that."+ text.isEmpty() -> UiText(R.string.copy_cant_type_empty)+ text.length > app.tellyscope.adb.Remote.MAX_TEXT ->+ UiText.plural(R.plurals.copy_cant_type_too_long, app.tellyscope.adb.Remote.MAX_TEXT)+ odd == '\n' || odd == '\t' -> UiText(R.string.copy_cant_type_one_line)+ odd != null -> UiText(R.string.copy_cant_type_odd, odd.toString())+ else -> UiText(R.string.copy_cant_type_percent_s)}}- const val REMOTE_RESTART = "Restart TV"- const val REBOOT_TITLE = "Restart the TV?"- const val REBOOT_TEXT = "The TV turns off and on again. Tellyscope reconnects by itself when it's back, usually within a minute."- const val RESTARTING_TITLE = "Restarting…"- const val RESTARTING_TEXT = "The TV is restarting. Tellyscope will reconnect by itself."- const val RESTART_LATE_TITLE = "The TV hasn't come back yet"- const val RESTART_LATE_STATUS = "Not back yet"- const val RESTART_LATE_TEXT = "It's been a minute. Some TVs take longer to start; Retry waits another minute."- const val RESTART_LOST_TEXT = "Use the TV's own remote to turn it on, then tap Retry."-- fun waitingFor(name: String, ms: Long): String {+ val REMOTE_RESTART = UiText(R.string.copy_remote_restart)+ val REBOOT_TITLE = UiText(R.string.copy_reboot_title)+ val REBOOT_TEXT = UiText(R.string.copy_reboot_text)+ val RESTARTING_TITLE = UiText(R.string.copy_restarting_title)+ val RESTARTING_TEXT = UiText(R.string.copy_restarting_text)+ val RESTART_LATE_TITLE = UiText(R.string.copy_restart_late_title)+ val RESTART_LATE_STATUS = UiText(R.string.copy_restart_late_status)+ val RESTART_LATE_TEXT = UiText(R.string.copy_restart_late_text)+ val RESTART_LOST_TEXT = UiText(R.string.copy_restart_lost_text)++ fun waitingFor(name: String, ms: Long): UiText {val s = (ms / 1000).coerceAtLeast(0)- return "Waiting for $name · ${s / 60}:${(s % 60).toString().padStart(2, '0')}"+ return UiText(R.string.copy_waiting_for, name, s / 60, s % 60)}- fun restartLost(name: String) = "Still can't reach $name"- fun backOnline(name: String) = "Back online. $name reconnected."+ fun restartLost(name: String) = UiText(R.string.copy_restart_lost, name)+ fun backOnline(name: String) = UiText(R.string.copy_back_online, name)// Remote buttons- const val REMOTE_BUTTONS = "Remote buttons"- const val MORE = "More options"+ val REMOTE_BUTTONS = UiText(R.string.copy_remote_buttons)+ val MORE = UiText(R.string.copy_more)- fun buttonsHint(cap: Int) = "Pick up to $cap. Drag to set the order. To pick another, untick one first."- fun notOnTv(name: String) = "$name isn't on this TV. Install it from the Play Store on the TV."- fun cantOpen(label: String) = "The TV couldn't open $label. If it's turned off, turn it on in Apps."+ fun buttonsHint(cap: Int) = UiText(R.string.copy_buttons_hint, cap)+ fun notOnTv(name: String) = UiText(R.string.copy_not_on_tv, name)+ fun cantOpen(label: String) = UiText(R.string.copy_cant_open, label)fun leftDock(labels: List<String>) =- if (labels.size == 1) "${labels[0]} was uninstalled, so its button left the Remote."- else "${labels.size} apps were uninstalled, so their buttons left the Remote."+ if (labels.size == 1) UiText(R.string.copy_left_dock_one, labels[0])+ else UiText.plural(R.plurals.copy_left_dock, labels.size)fun restarting(minutes: Long) =- if (minutes < 3) "Tellyscope reconnects on its own when the TV is back, usually within a couple of minutes."- else "Taking a while. Some TVs turn network debugging off when they restart. If it doesn't come back, turn it on again in the TV's Developer options."-- const val TWEAKS = "TV tweaks"- const val DNS_TITLE = "Block ads with Private DNS"- fun dnsState(host: String?) = host?.let { "On: $it" } ?: "Off. Turn on to block ads and trackers in every app on the TV."- const val DNS_TOO_OLD = "Needs Android 9 or newer. This TV is older."- const val DNS_DIALOG = "Block ads on the whole TV?"- const val DNS_TEXT = "The TV will look up every address through this ad-blocking DNS provider. AdGuard is free and needs no account. " +- "Tellyscope then checks the TV can still look addresses up, and puts it back if not. Undo is in History."- const val DNS_FIELD = "DNS provider"- const val DNS_BAD = "Enter a hostname like dns.adguard-dns.com. An IP address won't work here."- const val DNS_CONFIRM = "Turn on"- const val ANIMATIONS_TITLE = "Faster animations"+ if (minutes < 3) UiText(R.string.copy_restarting_soon)+ else UiText(R.string.copy_restarting_long)++ val TWEAKS = UiText(R.string.copy_tweaks)+ val DNS_TITLE = UiText(R.string.copy_dns_title)+ fun dnsState(host: String?) = host?.let { UiText(R.string.copy_dns_state_on, it) } ?: UiText(R.string.copy_dns_state_off)+ val DNS_TOO_OLD = UiText(R.string.copy_dns_too_old)+ val DNS_DIALOG = UiText(R.string.copy_dns_dialog)+ val DNS_TEXT = UiText(R.string.copy_dns_text)+ val DNS_FIELD = UiText(R.string.copy_dns_field)+ val DNS_BAD = UiText(R.string.copy_dns_bad)+ val DNS_CONFIRM = UiText(R.string.copy_dns_confirm)+ val ANIMATIONS_TITLE = UiText(R.string.copy_animations_title)fun animationsState(scale: String?) =- if (scale == TvSettings.FAST) "On: menus move at twice the speed"- else "Off. Turn on to make menus feel snappier."- const val CACHES_TITLE = "Clear all app caches"- const val CACHES_TEXT = "Frees space by clearing every app's temporary files. App data and sign-ins stay."- const val CACHES_BUTTON = "Clear caches"+ if (scale == TvSettings.FAST) UiText(R.string.copy_animations_state_on)+ else UiText(R.string.copy_animations_state_off)+ val CACHES_TITLE = UiText(R.string.copy_caches_title)+ val CACHES_TEXT = UiText(R.string.copy_caches_text)+ val CACHES_BUTTON = UiText(R.string.copy_caches_button)fun cachesCleared(freedKb: Long?) =- if (freedKb == null || freedKb <= 0) "Cleared app caches" else "Cleared app caches, freed ${bytes(freedKb * 1024)}"- const val SCREENSHOT_TITLE = "Screenshot"- const val SCREENSHOT_TEXT = "Saves what the TV shows to your phone. Protected video, like most streaming apps, shows as black."- const val SCREENSHOT_BUTTON = "Take screenshot"+ if (freedKb == null || freedKb <= 0) UiText(R.string.copy_caches_cleared) else UiText(R.string.copy_caches_cleared_freed, bytes(freedKb * 1024))+ val SCREENSHOT_TITLE = UiText(R.string.copy_screenshot_title)+ val SCREENSHOT_TEXT = UiText(R.string.copy_screenshot_text)+ val SCREENSHOT_BUTTON = UiText(R.string.copy_screenshot_button)+ /** A file name on disk, so it stays as it is in every language. */fun screenshotName(at: Long) ="TV screenshot " + SimpleDateFormat("yyyy-MM-dd HH.mm.ss", Locale.ROOT).format(Date(at)) + ".png"- const val SCREENSHOT_SAVED = "Screenshot saved to your phone"- const val SCREENSHOT_FAILED = "Couldn't take a screenshot. Check the TV is still connected."- const val REQUEST_TITLE = "Another device wants to control this TV"- const val REQUEST_TEXT = "The TV is asking whether to allow debugging from a device with this key fingerprint. " +- "Allow it only if you started this yourself and the fingerprint matches the one that device shows."- const val REQUEST_ALWAYS = "Always allow this device"- const val REQUEST_ALLOW = "Allow"- const val REQUEST_DENY = "Deny"- const val REQUEST_ALLOWED = "Allowed. That device can control the TV now."- const val REQUEST_DENIED = "Denied. That device can't connect."- const val REQUEST_GONE = "The TV's prompt had closed or changed, so nothing was pressed."+ val SCREENSHOT_SAVED = UiText(R.string.copy_screenshot_saved)+ val SCREENSHOT_FAILED = UiText(R.string.copy_screenshot_failed)+ val REQUEST_TITLE = UiText(R.string.copy_request_title)+ val REQUEST_TEXT = UiText(R.string.copy_request_text)+ val REQUEST_ALWAYS = UiText(R.string.copy_request_always)+ val REQUEST_ALLOW = UiText(R.string.copy_request_allow)+ val REQUEST_DENY = UiText(R.string.copy_request_deny)+ val REQUEST_ALLOWED = UiText(R.string.copy_request_allowed)+ val REQUEST_DENIED = UiText(R.string.copy_request_denied)+ val REQUEST_GONE = UiText(R.string.copy_request_gone)/** A prompt under Fire OS's remote alert: it can't be read until the alert closes. */- const val REQUEST_BEHIND_ALERT = "The TV's prompt is behind an Amazon alert, “Unable to Detect Your Remote”. Press OK on your TV remote to close it."- const val REQUEST_THEN = "Then the prompt shows here, so you can check its fingerprint."- const val REQUEST_WAITING = "Waiting for the TV's prompt"- const val PRESS_OK = "Press OK on the TV"+ val REQUEST_BEHIND_ALERT = UiText(R.string.copy_request_behind_alert)+ val REQUEST_THEN = UiText(R.string.copy_request_then)+ val REQUEST_WAITING = UiText(R.string.copy_request_waiting)+ val PRESS_OK = UiText(R.string.copy_press_ok)// Who has access- const val WARNING_TITLE = "Another computer is connected to this TV"- const val WARNING_TEXT = "It can do everything Tellyscope can: install or remove apps, read files and control the screen."- const val ITS_MINE = "It's mine"- const val REMOVE_ACCESS = "Remove all other access…"- const val CONNECTED_NOW = "Connected now"- const val WHO_HAS_ACCESS = "Who has access"+ val WARNING_TITLE = UiText(R.string.copy_warning_title)+ val WARNING_TEXT = UiText(R.string.copy_warning_text)+ val ITS_MINE = UiText(R.string.copy_its_mine)+ val REMOVE_ACCESS = UiText(R.string.copy_remove_access)+ val CONNECTED_NOW = UiText(R.string.copy_connected_now)+ val WHO_HAS_ACCESS = UiText(R.string.copy_who_has_access)/** The TV menu's rows for the screens it opens. */- const val HISTORY = "History"- const val ADVANCED_MONITOR = "Advanced monitor"+ val HISTORY = UiText(R.string.copy_history)+ val ADVANCED_MONITOR = UiText(R.string.copy_advanced_monitor)/** In the TV menu and in Settings: opens Android's share sheet with the repo link. */- const val SHARE = "Share Tellyscope"+ val SHARE = UiText(R.string.copy_share)/** Reset TV: its row in the TV menu, its screen, and what it says before, during and after. */- const val RESET_TV = "Reset TV to how it shipped"- const val RESET_KEEPS = "Keeps apps' data and sign-ins"-- fun apps(n: Int) = if (n == 1) "1 app" else "$n apps"-- fun resetFound(n: Int) = "$n ${if (n == 1) "change" else "changes"} since this TV left the factory"- const val RESET_FOUND_TEXT = "Your apps' data and sign-ins stay. Nothing has changed yet."- fun turnOnApps(n: Int) = "Turn on ${apps(n)}"- const val TURN_ON_TEXT = "Preinstalled apps turned off by hand, from any phone or tool"- fun bringBackApps(n: Int) = "Bring back ${apps(n)}"- const val BRING_BACK_TEXT = "Preinstalled apps that were uninstalled. They're still on the TV."- fun resetHome(to: String) = "Make $to the home screen"+ val RESET_TV = UiText(R.string.copy_reset_tv)+ val RESET_KEEPS = UiText(R.string.copy_reset_keeps)++ fun apps(n: Int) = UiText.plural(R.plurals.copy_apps, n)++ fun resetFound(n: Int) = UiText.plural(R.plurals.copy_reset_found, n)+ val RESET_FOUND_TEXT = UiText(R.string.copy_reset_found_text)+ fun turnOnApps(n: Int) = UiText.plural(R.plurals.copy_turn_on_apps, n)+ val TURN_ON_TEXT = UiText(R.string.copy_turn_on_text)+ fun bringBackApps(n: Int) = UiText.plural(R.plurals.copy_bring_back_apps, n)+ val BRING_BACK_TEXT = UiText(R.string.copy_bring_back_text)+ fun resetHome(to: String) = UiText(R.string.copy_reset_home, to)fun resetHomeText(from: String, service: Boolean) =- "Instead of $from" + (if (service) ", with its accessibility service turned off" else "") + ". $from stays installed."+ UiText(if (service) R.string.copy_reset_home_text_service else R.string.copy_reset_home_text, from)/** Under what Reset found: what it leaves alone. [maker] is the TV's brand, when known. */- fun resetLeaves(shippedOff: Int, maker: String?) =- (if (shippedOff > 0) "${apps(shippedOff)} ${maker ?: "the maker"} shipped switched off stay off. " else "") +- "Apps and launchers you installed stay installed."-- const val NOTHING_TO_RESET = "Nothing to reset"- fun nothingToReset(ownHome: String?, maker: String?) =- "Every preinstalled app is on" + (ownHome?.let { ", and $it is the home screen" } ?: "") + ". " +- "Apps ${maker ?: "the maker"} shipped switched off stay off."-- fun resetting(p: ResetProgress, home: String?) = when (p.part) {- ResetPart.TurnOn -> "Turning on apps: ${p.done} of ${p.of}."- ResetPart.BringBack -> "Bringing back apps: ${p.done} of ${p.of}."- ResetPart.Home -> "Making ${home ?: "the TV's own launcher"} the home screen."- } + " Keep the TV on and connected."- const val RESETTING = "Resetting…"- const val RESET_APPS_STALE = "Reset done, but the app list didn't refresh. Open the TV again to see it."- const val RESET_BUTTON = "Reset TV"-- const val RESET_DONE = "TV reset to how it shipped"- const val RESET_PARTLY = "Reset partly done"- fun resetDoneText(apps: Int, home: String?) = listOfNotNull(- when (apps) {- 0 -> null- 1 -> "1 preinstalled app is back"- else -> "$apps preinstalled apps are back"- },- home?.let { "$it is the home screen" },- ).joinToString(", and ") + ". Apps' data and sign-ins stayed."- fun resetPartlyText(failed: Int) =- "${if (failed == 1) "One step" else "$failed steps"} didn't work. Everything else is back to how it shipped. Nothing was lost."- fun turnedOn(done: Int, of: Int) = if (done == of) "Turned on ${apps(of)}" else "Turned on $done of ${apps(of)}"- fun broughtBack(done: Int, of: Int) = if (done == of) "Brought back ${apps(of)}" else "Brought back $done of ${apps(of)}"- fun isHome(app: String) = "$app is the home screen"- fun stillHome(app: String) = "$app is still the home screen"- fun tryAgain(app: String?) = if (app != null) "Try $app again" else "Try again"+ fun resetLeaves(shippedOff: Int, maker: String?): UiText = UiText.Join(+ listOfNotNull(+ if (shippedOff > 0) UiText.plural(R.plurals.copy_reset_leaves_off, shippedOff, shippedOff, maker ?: UiText(R.string.copy_the_maker)) else null,+ UiText(R.string.copy_reset_leaves),+ ),+ " ",+ )++ val NOTHING_TO_RESET = UiText(R.string.copy_nothing_to_reset_title)+ fun nothingToReset(ownHome: String?, maker: String?): UiText = UiText.Join(+ listOf(+ ownHome?.let { UiText(R.string.copy_nothing_to_reset_on_home, it) } ?: UiText(R.string.copy_nothing_to_reset_on),+ UiText(R.string.copy_nothing_to_reset_maker, maker ?: UiText(R.string.copy_the_maker)),+ ),+ " ",+ )++ fun resetting(p: ResetProgress, home: String?): UiText = UiText.Join(+ listOf(+ when (p.part) {+ ResetPart.TurnOn -> UiText(R.string.copy_resetting_turn_on, p.done, p.of)+ ResetPart.BringBack -> UiText(R.string.copy_resetting_bring_back, p.done, p.of)+ ResetPart.Home -> UiText(R.string.copy_resetting_home, home ?: TV_OWN_LAUNCHER)+ },+ UiText(R.string.copy_keep_tv_on),+ ),+ " ",+ )+ val RESETTING = UiText(R.string.copy_resetting)+ val RESET_APPS_STALE = UiText(R.string.copy_reset_apps_stale)+ val RESET_BUTTON = UiText(R.string.copy_reset_button)++ val RESET_DONE = UiText(R.string.copy_reset_done)+ val RESET_PARTLY = UiText(R.string.copy_reset_partly)+ fun resetDoneText(apps: Int, home: String?): UiText = when {+ apps != 0 && home != null -> UiText.plural(R.plurals.copy_reset_done_apps_home, apps, apps, home)+ apps != 0 -> UiText.plural(R.plurals.copy_reset_done_apps, apps)+ home != null -> UiText(R.string.copy_reset_done_home, home)+ else -> UiText(R.string.copy_reset_done_nothing)+ }+ fun resetPartlyText(failed: Int) = UiText.plural(R.plurals.copy_reset_partly_text, failed)+ fun turnedOn(done: Int, of: Int) =+ if (done == of) UiText.plural(R.plurals.copy_turned_on_all, of) else UiText.plural(R.plurals.copy_turned_on_some, of, done, of)+ fun broughtBack(done: Int, of: Int) =+ if (done == of) UiText.plural(R.plurals.copy_brought_back_all, of) else UiText.plural(R.plurals.copy_brought_back_some, of, done, of)+ fun isHome(app: String) = UiText(R.string.copy_is_home, app)+ fun stillHome(app: String) = UiText(R.string.copy_still_home, app)+ fun tryAgain(app: String?) = if (app != null) UiText(R.string.copy_try_app_again, app) else UiText(R.string.copy_try_again)/** Debloat while it turns the ticked apps off, then its result. */- fun disablingApps(done: Int, of: Int) = "Turning off apps: $done of $of. Keep the TV on and connected."- const val DISABLING = "Disabling…"- const val DISABLING_NOTE = "Nothing is deleted. Turn any back on from History."- const val DEBLOAT_DONE = "Debloat done"- const val DEBLOAT_PARTLY = "Debloat partly done"- const val DEBLOAT_RESULT_TEXT = "Nothing was deleted; undo any of them from History."- fun turnedOff(done: Int, of: Int) = if (done == of) "Turned off ${apps(of)}" else "Turned off $done of ${apps(of)}"- fun stillOn(app: String) = "$app is still on"+ fun disablingApps(done: Int, of: Int) = UiText(R.string.copy_disabling_apps, done, of)+ val DISABLING = UiText(R.string.copy_disabling)+ val DISABLING_NOTE = UiText(R.string.copy_disabling_note)+ val DEBLOAT_DONE = UiText(R.string.copy_debloat_done)+ val DEBLOAT_PARTLY = UiText(R.string.copy_debloat_partly)+ val DEBLOAT_RESULT_TEXT = UiText(R.string.copy_debloat_result_text)+ fun turnedOff(done: Int, of: Int) =+ if (done == of) UiText.plural(R.plurals.copy_turned_off_all, of) else UiText.plural(R.plurals.copy_turned_off_some, of, done, of)+ fun stillOn(app: String) = UiText(R.string.copy_still_on, app)/** Under History in the menu, and on top of the History screen: apps Restore everything turns back on. */- fun stillOff(n: Int) = if (n == 1) "1 app still off" else "$n apps still off"- fun stillOffTitle(n: Int) = if (n == 1) "1 app Tellyscope turned off is still off" else "$n apps Tellyscope turned off are still off"- const val STILL_OFF_TEXT = "Restore everything turns them back on. Apps that were off before Tellyscope's first change stay off."- fun othersConnected(n: Int) = if (n == 1) "1 other connected now" else "$n others connected now"- fun connections(n: Int) = if (n == 1) "1 connection" else "$n connections"- fun connectedFrom(address: String, n: Int) = "From $address · ${connections(n)}"- const val ON_TV = "An app on this TV"- const val ACCESS_INTRO = "Each computer allowed to use ADB can install or remove apps, read files and control the screen."- const val THIS_PHONE = "This phone"- const val TELLYSCOPE = "Tellyscope"- const val NOT_THIS_PHONE = "Not this phone"- const val YOURS = "Yours"- const val WAITING_CHIP = "Waiting"- const val WAITING_LINE = "Waiting for you to allow it on the TV"- const val WAITING_TEXT = "An Allow prompt for it is on the TV now. It can't do anything until you choose Allow there. Not yours? Choose Deny."- const val ANSWER = "Answer"- const val NEW_CHIP = "New"- const val NEW_KEY_TEXT = "Allowed on the TV while Tellyscope wasn't watching. Not yours? Remove all other access."- const val ALLOWED_COMPUTERS = "Allowed computers"- const val UNNAMED_COMPUTER = "Unnamed computer"- const val CANT_CHECK_CONNECTED = "This TV doesn't say who is connected."- const val CANT_CHECK_ALLOWED = "This TV doesn't list its allowed computers."- const val NOBODY_ALLOWED = "No computer is allowed. The next one to connect has to be allowed on the TV."- const val ACCESS_FOOT_LINK = "The TV doesn't say which allowed computer is behind a connection. If you don't recognise an address, remove all other access."- const val ACCESS_FOOT_ALL = "Android can't remove one computer on its own: this clears every computer, then you allow Tellyscope again."+ fun stillOff(n: Int) = UiText.plural(R.plurals.copy_still_off, n)+ fun stillOffTitle(n: Int) = UiText.plural(R.plurals.copy_still_off_title, n)+ val STILL_OFF_TEXT = UiText(R.string.copy_still_off_text)+ fun othersConnected(n: Int) = UiText.plural(R.plurals.copy_others_connected, n)+ fun connections(n: Int) = UiText.plural(R.plurals.copy_connections, n)+ fun connectedFrom(address: String, n: Int) = UiText.plural(R.plurals.copy_connected_from, n, address, n)+ val ON_TV = UiText(R.string.copy_on_tv)+ val ACCESS_INTRO = UiText(R.string.copy_access_intro)+ val THIS_PHONE = UiText(R.string.copy_this_phone)+ val TELLYSCOPE: UiText = UiText.Raw("Tellyscope")+ val NOT_THIS_PHONE = UiText(R.string.copy_not_this_phone)+ val YOURS = UiText(R.string.copy_yours)+ val WAITING_CHIP = UiText(R.string.copy_waiting_chip)+ val WAITING_LINE = UiText(R.string.copy_waiting_line)+ val WAITING_TEXT = UiText(R.string.copy_waiting_text)+ val ANSWER = UiText(R.string.copy_answer)+ val NEW_CHIP = UiText(R.string.copy_new_chip)+ val NEW_KEY_TEXT = UiText(R.string.copy_new_key_text)+ val ALLOWED_COMPUTERS = UiText(R.string.copy_allowed_computers)+ val UNNAMED_COMPUTER = UiText(R.string.copy_unnamed_computer)+ val CANT_CHECK_CONNECTED = UiText(R.string.copy_cant_check_connected)+ val CANT_CHECK_ALLOWED = UiText(R.string.copy_cant_check_allowed)+ val NOBODY_ALLOWED = UiText(R.string.copy_nobody_allowed)+ val ACCESS_FOOT_LINK = UiText(R.string.copy_access_foot_link)+ val ACCESS_FOOT_ALL = UiText(R.string.copy_access_foot_all)/** Rough on purpose: the TV stamps a key when any connection uses it, not per session. */- fun lastSeen(at: Long?, now: Long): String {- if (at == null) return "Never seen"+ fun lastSeen(at: Long?, now: Long): UiText {+ if (at == null) return UiText(R.string.copy_never_seen)val days = ((now - at) / 86_400_000).coerceAtLeast(0)return when {- now - at < 5 * 60_000 -> "Last seen just now"- days == 0L -> "Last seen today, " + SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date(at))- days == 1L -> "Last seen yesterday"- days < 30 -> "Last seen $days days ago"- else -> "Last seen over a month ago"+ now - at < 5 * 60_000 -> UiText(R.string.copy_last_seen_just_now)+ days == 0L -> UiText(R.string.copy_last_seen_today, SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date(at)))+ days == 1L -> UiText(R.string.copy_last_seen_yesterday)+ days < 30 -> UiText.plural(R.plurals.copy_last_seen_days_ago, days.toInt())+ else -> UiText(R.string.copy_last_seen_long_ago)}}/** Enough of a fingerprint to tell keys apart: the first three and last two pairs. */@@ -777,65 +810,65 @@ object Copy {}// Remove all other access- const val REMOVE_TITLE = "Remove all other access"- const val CONFIRM_TITLE = "Remove all other access?"- const val CONFIRM_TEXT = "Every computer this TV has allowed loses access, your own computers too: they'll need allowing again."- const val CONFIRM_REMOTE = "Tellyscope reconnects straight away. Keep the TV remote handy: the TV asks you to allow this phone."- const val CONFIRM_BUTTON = "Remove access"- const val CANCEL = "Cancel"- const val REVOKING = "Removing access…"- const val ALLOW_TITLE = "Allow this phone on the TV"- const val ALLOW_TEXT_A = "Other access is removed. The TV now asks “Allow USB debugging?”. Tick "- const val ALLOW_ALWAYS = "Always allow from this computer"- const val ALLOW_TEXT_B = ", then choose "- const val ALLOW_BUTTON = "Allow"- const val FINGERPRINT_LABEL = "The TV should show this fingerprint"- const val FINGERPRINT_HINT = "If it shows a different one, choose Cancel on the TV."- const val STOP_WAITING = "Stop waiting"- const val REFUSED = "The TV didn't allow this phone. It may have timed out, or Cancel was chosen."- const val ASK_AGAIN = "Ask the TV again"- const val CHECKING = "Checking the TV…"- const val DONE_TITLE = "Only this phone has access"- const val DONE_TEXT = "Tellyscope checked the TV again: this phone is the only allowed computer, and nothing else is connected."- const val TRUST_WARNING = "Only allow computers and apps you trust. Anything you allow can install apps, read files and control the TV."- fun backTo(tv: String) = "Back to $tv"- const val STILL_TITLE = "Another computer is still connected"- fun stillText(who: String, tv: String) =- "Tellyscope still sees $who on $tv. It may have connected again straight away. Turn it off or unplug it from the network, then try again."- fun stillOpenText(who: String, tv: String) =- "Tellyscope still sees $who on $tv. Its access is gone, but the TV keeps a connection open until it ends. Restart the TV to end it."- const val CHECK_AGAIN = "Check again"- const val RESTART_TV = "Restart the TV"- const val RESTARTING_TO_CHECK = "Restarting the TV…"- fun connectionFrom(address: String) = "a connection from $address"- const val TRY_AGAIN = "Try again"- const val UNCONFIRMED_TITLE = "Revoked on the TV"- const val UNCONFIRMED_TEXT = "Tellyscope can't check the list on this TV. Look under Developer options to confirm."- const val DONE = "Done"- const val MANUAL_INTRO = "This TV didn't take Tellyscope's request, so it's two steps on the TV. Afterwards only this phone can use ADB on it; your own computers will need allowing again."- const val MANUAL_STEP_1 = "Open Developer options on the TV"- const val MANUAL_STEP_1_TEXT = "Tellyscope opens it for you. If nothing happens on the TV, go to Settings → Device Preferences → Developer options."- const val OPEN_ON_TV = "Open on TV"- const val MANUAL_STEP_2 = "Choose “Revoke USB debugging authorisations”"- const val MANUAL_STEP_2_TEXT = "Then come back here, and Tellyscope asks the TV to allow this phone again."- const val MANUAL_DONE = "I've revoked it"- const val DEV_OPTIONS_FAILED = "Couldn't open Developer options on the TV. Go to Settings → Device Preferences → Developer options."+ val REMOVE_TITLE = UiText(R.string.copy_remove_title)+ val CONFIRM_TITLE = UiText(R.string.copy_confirm_title)+ val CONFIRM_TEXT = UiText(R.string.copy_confirm_text)+ val CONFIRM_REMOTE = UiText(R.string.copy_confirm_remote)+ val CONFIRM_BUTTON = UiText(R.string.copy_confirm_button)+ val CANCEL = UiText(R.string.copy_cancel)+ val REVOKING = UiText(R.string.copy_revoking)+ val ALLOW_TITLE = UiText(R.string.copy_allow_title)+ val ALLOW_TEXT_A = UiText(R.string.copy_allow_text_a)+ val ALLOW_ALWAYS = UiText(R.string.copy_allow_always)+ val ALLOW_TEXT_B = UiText(R.string.copy_allow_text_b)+ val ALLOW_BUTTON = UiText(R.string.copy_allow_button)+ val FINGERPRINT_LABEL = UiText(R.string.copy_fingerprint_label)+ val FINGERPRINT_HINT = UiText(R.string.copy_fingerprint_hint)+ val STOP_WAITING = UiText(R.string.copy_stop_waiting)+ val REFUSED = UiText(R.string.copy_refused)+ val ASK_AGAIN = UiText(R.string.copy_ask_again)+ val CHECKING = UiText(R.string.copy_checking)+ val DONE_TITLE = UiText(R.string.copy_done_title)+ val DONE_TEXT = UiText(R.string.copy_done_text)+ val TRUST_WARNING = UiText(R.string.copy_trust_warning)+ fun backTo(tv: String) = UiText(R.string.copy_back_to, tv)+ val STILL_TITLE = UiText(R.string.copy_still_title)+ fun stillText(who: String, tv: String) = UiText(R.string.copy_still_text, who, tv)+ fun stillOpenText(who: String, tv: String) = UiText(R.string.copy_still_open_text, who, tv)+ val CHECK_AGAIN = UiText(R.string.copy_check_again)+ val RESTART_TV = UiText(R.string.copy_restart_tv)+ val RESTARTING_TO_CHECK = UiText(R.string.copy_restarting_to_check)+ fun connectionFrom(address: String) = UiText(R.string.copy_connection_from, address)+ val TRY_AGAIN = UiText(R.string.copy_try_again)+ val UNCONFIRMED_TITLE = UiText(R.string.copy_unconfirmed_title)+ val UNCONFIRMED_TEXT = UiText(R.string.copy_unconfirmed_text)+ val DONE = UiText(R.string.copy_done)+ val MANUAL_INTRO = UiText(R.string.copy_manual_intro)+ val MANUAL_STEP_1 = UiText(R.string.copy_manual_step_1)+ val MANUAL_STEP_1_TEXT = UiText(R.string.copy_manual_step_1_text)+ val OPEN_ON_TV = UiText(R.string.copy_open_on_tv)+ val MANUAL_STEP_2 = UiText(R.string.copy_manual_step_2)+ val MANUAL_STEP_2_TEXT = UiText(R.string.copy_manual_step_2_text)+ val MANUAL_DONE = UiText(R.string.copy_manual_done)+ val DEV_OPTIONS_FAILED = UiText(R.string.copy_dev_options_failed)// Connected devices- const val DEVICES_TITLE = "Connected devices"- fun showAll(n: Int) = "Show all ($n)"- const val SHOW_LESS = "Show less"- const val NO_DEVICES = "Nothing plugged in or paired."- fun group(g: Peripheral.Group) = when (g) {- Peripheral.Group.Bluetooth -> "Bluetooth"- Peripheral.Group.Input -> "Input"- Peripheral.Group.Storage -> "USB storage"- Peripheral.Group.Hdmi -> "HDMI-CEC"- Peripheral.Group.Audio -> "Audio output"+ val DEVICES_TITLE = UiText(R.string.copy_devices_title)+ fun showAll(n: Int) = UiText(R.string.copy_show_all, n)+ val SHOW_LESS = UiText(R.string.copy_show_less)+ val NO_DEVICES = UiText(R.string.copy_no_devices)+ fun group(g: Peripheral.Group): UiText = when (g) {+ Peripheral.Group.Bluetooth -> UiText.Raw("Bluetooth")+ Peripheral.Group.Input -> UiText(R.string.copy_group_input)+ Peripheral.Group.Storage -> UiText(R.string.copy_group_storage)+ Peripheral.Group.Hdmi -> UiText.Raw("HDMI-CEC")+ Peripheral.Group.Audio -> UiText(R.string.copy_group_audio)}/** The row's right-hand words. Collapsed rows have no group label, so Bluetooth says so there. */- fun peripheralStatus(p: Peripheral, grouped: Boolean): String {- val status = p.free?.let { "${bytes(it).replace(".0 ", " ")} free" } ?: p.status- return if (!grouped && p.group == Peripheral.Group.Bluetooth) "Bluetooth · ${status.lowercase()}" else status+ fun peripheralStatus(p: Peripheral, grouped: Boolean): UiText {+ val free = p.free?.let { UiText(R.string.copy_peripheral_free, bytesWhole(it)) }+ // p.status comes from the TV side in English; only that part is lowered.+ return if (!grouped && p.group == Peripheral.Group.Bluetooth) UiText(R.string.copy_peripheral_bluetooth, free ?: UiText.Raw(p.status.lowercase()))+ else free ?: UiText.Raw(p.status)}}diff --git a/app/src/main/java/app/tellyscope/ui/DebloatRunScreen.kt b/app/src/main/java/app/tellyscope/ui/DebloatRunScreen.ktindex b46e6ca..df9843e 100644--- a/app/src/main/java/app/tellyscope/ui/DebloatRunScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/DebloatRunScreen.kt@@ -34,7 +34,11 @@ import androidx.compose.material3.TopAppBarimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import app.tellyscope.R+import app.tellyscope.data.UiText+import app.tellyscope.data.resolve/*** Debloat after "Yes, disable them": the ticked apps, each marked done, running, waiting or@@ -47,19 +51,19 @@ fun DebloatRunScreen(run: DebloatRun, back: () -> Unit, retry: () -> Unit) {Scaffold(topBar = {TopAppBar(- title = { Text("Debloat") },- navigationIcon = { IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") } },+ title = { Text(stringResource(R.string.debloat_title)) },+ navigationIcon = { IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.screen_back)) } },)},bottomBar = {Row(Modifier.fillMaxWidth().navigationBarsPadding().padding(16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {when {- !run.ran -> Button(onClick = {}, enabled = false) { Text(Copy.DISABLING) }- run.failed.isEmpty() -> Button(onClick = back) { Text("Done") }+ !run.ran -> Button(onClick = {}, enabled = false) { Text(Copy.DISABLING.resolve()) }+ run.failed.isEmpty() -> Button(onClick = back) { Text(stringResource(R.string.screen_done)) }else -> {- TextButton(onClick = back) { Text("Done") }+ TextButton(onClick = back) { Text(stringResource(R.string.screen_done)) }val one = run.failed.keys.singleOrNull()?.let { pkg -> run.apps.first { it.packageName == pkg }.label }- Button(onClick = retry) { Text(Copy.tryAgain(one)) }+ Button(onClick = retry) { Text(Copy.tryAgain(one).resolve()) }}}}@@ -82,7 +86,7 @@ private fun Progress(run: DebloatRun) {modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp, top = 8.dp),)Text(- Copy.disablingApps(run.at, run.apps.size),+ Copy.disablingApps(run.at, run.apps.size).resolve(),style = MaterialTheme.typography.bodyMedium,color = c.onSurfaceVariant,modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 12.dp, bottom = 16.dp),@@ -106,17 +110,17 @@ private fun Progress(run: DebloatRun) {}Spacer(Modifier.width(16.dp))when (mark) {- Mark.Done -> Icon(HistoryIcons.TurnedOn, contentDescription = "Done", tint = c.primary)+ Mark.Done -> Icon(HistoryIcons.TurnedOn, contentDescription = stringResource(R.string.screen_done), tint = c.primary)Mark.Running -> CircularProgressIndicator(Modifier.size(20.dp), strokeWidth = 2.dp)- Mark.Waiting -> Icon(ResetIcons.Waiting, contentDescription = "Waiting", tint = c.onSurfaceVariant)- Mark.Failed -> Icon(Icons.Default.Warning, contentDescription = "Didn't turn off", tint = c.error)+ Mark.Waiting -> Icon(ResetIcons.Waiting, contentDescription = stringResource(R.string.screen_waiting), tint = c.onSurfaceVariant)+ Mark.Failed -> Icon(Icons.Default.Warning, contentDescription = stringResource(R.string.debloat_failed), tint = c.error)}}}}item {Text(- Copy.DISABLING_NOTE,+ Copy.DISABLING_NOTE.resolve(),style = MaterialTheme.typography.bodySmall,color = c.onSurfaceVariant,modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp),@@ -134,11 +138,12 @@ private fun Result(run: DebloatRun) {// No "Turned off 0 of n" row with a tick when the TV refused every one.val top = if (off > 0) 1 else 0LazyColumn(contentPadding = PaddingValues(start = 16.dp, end = 16.dp, top = 32.dp, bottom = 24.dp), horizontalAlignment = Alignment.CenterHorizontally) {- item { ResultHead(ok, if (ok) Copy.DEBLOAT_DONE else Copy.DEBLOAT_PARTLY, Copy.DEBLOAT_RESULT_TEXT) }- if (off > 0) item { ResultRow(Copy.turnedOff(off, run.apps.size), null, groupShape(0, top + still.size)) }- itemsIndexed(still) { i, a -> ResultRow(Copy.stillOn(a.label), reason(run.failed.getValue(a.packageName)), groupShape(i + top, top + still.size)) }+ item { ResultHead(ok, if (ok) Copy.DEBLOAT_DONE.resolve() else Copy.DEBLOAT_PARTLY.resolve(), Copy.DEBLOAT_RESULT_TEXT.resolve()) }+ if (off > 0) item { ResultRow(Copy.turnedOff(off, run.apps.size).resolve(), null, groupShape(0, top + still.size)) }+ itemsIndexed(still) { i, a -> ResultRow(Copy.stillOn(a.label).resolve(), reason(run.failed.getValue(a.packageName)), groupShape(i + top, top + still.size)) }}}/** The TV's reason as a sentence. */-private fun reason(why: String) = why.replaceFirstChar(Char::uppercase).trimEnd('.') + "."+@Composable+private fun reason(why: UiText) = stringResource(R.string.result_reason, UiText.Capitalized(why).resolve().trimEnd('.'))diff --git a/app/src/main/java/app/tellyscope/ui/Details.kt b/app/src/main/java/app/tellyscope/ui/Details.ktindex 0da45ed..f6d776e 100644--- a/app/src/main/java/app/tellyscope/ui/Details.kt+++ b/app/src/main/java/app/tellyscope/ui/Details.kt@@ -23,7 +23,9 @@ import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clipimport androidx.compose.ui.draw.rotate+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.ui.theme.SmallNumber/**@@ -39,10 +41,11 @@ fun Details(rows: List<Pair<String, String>>, modifier: Modifier = Modifier) {Modifier.clip(MaterialTheme.shapes.small).clickable { open = !open }.padding(vertical = 4.dp),verticalAlignment = Alignment.CenterVertically,) {- Text("Details", style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary)+ Text(stringResource(R.string.details_title), style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary)Icon(Icons.Default.KeyboardArrowDown,- contentDescription = if (open) "Hide details" else "Show details",+ contentDescription = stringResource(if (open) R.string.details_hide else R.string.details_show),+Modifier.size(18.dp).rotate(if (open) 180f else 0f),tint = MaterialTheme.colorScheme.primary,)diff --git a/app/src/main/java/app/tellyscope/ui/DeviceIcons.kt b/app/src/main/java/app/tellyscope/ui/DeviceIcons.ktindex 43b9428..dbff0e4 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceIcons.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceIcons.kt@@ -4,12 +4,15 @@package app.tellyscope.ui+import androidx.compose.runtime.Composableimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.PathFillTypeimport androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.graphics.vector.PathParser+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.DeviceKind/** Generic device shapes in the Material style; no maker's logo or artwork. */@@ -66,9 +69,13 @@ object DeviceIcons {}/** Screen-reader name for the icon. */-fun DeviceKind.word() = when (this) {- DeviceKind.Tv -> "TV"- DeviceKind.Projector -> "Projector"- DeviceKind.FireTv -> "Fire TV"- DeviceKind.Stick -> "Streaming device"-}+@Composable+fun DeviceKind.word() = stringResource(+ when (this) {+ DeviceKind.Tv -> R.string.kind_tv+ DeviceKind.Projector -> R.string.kind_projector+ DeviceKind.FireTv -> R.string.kind_fire_tv+ DeviceKind.Stick -> R.string.kind_stick+ },+)+diff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.ktindex 66bf583..5a73e43 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt@@ -50,8 +50,11 @@ import androidx.compose.ui.draw.alphaimport androidx.compose.ui.draw.clipimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.asImageBitmap+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.adb.StatsProfileimport app.tellyscope.adb.TvFileimport app.tellyscope.adb.TvFolder@@ -63,6 +66,7 @@ import app.tellyscope.data.DeviceStateimport app.tellyscope.data.HistoryEntryimport app.tellyscope.data.Procimport app.tellyscope.data.Snapshot+import app.tellyscope.data.resolveimport app.tellyscope.ui.theme.SmallNumberdata class DeviceActions(@@ -157,16 +161,16 @@ internal fun SystemWidget(usedGb: Double?, totalGb: Double?, live: Snapshot?, as) {Column(Modifier.padding(16.dp)) {if (asOf != null) {- Text("As of $asOf", Modifier.padding(bottom = 8.dp), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.device_as_of, asOf), Modifier.padding(bottom = 8.dp), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)}val used = usedGbval total = totalGb?.takeIf { it > 0 }if (used != null && total != null) {Row {- Text("Internal storage", Modifier.weight(1f), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)- Text("${Copy.gbOf(used, total)} used", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.device_internal_storage), Modifier.weight(1f), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.device_gb_used, Copy.gbOf(used, total).resolve()), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)}- Copy.free(used, total)?.let { Text(it, style = MaterialTheme.typography.titleLarge) }+ Copy.free(used, total)?.let { Text(it.resolve(), style = MaterialTheme.typography.titleLarge) }val full = used / totalLinearProgressIndicator(progress = { full.toFloat().coerceIn(0f, 1f) },@@ -175,9 +179,9 @@ internal fun SystemWidget(usedGb: Double?, totalGb: Double?, live: Snapshot?, as)}Row {- Vital("CPU", live?.let { "${it.cpuPercent}%" } ?: dash, Modifier.weight(1f))- Vital("RAM", live?.takeIf { it.ramTotalMb > 0 }?.let { "${it.ramUsedMb * 100 / it.ramTotalMb}%" } ?: dash, Modifier.weight(1f), Alignment.CenterHorizontally)- Vital("Network", live?.netBytesPerSec?.let(Copy::speed) ?: dash, Modifier.weight(1f), Alignment.End)+ Vital(stringResource(R.string.device_cpu), live?.let { stringResource(R.string.device_percent, it.cpuPercent) } ?: dash, Modifier.weight(1f))+ Vital(stringResource(R.string.device_ram), live?.takeIf { it.ramTotalMb > 0 }?.let { stringResource(R.string.device_percent, it.ramUsedMb * 100 / it.ramTotalMb) } ?: dash, Modifier.weight(1f), Alignment.CenterHorizontally)+ Vital(stringResource(R.string.device_network), live?.netBytesPerSec?.let { Copy.speed(it).resolve() } ?: dash, Modifier.weight(1f), Alignment.End)}}}@@ -196,10 +200,10 @@ private fun Vital(label: String, value: String, modifier: Modifier = Modifier, afun UndoDisableDialog(entry: HistoryEntry, onDisable: () -> Unit, onDismiss: () -> Unit) {AlertDialog(onDismissRequest = onDismiss,- title = { Text("Disable ${entry.label}?") },- text = { Text(Copy.explain(Action.Disable, entry.label, entry.packageName)) },- confirmButton = { Button(onClick = onDisable) { Text(Copy.confirm(Action.Disable)) } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ title = { Text(stringResource(R.string.device_disable_title, entry.label)) },+ text = { Text(Copy.explain(Action.Disable, entry.label, entry.packageName).resolve()) },+ confirmButton = { Button(onClick = onDisable) { Text(Copy.confirm(Action.Disable).resolve()) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.device_cancel)) } },)}@@ -208,15 +212,12 @@ fun UndoDisableDialog(entry: HistoryEntry, onDisable: () -> Unit, onDismiss: ()fun RestoreDialog(count: Int, onRestore: () -> Unit, onDismiss: () -> Unit) {AlertDialog(onDismissRequest = onDismiss,- title = { Text("Turn $count ${if (count == 1) "app" else "apps"} back on?") },+ title = { Text(pluralStringResource(R.plurals.device_restore_title, count, count)) },text = {- Text(- "Turns back on every app Tellyscope disabled on this TV. " +- "Apps that were already off before Tellyscope's first change stay off.",- )+ Text(stringResource(R.string.device_restore_text))},- confirmButton = { Button(onClick = onRestore) { Text("Turn back on") } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ confirmButton = { Button(onClick = onRestore) { Text(stringResource(R.string.device_restore_button)) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.device_cancel)) } },)}@@ -237,10 +238,10 @@ fun RenameDialog(current: String, fallback: String, onSave: (String) -> Unit, onvar text by rememberSaveable { mutableStateOf(current) }AlertDialog(onDismissRequest = onDismiss,- title = { Text("Rename this TV") },+ title = { Text(stringResource(R.string.device_rename_title)) },text = {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text("Only this phone sees the name. Nothing on the TV changes.")+ Text(stringResource(R.string.device_rename_text))OutlinedTextField(value = text,onValueChange = { text = it.take(app.tellyscope.data.NameBook.MAX_LENGTH) },@@ -249,8 +250,8 @@ fun RenameDialog(current: String, fallback: String, onSave: (String) -> Unit, on)}},- confirmButton = { Button(onClick = { onSave(text) }) { Text("Save") } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ confirmButton = { Button(onClick = { onSave(text) }) { Text(stringResource(R.string.device_save)) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.device_cancel)) } },)}@@ -259,10 +260,10 @@ fun RenameDialog(current: String, fallback: String, onSave: (String) -> Unit, onfun ForgetDialog(name: String, onForget: () -> Unit, onDismiss: () -> Unit) {AlertDialog(onDismissRequest = onDismiss,- title = { Text("Forget $name?") },- text = { Text("Tellyscope stops reconnecting to it and removes it from this phone. Nothing on the TV changes. You can add it again from a scan.") },- confirmButton = { Button(onClick = onForget) { Text("Forget") } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ title = { Text(stringResource(R.string.device_forget_title, name)) },+ text = { Text(stringResource(R.string.device_forget_text)) },+ confirmButton = { Button(onClick = onForget) { Text(stringResource(R.string.device_forget)) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.device_cancel)) } },)}@@ -287,14 +288,14 @@ internal fun NotAllowedCard(onConnect: () -> Unit) {),) {Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {- CardTitle(Icons.Default.Warning, "The TV didn't allow this phone")+ CardTitle(Icons.Default.Warning, stringResource(R.string.device_not_allowed_title))Text(- "Its debugging access was turned off, reset, or denied. Tellyscope stopped asking so the TV isn't flooded with prompts.",+ stringResource(R.string.device_not_allowed_text),style = MaterialTheme.typography.bodyMedium,)- Button(onClick = onConnect) { Text("Connect again") }+ Button(onClick = onConnect) { Text(stringResource(R.string.device_connect_again)) }Text(- "Then press Allow on the TV, and tick \"Always allow from this computer\".",+ stringResource(R.string.device_not_allowed_hint),style = MaterialTheme.typography.bodySmall,)}@@ -321,14 +322,14 @@ internal fun OfflineCard(device: Device, now: Long, onReconnect: () -> Unit) {) {Row(Modifier.padding(16.dp), verticalAlignment = Alignment.CenterVertically) {Column(Modifier.weight(1f)) {- CardTitle(Icons.Default.Info, "Offline")+ CardTitle(Icons.Default.Info, stringResource(R.string.device_offline))Text(- "Last seen ${device.lastSeen?.let { Copy.ago(it, now) } ?: "a while ago"}. It reconnects on its own when the TV is back on.",+ stringResource(R.string.device_offline_text, device.lastSeen?.let { Copy.ago(it, now).resolve() } ?: stringResource(R.string.device_a_while_ago)),style = MaterialTheme.typography.bodyMedium,)}Spacer(Modifier.width(12.dp))- FilledTonalButton(onClick = onReconnect) { Text("Reconnect") }+ FilledTonalButton(onClick = onReconnect) { Text(stringResource(R.string.device_reconnect)) }}}}@@ -345,7 +346,7 @@ internal fun heaviest(snap: Snapshot, apps: List<AppInfo>): List<String> {@Composableinternal fun EmptyLine(q: String) {Text(- if (q.isEmpty()) "Nothing here yet." else "Nothing matches \"$q\".",+ if (q.isEmpty()) stringResource(R.string.device_nothing_here) else stringResource(R.string.device_nothing_matches, q),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,)@@ -380,20 +381,20 @@ fun UninstallDialog(app: AppInfo, onUninstall: () -> Unit, onDismiss: () -> UnitAlertDialog(onDismissRequest = onDismiss,icon = { Icon(Icons.Default.Delete, contentDescription = null, tint = MaterialTheme.colorScheme.error) },- title = { Text(Copy.uninstallTitle(app.label)) },+ title = { Text(Copy.uninstallTitle(app.label).resolve()) },text = {// The launcher on Home: what happens before it goes, in order.- val what = app.homeBack?.let { Copy.uninstallHome(app.label, it, app.homeService) } ?: Copy.explain(Action.Uninstall, app.label, app.packageName)- Text(what + if (app.listKeep) "\n\n${Copy.KEEP_WARNING}" else "")+ val what = (app.homeBack?.let { Copy.uninstallHome(app.label, it, app.homeService) } ?: Copy.explain(Action.Uninstall, app.label, app.packageName)).resolve()+ Text(what + if (app.listKeep) "\n\n${Copy.KEEP_WARNING.resolve()}" else "")},confirmButton = {Button(onClick = onUninstall,enabled = enabled,colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.error, contentColor = MaterialTheme.colorScheme.onError),- ) { Text(Copy.confirm(Action.Uninstall)) }+ ) { Text(Copy.confirm(Action.Uninstall).resolve()) }},- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.device_cancel)) } },)}@@ -415,11 +416,13 @@ internal fun AppRow(val launcher = app.answersHome || app.builtInLauncherval changeable = app.protectedReason == null || launcherval ram = procs.filter { it.packageName == app.packageName }.sumOf { it.ramMb }- val status = when {- !app.enabled -> "Disabled"- ram > 0 -> "Running"- else -> "Not running"- }+ val status = stringResource(+ when {+ !app.enabled -> R.string.device_app_disabled+ ram > 0 -> R.string.device_app_running+ else -> R.string.device_app_not_running+ },+ )Column(Modifier.fillMaxWidth().clip(MaterialTheme.shapes.large).clickable(enabled = changeable) { open = !open }.padding(vertical = 8.dp)) {Row(verticalAlignment = Alignment.CenterVertically) {AppIcon(app, Modifier.alpha(if (app.enabled) 1f else 0.4f))@@ -427,11 +430,11 @@ internal fun AppRow(Column(Modifier.weight(1f)) {Text(app.label, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)Text(- app.protectedReason?.let { "Protected: $it" } ?: status,+ app.protectedReason?.let { stringResource(R.string.device_app_protected, it.resolve()) } ?: status,style = MaterialTheme.typography.bodySmall,color = MaterialTheme.colorScheme.onSurfaceVariant,)- if (app.homeServiceOff) Text(Copy.SERVICE_OFF, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+ if (app.homeServiceOff) Text(Copy.SERVICE_OFF.resolve(), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}if (busy) androidx.compose.material3.LoadingIndicator(Modifier.size(32.dp))}@@ -444,17 +447,17 @@ internal fun AppRow(if (proposed == null) {if (app.protectedReason == null) {Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- if (app.enabled && ram > 0) OutlinedButton(onClick = { actions.propose(app.packageName, Action.Stop) }, enabled = !locked) { Text(Copy.button(Action.Stop)) }- if (app.enabled) OutlinedButton(onClick = { actions.propose(app.packageName, Action.Disable) }, enabled = !locked) { Text(Copy.button(Action.Disable)) }- else FilledTonalButton(onClick = { actions.propose(app.packageName, Action.Enable) }, enabled = !locked) { Text(Copy.button(Action.Enable)) }- if (app.removable) OutlinedButton(onClick = { actions.propose(app.packageName, Action.Uninstall) }, enabled = !locked) { Text(Copy.button(Action.Uninstall)) }+ if (app.enabled && ram > 0) OutlinedButton(onClick = { actions.propose(app.packageName, Action.Stop) }, enabled = !locked) { Text(Copy.button(Action.Stop).resolve()) }+ if (app.enabled) OutlinedButton(onClick = { actions.propose(app.packageName, Action.Disable) }, enabled = !locked) { Text(Copy.button(Action.Disable).resolve()) }+ else FilledTonalButton(onClick = { actions.propose(app.packageName, Action.Enable) }, enabled = !locked) { Text(Copy.button(Action.Enable).resolve()) }+ if (app.removable) OutlinedButton(onClick = { actions.propose(app.packageName, Action.Uninstall) }, enabled = !locked) { Text(Copy.button(Action.Uninstall).resolve()) }}} else if (launcher && app.removable) {// The launcher on Home: protected, but Uninstall still goes, Home moving first.- OutlinedButton(onClick = { actions.propose(app.packageName, Action.Uninstall) }, enabled = !locked) { Text(Copy.button(Action.Uninstall)) }+ OutlinedButton(onClick = { actions.propose(app.packageName, Action.Uninstall) }, enabled = !locked) { Text(Copy.button(Action.Uninstall).resolve()) }}if (launcher) TextButton(onClick = toHomeScreen) {- Text(Copy.HOME_SETTINGS)+ Text(Copy.HOME_SETTINGS.resolve())Spacer(Modifier.width(8.dp))Icon(Icons.AutoMirrored.Filled.ArrowForward, contentDescription = null, Modifier.size(18.dp))}@@ -462,13 +465,14 @@ internal fun AppRow(UninstallDialog(app, onUninstall = actions.confirm, onDismiss = actions.cancel, enabled = !locked)} else {Text(- if (app.listKeep && proposed != Action.Enable) Copy.explain(proposed, app.label, app.packageName) + "\n\n" + Copy.KEEP_WARNING- else Copy.explain(proposed, app.label, app.packageName),+ if (app.listKeep && proposed != Action.Enable) Copy.explain(proposed, app.label, app.packageName).resolve() + "\n\n" + Copy.KEEP_WARNING.resolve()+ else Copy.explain(proposed, app.label, app.packageName).resolve(),style = MaterialTheme.typography.bodyMedium,)Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- Button(onClick = actions.confirm, enabled = !locked) { Text(Copy.confirm(proposed)) }- TextButton(onClick = actions.cancel) { Text("Cancel") }+ Button(onClick = actions.confirm, enabled = !locked) { Text(Copy.confirm(proposed).resolve()) }+ TextButton(onClick = actions.cancel) { Text(stringResource(R.string.device_cancel)) }+}}}diff --git a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt b/app/src/main/java/app/tellyscope/ui/DeviceTabs.ktindex d13615e..2556170 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt@@ -5,6 +5,7 @@package app.tellyscope.uiimport androidx.activity.compose.BackHandler+import androidx.annotation.StringResimport androidx.compose.foundation.ExperimentalFoundationApiimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickable@@ -97,11 +98,14 @@ import androidx.compose.ui.graphics.vector.PathParserimport androidx.compose.ui.platform.LocalContextimport androidx.compose.ui.platform.LocalDensityimport androidx.compose.ui.platform.testTag+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.SpanStyleimport androidx.compose.ui.text.buildAnnotatedStringimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.withStyleimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.adb.StatsProfileimport app.tellyscope.adb.TvFolderimport app.tellyscope.data.Action@@ -110,10 +114,11 @@ import app.tellyscope.data.DeviceStateimport app.tellyscope.data.HistoryBookimport app.tellyscope.data.Snapshotimport app.tellyscope.data.Suggestions+import app.tellyscope.data.resolveimport kotlinx.coroutines.launch/** 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") }+enum class TvTab(@StringRes val label: Int) { Overview(R.string.tabs_overview), Apps(R.string.tabs_apps), Files(R.string.tabs_files), Tweaks(R.string.tabs_tweaks) }private object TabIcons {val Apps = icon(@@ -231,9 +236,9 @@ fun DeviceTabsScreen(// Each tab's main action as Material's extended FAB: the Remote on Overview, install on Apps, upload on Files.floatingActionButton = {if (!offline) when (tab) {- TvTab.Overview -> ExtendedFloatingActionButton(onClick = actions.remote, icon = { Icon(TileIcons.Remote, null) }, text = { Text("Remote") })- TvTab.Apps -> ExtendedFloatingActionButton(onClick = actions.pickApp, icon = { Icon(Icons.Default.Add, null) }, text = { Text("Install app") })- TvTab.Files -> ExtendedFloatingActionButton(onClick = { actions.pickFile(ui.files.folder) }, icon = { Icon(TileIcons.Upload, null) }, text = { Text("Upload files") })+ TvTab.Overview -> ExtendedFloatingActionButton(onClick = actions.remote, icon = { Icon(TileIcons.Remote, null) }, text = { Text(stringResource(R.string.tabs_remote)) })+ TvTab.Apps -> ExtendedFloatingActionButton(onClick = actions.pickApp, icon = { Icon(Icons.Default.Add, null) }, text = { Text(stringResource(R.string.tabs_install_app)) })+ TvTab.Files -> ExtendedFloatingActionButton(onClick = { actions.pickFile(ui.files.folder) }, icon = { Icon(TileIcons.Upload, null) }, text = { Text(stringResource(R.string.tabs_upload_files)) })else -> {}}},@@ -262,7 +267,7 @@ fun DeviceTabsScreen(tab = t},icon = { Icon(t.icon(), contentDescription = null) },- label = { Text(t.label) },+ label = { Text(stringResource(t.label)) },)}}@@ -316,9 +321,9 @@ fun DeviceTabsScreen(if (live != null) {item { SystemWidget(live) }} else if (offline && used != null && total != null) {- item { SystemWidget(used, total, null, asOf = device.lastSeen?.let { Copy.ago(it, state.clock()) } ?: "the last visit") }+ item { SystemWidget(used, total, null, asOf = device.lastSeen?.let { Copy.ago(it, state.clock()).resolve() } ?: stringResource(R.string.tabs_last_visit)) }} else if (offline) {- item { Muted(Copy.noStats(device.state)) }+ item { Muted(Copy.noStats(device.state).resolve()) }}if (!offline) {item {@@ -356,7 +361,7 @@ fun DeviceTabsScreen(} else {stickyHeader(key = "appsTabs") {PinnedSegments(- AppsTab.entries.map { it.label }, appsTab.ordinal,+ AppsTab.entries.map { stringResource(it.label) }, appsTab.ordinal,lerp(MaterialTheme.colorScheme.surface, MaterialTheme.colorScheme.surfaceContainer, collapse), inset = 16.dp,below = { SearchPill(enabled = !offline) { searching = true } },) { appsTab = AppsTab.entries[it] }@@ -369,7 +374,7 @@ fun DeviceTabsScreen(// Away, the TV can't say what's running, rather than nothing is.when {loading -> AppsLoading()- appsTab == AppsTab.Running && live == null -> EmptyState(DeviceIcons.Tv, Copy.TV_OFFLINE, Copy.RUNNING_OFFLINE)+ appsTab == AppsTab.Running && live == null -> EmptyState(DeviceIcons.Tv, Copy.TV_OFFLINE.resolve(), Copy.RUNNING_OFFLINE.resolve())else -> EmptyLine(q)}}@@ -385,28 +390,28 @@ fun DeviceTabsScreen(TvTab.Files -> {// Pinned under the bar once the hero has folded into it, like the Apps tabs.stickyHeader(key = "folders") {- PinnedSegments(TvFolder.entries.map(Copy::folder), ui.files.folder.ordinal, lerp(MaterialTheme.colorScheme.surface, MaterialTheme.colorScheme.surfaceContainer, collapse), inset = 16.dp) {+ PinnedSegments(TvFolder.entries.map { Copy.folder(it).resolve() }, ui.files.folder.ordinal, lerp(MaterialTheme.colorScheme.surface, MaterialTheme.colorScheme.surfaceContainer, collapse), inset = 16.dp) {if (!offline) actions.folder(TvFolder.entries[it])}}val folder = ui.files.folderwhen {- offline -> item { EmptyState(DeviceIcons.Tv, Copy.TV_OFFLINE, "Connect to the TV to see its files.") }+ offline -> item { EmptyState(DeviceIcons.Tv, Copy.TV_OFFLINE.resolve(), stringResource(R.string.tabs_files_offline)) }ui.files.error == null && ui.files.list?.isEmpty() == true -> item {EmptyState(if (folder == TvFolder.MOVIES) TileIcons.Movie else TabIcons.Folder,- "Nothing in ${Copy.folder(folder)} yet",- "Files you send land here.",+ stringResource(R.string.tabs_folder_empty, Copy.folder(folder).resolve()),+ stringResource(R.string.tabs_folder_empty_line),)}else -> item { FilesBlock(ui.files, state.clock(), actions) }}}TvTab.Tweaks -> {- if (offline) item { Muted("Connect to the TV to change its settings.") }+ if (offline) item { Muted(stringResource(R.string.tabs_tweaks_offline)) }else {- if (homeLaunchers(ui.apps).isNotEmpty()) item { Panel(Copy.HOME_SCREEN) { HomeScreenBlock(ui, actions, fire) } }- item { Panel(Copy.TWEAKS) { TweaksBlock(ui, actions) } }+ if (homeLaunchers(ui.apps).isNotEmpty()) item { Panel(Copy.HOME_SCREEN.resolve()) { HomeScreenBlock(ui, actions, fire) } }+ item { Panel(Copy.TWEAKS.resolve()) { TweaksBlock(ui, actions) } }}}}@@ -469,7 +474,7 @@ private fun AppMenu(state: UiState, actions: DeviceActions) {val fresh = state.historyNewIconButton(onClick = { open = true }) {// The access warning shows on ⋮ too, so it's there from every tab; it outranks a new change.- BadgedBox(badge = { MenuDot(others > 0, fresh) }) { Icon(Icons.Default.MoreVert, contentDescription = "More options") }+ BadgedBox(badge = { MenuDot(others > 0, fresh) }) { Icon(Icons.Default.MoreVert, contentDescription = stringResource(R.string.tabs_more_options)) }}if (!open) returnval sheet = rememberModalBottomSheetState(skipPartiallyExpanded = true)@@ -483,35 +488,35 @@ private fun AppMenu(state: UiState, actions: DeviceActions) {Spacer(Modifier.width(16.dp))Column {Text(name(device), style = MaterialTheme.typography.titleLarge)- val health = state.device.snapshot?.takeIf { device.state == DeviceState.Online }?.let { Copy.health(it, heaviest(it, state.device.apps)).text }+ val health = state.device.snapshot?.takeIf { device.state == DeviceState.Online }?.let { Copy.health(it, heaviest(it, state.device.apps)).text.resolve() }val line = listOf(makerLine(device), health.orEmpty()).filter { it.isNotEmpty() }.joinToString(" · ")if (line.isNotEmpty()) Text(line, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)}}val off = HistoryBook.leftDisabled(state.device.history).sizeSheetGroup(- { MenuRow(Icons.Default.Edit, "Rename this TV") { pick { renaming = true } } },- { MenuRow(HistoryIcons.History, Copy.HISTORY, Copy.stillOff(off).takeIf { off > 0 }, dot = { if (fresh) MenuDot(false, true) }) { pick(actions.history) } },+ { MenuRow(Icons.Default.Edit, stringResource(R.string.tabs_rename)) { pick { renaming = true } } },+ { MenuRow(HistoryIcons.History, Copy.HISTORY.resolve(), Copy.stillOff(off).resolve().takeIf { off > 0 }, dot = { if (fresh) MenuDot(false, true) }) { pick(actions.history) } },{MenuRow(- AccessIcons.Shield, Copy.WHO_HAS_ACCESS,- Copy.othersConnected(others).takeIf { others > 0 }, subColor = c.error,+ AccessIcons.Shield, Copy.WHO_HAS_ACCESS.resolve(),+ Copy.othersConnected(others).resolve().takeIf { others > 0 }, subColor = c.error,dot = { if (state.device.access?.warning == true) MenuDot(true, false) },) { pick(actions.whoHasAccess) }},- { MenuRow(Icons.Default.List, Copy.ADVANCED_MONITOR) { pick(actions.advanced) } },+ { MenuRow(Icons.Default.List, Copy.ADVANCED_MONITOR.resolve()) { pick(actions.advanced) } },)Text("Tellyscope", style = MaterialTheme.typography.labelLarge, color = c.onSurfaceVariant, modifier = Modifier.padding(start = 16.dp, top = 16.dp, bottom = 8.dp))SheetGroup(- { MenuRow(Icons.Default.Settings, "Settings") { pick(actions.settings) } },- { MenuRow(Icons.Default.Share, Copy.SHARE) { pick { shareTellyscope(context) } } },- { MenuRow(Icons.Default.Info, "About & licences") { pick { about = true } } },+ { MenuRow(Icons.Default.Settings, stringResource(R.string.tabs_settings)) { pick(actions.settings) } },+ { MenuRow(Icons.Default.Share, Copy.SHARE.resolve()) { pick { shareTellyscope(context) } } },+ { MenuRow(Icons.Default.Info, stringResource(R.string.tabs_about)) { pick { about = true } } },)Spacer(Modifier.height(16.dp))// Apart, and Forget in red, so neither is one slip from an everyday item.SheetGroup(- { MenuRow(HistoryIcons.History, Copy.RESET_TV, Copy.RESET_KEEPS) { pick(actions.reset) } },- { MenuRow(Icons.Default.Delete, "Forget this TV", tint = c.error) { pick { forgetting = true } } },+ { MenuRow(HistoryIcons.History, Copy.RESET_TV.resolve(), Copy.RESET_KEEPS.resolve()) { pick(actions.reset) } },+ { MenuRow(Icons.Default.Delete, stringResource(R.string.tabs_forget), tint = c.error) { pick { forgetting = true } } },)}}@@ -574,7 +579,7 @@ private fun SearchPill(enabled: Boolean, onClick: () -> Unit) {Row(Modifier.padding(horizontal = 16.dp, vertical = 14.dp), verticalAlignment = Alignment.CenterVertically) {Icon(Icons.Default.Search, contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.width(16.dp))- Text("Search apps", style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.tabs_search_apps), style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)}}}@@ -590,11 +595,11 @@ private fun SearchHeader(query: String, onQuery: (String) -> Unit, onClose: () -Column(Modifier.background(MaterialTheme.colorScheme.surface).statusBarsPadding().padding(horizontal = 16.dp, vertical = 8.dp)) {Surface(shape = CircleShape, color = MaterialTheme.colorScheme.surfaceContainerHigh, modifier = Modifier.fillMaxWidth()) {Row(verticalAlignment = Alignment.CenterVertically) {- IconButton(onClick = onClose) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Close search") }+ IconButton(onClick = onClose) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.tabs_close_search)) }TextField(value = query,onValueChange = onQuery,- placeholder = { Text("Search apps") },+ placeholder = { Text(stringResource(R.string.tabs_search_apps)) },singleLine = true,colors = TextFieldDefaults.colors(focusedContainerColor = Color.Transparent,@@ -604,7 +609,7 @@ private fun SearchHeader(query: String, onQuery: (String) -> Unit, onClose: () -),modifier = Modifier.weight(1f).focusRequester(focus),)- if (query.isNotEmpty()) IconButton(onClick = { onQuery("") }) { Icon(Icons.Default.Close, contentDescription = "Clear search") }+ if (query.isNotEmpty()) IconButton(onClick = { onQuery("") }) { Icon(Icons.Default.Close, contentDescription = stringResource(R.string.tabs_clear_search)) }}}}@@ -633,26 +638,26 @@ internal fun DebloatGate(launcher: Boolean, onChoose: () -> Unit, onApps: () ->AlertDialog(onDismissRequest = onDismiss,icon = { Icon(Broom, contentDescription = null) },- title = { Text(Copy.GATE_TITLE) },+ title = { Text(Copy.GATE_TITLE.resolve()) },text = {Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {- Text(Copy.GATE_DONE)- Text(if (launcher) Copy.GATE_LAUNCHER else Copy.GATE_APPS)+ Text(Copy.GATE_DONE.resolve())+ Text((if (launcher) Copy.GATE_LAUNCHER else Copy.GATE_APPS).resolve())}},// Three actions stack full width; two sit side by side.confirmButton = {if (launcher) {Column(Modifier.fillMaxWidth()) {- Button(onClick = onChoose, Modifier.fillMaxWidth()) { Text(Copy.CHOOSE_HOME) }- TextButton(onClick = onApps, Modifier.fillMaxWidth()) { Text(Copy.GO_TO_APPS) }- TextButton(onClick = onNeverAgain, Modifier.fillMaxWidth()) { Text(Copy.DONT_SHOW_AGAIN) }+ Button(onClick = onChoose, Modifier.fillMaxWidth()) { Text(Copy.CHOOSE_HOME.resolve()) }+ TextButton(onClick = onApps, Modifier.fillMaxWidth()) { Text(Copy.GO_TO_APPS.resolve()) }+ TextButton(onClick = onNeverAgain, Modifier.fillMaxWidth()) { Text(Copy.DONT_SHOW_AGAIN.resolve()) }}} else {- Button(onClick = onApps) { Text(Copy.GO_TO_APPS) }+ Button(onClick = onApps) { Text(Copy.GO_TO_APPS.resolve()) }}},- dismissButton = if (launcher) null else ({ TextButton(onClick = onNeverAgain) { Text(Copy.DONT_SHOW_AGAIN) } }),+ dismissButton = if (launcher) null else ({ TextButton(onClick = onNeverAgain) { Text(Copy.DONT_SHOW_AGAIN.resolve()) } }),)}@@ -675,46 +680,48 @@ internal fun debloatState(ui: DeviceUi): DebloatState {@Composableprivate 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"+ d.total == 0 -> stringResource(R.string.tabs_suggested_none, lists.list.name)+ d.on == 0 -> pluralStringResource(R.plurals.tabs_suggested_all_off, d.total, d.total)+ else -> pluralStringResource(R.plurals.tabs_suggested_some_off, d.total, d.total - d.on, d.total)}- is Suggestions.NoList -> "No list for this TV yet"- 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"+ is Suggestions.NoList -> stringResource(R.string.tabs_suggested_no_list)+ Suggestions.Unavailable -> stringResource(R.string.tabs_suggested_unavailable)+ null -> stringResource(if (offline) R.string.tabs_suggested_offline else R.string.tabs_suggested_loading)},Modifier.weight(1f),style = MaterialTheme.typography.bodyLarge,)- TextButton(onClick = onChanges) { Text("See changes") }+ TextButton(onClick = onChanges) { Text(stringResource(R.string.tabs_see_changes)) }}if (d.back > 0) {+ val required = stringResource(R.string.tabs_action_required)+ val cameBack = pluralStringResource(R.plurals.tabs_came_back_on, d.back, d.back)Text(buildAnnotatedString {- withStyle(SpanStyle(fontWeight = FontWeight.SemiBold)) { append("Action required: ") }- append("${apps(d.back)} came back on")+ withStyle(SpanStyle(fontWeight = FontWeight.SemiBold)) { append(required) }+ append(" ")+ append(cameBack)},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.NoList -> "Tap Debloat to pick the apps to turn off by hand."- lists is Suggestions.Ready && lists.byMaker -> "No list for this exact model, so these come from ${lists.list.name}'s other TVs."- lists is Suggestions.Ready && !d.todo -> "Debloat now opens Apps for one-off changes."+ lists is Suggestions.Unavailable -> stringResource(R.string.tabs_note_unavailable)+ lists is Suggestions.NoList -> stringResource(R.string.tabs_note_no_list)+ lists is Suggestions.Ready && lists.byMaker -> stringResource(R.string.tabs_note_by_maker, lists.list.name)+ lists is Suggestions.Ready && !d.todo -> stringResource(R.string.tabs_note_gate)else -> null}note?.let { Text(it, Modifier.padding(end = 8.dp), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant) }if (lists is Suggestions.Ready) {- Text("Lists adapted from cleanyourtv (MIT).", Modifier.padding(end = 8.dp), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(stringResource(R.string.tabs_lists_credit), Modifier.padding(end = 8.dp), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)}}}@@ -727,9 +734,10 @@ private fun AndroidCard(state: UiState, snap: Snapshot?, offline: Boolean, onUpdCard(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,+ device.android?.let { stringResource(R.string.tabs_android_version, it) } ?: "Android",+ (snap?.softwareMonth ?: device.lastKnown?.softwareMonth)?.let { stringResource(R.string.tabs_updated, Copy.month(it)) },+ stringResource(R.string.tabs_check_updates), !offline, onUpdates,+)}}diff --git a/app/src/main/java/app/tellyscope/ui/GuideCard.kt b/app/src/main/java/app/tellyscope/ui/GuideCard.ktindex 0fc9a9b..c760d7c 100644--- a/app/src/main/java/app/tellyscope/ui/GuideCard.kt+++ b/app/src/main/java/app/tellyscope/ui/GuideCard.kt@@ -2,6 +2,7 @@package app.tellyscope.ui+import androidx.annotation.StringResimport androidx.compose.animation.animateContentSizeimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.border@@ -30,64 +31,79 @@ import androidx.compose.material3.TextButtonimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.AnnotatedStringimport androidx.compose.ui.text.SpanStyleimport androidx.compose.ui.text.buildAnnotatedStringimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.withStyleimport androidx.compose.ui.unit.dp+import app.tellyscope.R/*** How to switch on debugging, per brand, because the menu names differ. [pair] is where the* pairing code lives on TVs with Wireless debugging; null where the brand only has the older switch.- * `**…**` marks the words to find on the TV.+ * `**…**` marks the words to find on the TV. [debugDone] is [debugTitle] once it's done.*/-class TvBrand(val name: String, val unlock: String, val debugTitle: String, val debug: String, val pair: String?)+class TvBrand(+ @StringRes val name: Int,+ @StringRes val unlock: Int,+ @StringRes val debugTitle: Int,+ @StringRes val debugDone: Int,+ @StringRes val debug: Int,+ @StringRes val pair: Int?,+)-private const val ANDROID_TV_PAIR = "**Device Preferences → Developer options → Wireless debugging → Pair device with pairing code**"+private val ANDROID_TV_PAIR = R.string.guide_pair_android_tvval brands = listOf(TvBrand(- "Google TV",- unlock = "On the TV: **Settings → System → About**. Press OK on **Android TV OS build** 7 times, until it says you're a developer.",- debugTitle = "Turn on Wireless debugging",- debug = "Back to **System → Developer options**. Turn on **Wireless debugging**. Older TVs call it **USB debugging**.",- pair = "**System → Developer options → Wireless debugging → Pair device with pairing code**",+ R.string.guide_brand_google_tv,+ unlock = R.string.guide_unlock_google_tv,+ debugTitle = R.string.guide_debug_title_wireless,+ debugDone = R.string.guide_debug_done_wireless,+ debug = R.string.guide_debug_google_tv,+ pair = R.string.guide_pair_google_tv,),TvBrand(- "Android TV",- unlock = "On the TV: **Settings → Device Preferences → About**. Press OK on **Build** 7 times.",- debugTitle = "Turn on Wireless debugging",- debug = "Back to **Device Preferences → Developer options**. Turn on **Wireless debugging**. Older TVs have **USB debugging** and **Network debugging** instead: turn on both.",+ R.string.guide_brand_android_tv,+ unlock = R.string.guide_unlock_build,+ debugTitle = R.string.guide_debug_title_wireless,+ debugDone = R.string.guide_debug_done_wireless,+ debug = R.string.guide_debug_android_tv,pair = ANDROID_TV_PAIR,),TvBrand(- "Fire TV",- unlock = "On the TV: **Settings → My Fire TV → About**. Press OK on the first row, your Fire TV's name, 7 times.",- debugTitle = "Turn on ADB debugging",- debug = "Back to **My Fire TV → Developer options**. Turn on **ADB debugging**.",+ R.string.guide_brand_fire_tv,+ unlock = R.string.guide_unlock_fire_tv,+ debugTitle = R.string.guide_debug_title_adb,+ debugDone = R.string.guide_debug_done_adb,+ debug = R.string.guide_debug_fire_tv,pair = null,),TvBrand(- "Xiaomi",- unlock = "On the TV: **Settings → Device Preferences → About**. Press OK on **Build** 7 times.",- debugTitle = "Turn on Wireless debugging",- debug = "Back to **Device Preferences → Developer options**. Turn on **Wireless debugging**. Older TVs call it **USB debugging**.",+ R.string.guide_brand_xiaomi,+ unlock = R.string.guide_unlock_build,+ debugTitle = R.string.guide_debug_title_wireless,+ debugDone = R.string.guide_debug_done_wireless,+ debug = R.string.guide_debug_xiaomi,pair = ANDROID_TV_PAIR,),TvBrand(- "XGIMI",- unlock = "On the TV: **Settings → Device Preferences → About**. Press OK on **Build** 7 times.",- debugTitle = "Turn on Wireless debugging",- debug = "Back to **Device Preferences → Developer options**. Turn on **Wireless debugging**. Older projectors have **USB debugging**, then **Network debugging** if it's listed: turn on both.",+ R.string.guide_brand_xgimi,+ unlock = R.string.guide_unlock_build,+ debugTitle = R.string.guide_debug_title_wireless,+ debugDone = R.string.guide_debug_done_wireless,+ debug = R.string.guide_debug_xgimi,pair = ANDROID_TV_PAIR,),TvBrand(- "Other",- unlock = "On the TV, open **Settings**. Has **System**? It's Google TV: go to **System → About** and press OK on **Android TV OS build** 7 times. Has **Device Preferences**? It's Android TV: go to **Device Preferences → About** and press OK on **Build** 7 times.",- debugTitle = "Turn on Wireless debugging",- debug = "Back one level, open **Developer options**. Turn on **Wireless debugging**. Older TVs have **USB debugging**, and some **Network debugging** too: turn on what's there.",- pair = "**Developer options → Wireless debugging → Pair device with pairing code**",+ R.string.guide_brand_other,+ unlock = R.string.guide_unlock_other,+ debugTitle = R.string.guide_debug_title_wireless,+ debugDone = R.string.guide_debug_done_wireless,+ debug = R.string.guide_debug_other,+ pair = R.string.guide_pair_other,),)@@ -96,13 +112,13 @@ val brands = listOf(@Composablefun BrandChips(brand: TvBrand, onPick: (TvBrand) -> Unit) {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text("Pick your TV", style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.guide_pick_tv), style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) {brands.forEach { b ->FilterChip(selected = b == brand,onClick = { onPick(b) },- label = { Text(b.name) },+ label = { Text(stringResource(b.name)) },leadingIcon = if (b == brand) ({ Icon(Icons.Default.Check, null, Modifier.size(18.dp)) }) else null,)}@@ -117,9 +133,9 @@ fun BrandChips(brand: TvBrand, onPick: (TvBrand) -> Unit) {@Composablefun GuideSteps(brand: TvBrand, step: Int, onStep: (Int) -> Unit, findTvs: @Composable () -> Unit) {val steps = listOf(- Triple("Unlock developer options", brand.unlock, "Developer options unlocked"),- Triple(brand.debugTitle, brand.debug, brand.debugTitle.removePrefix("Turn on ") + " on"),- Triple("Find your TV", "", ""),+ Triple(stringResource(R.string.guide_unlock_title), stringResource(brand.unlock), stringResource(R.string.guide_unlock_done)),+ Triple(stringResource(brand.debugTitle), stringResource(brand.debug), stringResource(brand.debugDone)),+ Triple(stringResource(R.string.guide_find_title), "", ""),)Column(Modifier.animateContentSize(MaterialTheme.motionScheme.defaultSpatialSpec())) {steps.forEachIndexed { i, (title, body, done) ->@@ -144,8 +160,8 @@ fun GuideSteps(brand: TvBrand, step: Int, onStep: (Int) -> Unit, findTvs: @Compoi == step -> {Text(marked(body), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)Row(Modifier.padding(top = 12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {- Button(onClick = { onStep(i + 1) }) { Text("Done, next") }- if (i > 0) TextButton(onClick = { onStep(i - 1) }) { Text("Back") }+ Button(onClick = { onStep(i + 1) }) { Text(stringResource(R.string.guide_done_next)) }+ if (i > 0) TextButton(onClick = { onStep(i - 1) }) { Text(stringResource(R.string.guide_back)) }}}}@@ -165,7 +181,7 @@ private fun StepDot(n: Int, done: Boolean, current: Boolean) {.border(2.dp, if (filled) c.primary else c.outlineVariant, CircleShape),contentAlignment = Alignment.Center,) {- if (done) Icon(Icons.Default.Check, contentDescription = "Done", Modifier.size(18.dp), tint = c.onPrimary)+ if (done) Icon(Icons.Default.Check, contentDescription = stringResource(R.string.guide_done), Modifier.size(18.dp), tint = c.onPrimary)else Text("$n", style = MaterialTheme.typography.labelLarge, color = if (current) c.onPrimary else c.outline)}}@@ -174,21 +190,22 @@ private fun StepDot(n: Int, done: Boolean, current: Boolean) {@Composablefun HelpDialog(brand: TvBrand, onAddByIp: () -> Unit, onDismiss: () -> Unit) {val tips = buildList {- add("Keep the phone and the TV on the same Wi-Fi. Guest networks often keep devices apart.")- add("Debugging switched itself off? Some TVs reset it after a restart. Turn it back on and this screen finds the TV again.")- if (brand.name == "Fire TV") add("No Developer options after 7 presses? Newer Fire TVs run Vega OS, which isn't Android, and Tellyscope can't reach them.")- add("Still nothing? Add the TV by its IP address, from the TV's network settings.")+ add(R.string.guide_tip_same_wifi)+ add(R.string.guide_tip_debugging_off)+ if (brand.name == R.string.guide_brand_fire_tv) add(R.string.guide_tip_vega)+ add(R.string.guide_tip_by_ip)}AlertDialog(onDismissRequest = onDismiss,- title = { Text("Can't find your TV?") },+ title = { Text(stringResource(R.string.guide_help_title)) },text = {Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {- tips.forEach { Text(it, style = MaterialTheme.typography.bodyMedium) }+ tips.forEach { Text(stringResource(it), style = MaterialTheme.typography.bodyMedium) }}},- confirmButton = { Button(onClick = { onDismiss(); onAddByIp() }) { Text("Add by IP address") } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Close") } },+ confirmButton = { Button(onClick = { onDismiss(); onAddByIp() }) { Text(stringResource(R.string.guide_add_by_ip)) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.guide_close)) } },+)}diff --git a/app/src/main/java/app/tellyscope/ui/HistoryScreen.kt b/app/src/main/java/app/tellyscope/ui/HistoryScreen.ktindex 4168992..380ef2e 100644--- a/app/src/main/java/app/tellyscope/ui/HistoryScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/HistoryScreen.kt@@ -50,10 +50,13 @@ import androidx.compose.ui.graphics.PathFillTypeimport androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.graphics.vector.PathParser+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.Actionimport app.tellyscope.data.HistoryBookimport app.tellyscope.data.HistoryEntry+import app.tellyscope.data.resolve/*** Every change Tellyscope made on the TV, newest first, each with its Undo, and Restore everything@@ -76,12 +79,12 @@ fun HistoryScreen(TopAppBar(title = {Column {- Text(Copy.HISTORY)+ Text(Copy.HISTORY.resolve())Text(name(device), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}},navigationIcon = {- IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back to the TV's page") }+ IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.screen_back_to_tv)) }},)},@@ -91,7 +94,7 @@ fun HistoryScreen(contentPadding = PaddingValues(start = 16.dp, end = 16.dp, bottom = 32.dp),) {item {- if (ui.history.isEmpty()) EmptyState(HistoryIcons.History, "Nothing changed yet", "Anything you stop, disable or turn on shows up here, with a way to undo it.")+ if (ui.history.isEmpty()) EmptyState(HistoryIcons.History, stringResource(R.string.history_empty_title), stringResource(R.string.history_empty_text))else HistoryList(ui.history, state.clock(), onUndo, restoring = ui.busy == RESTORING, onRestoreAll = onRestoreAll, busy = ui.busy != null)}}@@ -126,16 +129,16 @@ internal fun HistoryList(shape = MaterialTheme.shapes.large,) {Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text(Copy.stillOffTitle(off), style = MaterialTheme.typography.titleSmall)- Text(Copy.STILL_OFF_TEXT, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(Copy.stillOffTitle(off).resolve(), style = MaterialTheme.typography.titleSmall)+ Text(Copy.STILL_OFF_TEXT.resolve(), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.size(8.dp))FilledTonalButton(onClick = { confirming = true }, enabled = !busy) {if (restoring) {CircularProgressIndicator(Modifier.size(16.dp), strokeWidth = 2.dp, color = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.width(8.dp))- Text("Turning apps back on…")+ Text(stringResource(R.string.history_restoring))} else {- Text("Restore everything ($off)")+ Text(stringResource(R.string.history_restore_all, off))}}}@@ -147,8 +150,8 @@ internal fun HistoryList(Icon(HistoryIcons.of(h.action), contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.width(16.dp))Column(Modifier.weight(1f)) {- Text(Copy.done(h.action, h.label), style = MaterialTheme.typography.bodyLarge)- Text(Copy.ago(h.at, now), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(Copy.done(h.action, h.label).resolve(), style = MaterialTheme.typography.bodyLarge)+ Text(Copy.ago(h.at, now).resolve(), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}when {// Same button as Undo, switched off: the row keeps its shape and reads as done.@@ -159,9 +162,9 @@ internal fun HistoryList() {Icon(Icons.Default.Check, contentDescription = null, Modifier.size(18.dp))Spacer(Modifier.width(4.dp))- Text("Undone")+ Text(stringResource(R.string.history_undone))}- h.undo != null -> TextButton(onClick = { if (h.undo == Action.Disable) disabling = h else onUndo(h) }, enabled = !busy) { Text(Copy.undo(h.undo)) }+ h.undo != null -> TextButton(onClick = { if (h.undo == Action.Disable) disabling = h else onUndo(h) }, enabled = !busy) { Text(Copy.undo(h.undo).resolve()) }}}}diff --git a/app/src/main/java/app/tellyscope/ui/HomeScreenCard.kt b/app/src/main/java/app/tellyscope/ui/HomeScreenCard.ktindex b9808a1..c31387a 100644--- a/app/src/main/java/app/tellyscope/ui/HomeScreenCard.kt+++ b/app/src/main/java/app/tellyscope/ui/HomeScreenCard.kt@@ -34,10 +34,13 @@ import androidx.compose.ui.graphics.PathFillTypeimport androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.graphics.vector.PathParser+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.Actionimport app.tellyscope.data.AppInfo+import app.tellyscope.data.resolve/** The launchers the Home screen card lists: the one on Home, then the ones the user added, then the TV's own. */internal fun homeLaunchers(apps: List<AppInfo>): List<AppInfo> =@@ -71,7 +74,7 @@ fun HomeScreenBlock(ui: DeviceUi, actions: DeviceActions, fire: Boolean = false)val locked = ui.busy != nullif (launchers.any { it.packageName == ui.busy }) LinearProgressIndicator(Modifier.fillMaxWidth())if (current != null) {- Text(Copy.opensOnHome(current.label), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(Copy.opensOnHome(current.label).resolve(), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)} else {NoDefaultBanner()}@@ -88,9 +91,9 @@ fun HomeScreenBlock(ui: DeviceUi, actions: DeviceActions, fire: Boolean = false)// Only before a launcher was added: after that, the rows above are the way to switch.if (launchers.none { !it.system } && (hasPlayStore(ui.apps) || fire)) {Column(Modifier.fillMaxWidth().padding(top = 16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text(Copy.GET_LAUNCHER, style = MaterialTheme.typography.bodyLarge)- Text(if (fire) Copy.GET_PROJECTIVY_TEXT else Copy.GET_LAUNCHER_TEXT, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)- FilledTonalButton(onClick = actions.installLauncher, enabled = !locked) { Text(Copy.GET_LAUNCHER) }+ Text(Copy.GET_LAUNCHER.resolve(), style = MaterialTheme.typography.bodyLarge)+ Text((if (fire) Copy.GET_PROJECTIVY_TEXT else Copy.GET_LAUNCHER_TEXT).resolve(), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ FilledTonalButton(onClick = actions.installLauncher, enabled = !locked) { Text(Copy.GET_LAUNCHER.resolve()) }}}val (pkg, action) = ui.pending ?: return@@ -114,7 +117,7 @@ private fun NoDefaultBanner() {Row(Modifier.padding(horizontal = 12.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically) {Icon(HubIcons.InfoOutline, contentDescription = null, Modifier.size(20.dp), tint = MaterialTheme.colorScheme.onSecondaryContainer)Spacer(Modifier.width(8.dp))- Text(Copy.NO_DEFAULT, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSecondaryContainer)+ Text(Copy.NO_DEFAULT.resolve(), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSecondaryContainer)}}}@@ -124,9 +127,9 @@ private fun LauncherRow(app: AppInfo, move: Action?, locked: Boolean, onMove: (Avar turningOn by rememberSaveable(app.packageName) { mutableStateOf(false) }if (turningOn && app.homeServiceOff) {ServiceDialog(- app.label, app.homeBack ?: Copy.TV_OWN_LAUNCHER,+ app.label, app.homeBack ?: Copy.TV_OWN_LAUNCHER.resolve(),onTurnOn = { turningOn = false; onServiceOn() },- dismissLabel = Copy.NOT_NOW, onOther = { turningOn = false }, onDismiss = { turningOn = false },+ dismissLabel = Copy.NOT_NOW.resolve(), onOther = { turningOn = false }, onDismiss = { turningOn = false },)}Column {@@ -136,7 +139,7 @@ private fun LauncherRow(app: AppInfo, move: Action?, locked: Boolean, onMove: (AColumn(Modifier.weight(1f)) {Text(app.label, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)Text(- if (app.system) Copy.builtIn(off = !app.enabled) else Copy.ADDED,+ if (app.system) Copy.builtIn(off = !app.enabled).resolve() else Copy.ADDED.resolve(),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,)@@ -144,7 +147,7 @@ private fun LauncherRow(app: AppInfo, move: Action?, locked: Boolean, onMove: (ARow(verticalAlignment = Alignment.CenterVertically) {Icon(DeviceIcons.Accessibility, contentDescription = null, Modifier.size(14.dp), tint = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.width(4.dp))- Text(if (app.homeServiceOff) Copy.SERVICE_OFF else Copy.KEEPS_HOME, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(if (app.homeServiceOff) Copy.SERVICE_OFF.resolve() else Copy.KEEPS_HOME.resolve(), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}}}@@ -152,7 +155,7 @@ private fun LauncherRow(app: AppInfo, move: Action?, locked: Boolean, onMove: (ARow(Modifier.padding(start = 8.dp), verticalAlignment = Alignment.CenterVertically) {Icon(HubIcons.CheckCircleOutline, contentDescription = null, Modifier.size(18.dp), tint = MaterialTheme.colorScheme.primary)Spacer(Modifier.width(4.dp))- Text(Copy.CURRENT, style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary)+ Text(Copy.CURRENT.resolve(), style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary)}}}@@ -160,9 +163,9 @@ private fun LauncherRow(app: AppInfo, move: Action?, locked: Boolean, onMove: (Aval serviceOn = app.home && app.homeServiceOffif (move != null || serviceOn || app.removable) {Row(Modifier.padding(start = 52.dp, top = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {- if (move != null) FilledTonalButton(onClick = { onMove(move) }, enabled = !locked) { Text(Copy.MAKE_HOME) }- if (serviceOn) FilledTonalButton(onClick = { turningOn = true }, enabled = !locked) { Text(Copy.TURN_ON) }- if (app.removable) TextButton(onClick = onUninstall, enabled = !locked) { Text(Copy.button(Action.Uninstall)) }+ if (move != null) FilledTonalButton(onClick = { onMove(move) }, enabled = !locked) { Text(Copy.MAKE_HOME.resolve()) }+ if (serviceOn) FilledTonalButton(onClick = { turningOn = true }, enabled = !locked) { Text(Copy.TURN_ON.resolve()) }+ if (app.removable) TextButton(onClick = onUninstall, enabled = !locked) { Text(Copy.button(Action.Uninstall).resolve()) }}}}@@ -179,26 +182,26 @@ private fun MakeHomeDialog(app: AppInfo, action: Action, current: AppInfo?, appsvar askService by remember(app.packageName) { mutableStateOf(false) }if (askService) {ServiceDialog(- app.label, current?.label ?: replaced ?: Copy.TV_OWN_LAUNCHER,+ app.label, current?.label ?: replaced ?: Copy.TV_OWN_LAUNCHER.resolve(),onTurnOn = { actions.confirmHome(true) },- dismissLabel = Copy.SWITCH_WITHOUT, onOther = { actions.confirmHome(false) }, onDismiss = { askService = false },+ dismissLabel = Copy.SWITCH_WITHOUT.resolve(), onOther = { actions.confirmHome(false) }, onDismiss = { askService = false },)return}val currentService = current != null && current.homeService && !current.homeServiceOffval text = when {- action == Action.HomeBack && current != null -> Copy.explainLeave(app.label, off = !app.enabled, current.label, currentService, service = false)- fire && action == Action.Home && app.homeService && current != null -> Copy.explainFireHome(app.label, app.packageName, current.label)- current != null && !current.system -> Copy.explainLeave(app.label, off = false, current.label, currentService, app.homeService)- replaced != null && app.homeInstead != null -> Copy.explainReplace(app.label, replaced, app.homeInstead, app.homeService)- else -> Copy.explainFirstHome(app.label, app.packageName, app.homeService)+ action == Action.HomeBack && current != null -> Copy.explainLeave(app.label, off = !app.enabled, current.label, currentService, service = false).resolve()+ fire && action == Action.Home && app.homeService && current != null -> Copy.explainFireHome(app.label, app.packageName, current.label).resolve()+ current != null && !current.system -> Copy.explainLeave(app.label, off = false, current.label, currentService, app.homeService).resolve()+ replaced != null && app.homeInstead != null -> Copy.explainReplace(app.label, replaced, app.homeInstead, app.homeService).resolve()+ else -> Copy.explainFirstHome(app.label, app.packageName, app.homeService).resolve()}AlertDialog(onDismissRequest = actions.cancel,- title = { Text(Copy.makeHomeTitle(app.label)) },+ title = { Text(Copy.makeHomeTitle(app.label).resolve()) },text = { Text(text) },- confirmButton = { Button(onClick = if (asks) ({ askService = true }) else actions.confirm, enabled = !locked) { Text(Copy.MAKE_HOME) } },- dismissButton = { TextButton(onClick = actions.cancel) { Text("Cancel") } },+ confirmButton = { Button(onClick = if (asks) ({ askService = true }) else actions.confirm, enabled = !locked) { Text(Copy.MAKE_HOME.resolve()) } },+ dismissButton = { TextButton(onClick = actions.cancel) { Text(stringResource(R.string.screen_cancel)) } },)}diff --git a/app/src/main/java/app/tellyscope/ui/HomeServiceUi.kt b/app/src/main/java/app/tellyscope/ui/HomeServiceUi.ktindex 95e2379..36513f3 100644--- a/app/src/main/java/app/tellyscope/ui/HomeServiceUi.kt+++ b/app/src/main/java/app/tellyscope/ui/HomeServiceUi.kt@@ -35,6 +35,7 @@ import androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.platform.testTagimport androidx.compose.ui.unit.dpimport app.tellyscope.data.AppInfo+import app.tellyscope.data.resolve/*** The separate yes for a launcher's accessibility service, which can see the screen, so it is@@ -46,9 +47,9 @@ fun ServiceDialog(app: String, other: String, onTurnOn: () -> Unit, dismissLabelAlertDialog(onDismissRequest = onDismiss,icon = { Icon(DeviceIcons.Accessibility, contentDescription = null) },- title = { Text(Copy.serviceTitle(app)) },- text = { Text(Copy.explainService(app, other)) },- confirmButton = { Button(onClick = onTurnOn) { Text(Copy.TURN_IT_ON) } },+ title = { Text(Copy.serviceTitle(app).resolve()) },+ text = { Text(Copy.explainService(app, other).resolve()) },+ confirmButton = { Button(onClick = onTurnOn) { Text(Copy.TURN_IT_ON.resolve()) } },dismissButton = { TextButton(onClick = onOther) { Text(dismissLabel) } },)}@@ -62,14 +63,14 @@ fun ServiceOffCard(app: AppInfo, onTurnOn: () -> Unit, onDismiss: () -> Unit) {var asking by rememberSaveable { mutableStateOf(false) }if (asking) {ServiceDialog(- app.label, app.homeBack ?: Copy.TV_OWN_LAUNCHER,+ app.label, app.homeBack ?: Copy.TV_OWN_LAUNCHER.resolve(),onTurnOn = { asking = false; onTurnOn() },- dismissLabel = Copy.NOT_NOW, onOther = { asking = false }, onDismiss = { asking = false },+ dismissLabel = Copy.NOT_NOW.resolve(), onOther = { asking = false }, onDismiss = { asking = false },)}HomeNoteCard(- Icons.Default.Home, Copy.serviceOffTitle(app.homeBack), Copy.serviceOffText(app.label),- Copy.GOT_IT, onDismiss, Copy.TURN_ON, onAction = { asking = true },+ Icons.Default.Home, Copy.serviceOffTitle(app.homeBack).resolve(), Copy.serviceOffText(app.label).resolve(),+ Copy.GOT_IT.resolve(), onDismiss, Copy.TURN_ON.resolve(), onAction = { asking = true },modifier = Modifier.testTag("serviceOff"),)}diff --git a/app/src/main/java/app/tellyscope/ui/LauncherFlowUi.kt b/app/src/main/java/app/tellyscope/ui/LauncherFlowUi.ktindex c3eed9b..16a7bbb 100644--- a/app/src/main/java/app/tellyscope/ui/LauncherFlowUi.kt+++ b/app/src/main/java/app/tellyscope/ui/LauncherFlowUi.kt@@ -69,6 +69,7 @@ import androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.graphics.vector.PathParserimport androidx.compose.ui.platform.LocalUriHandler+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.semantics.Roleimport androidx.compose.ui.text.AnnotatedStringimport androidx.compose.ui.text.SpanStyle@@ -77,13 +78,17 @@ import androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.Actionimport app.tellyscope.data.AppInfoimport app.tellyscope.data.Deviceimport app.tellyscope.data.LauncherReleaseimport app.tellyscope.data.PROJECTIVYimport app.tellyscope.data.PROJECTIVY_RELEASES+import app.tellyscope.data.UiText+import app.tellyscope.data.asUiTextimport app.tellyscope.data.isFireOs+import app.tellyscope.data.resolveimport app.tellyscope.ui.theme.SmallNumber/** The Play Store's package: a TV without it gets no card and no Tweaks row, unless it runs Fire OS ([fireInstall]). */@@ -149,8 +154,8 @@ data class LauncherActions(@Composablefun LauncherCard(current: String?, onNotNow: () -> Unit, onChoose: () -> Unit, fire: Boolean = false) {HomeNoteCard(- Icons.Outlined.Home, Copy.BETTER_HOME, Copy.betterHomeText(current, fire), Copy.NOT_NOW, onNotNow,- if (fire) Copy.INSTALL_ONE else Copy.CHOOSE_ONE, onChoose,+ Icons.Outlined.Home, Copy.BETTER_HOME.resolve(), Copy.betterHomeText(current, fire).resolve(), Copy.NOT_NOW.resolve(), onNotNow,+ (if (fire) Copy.INSTALL_ONE else Copy.CHOOSE_ONE).resolve(), onChoose,)}@@ -200,7 +205,7 @@ fun LauncherScreen(ServiceDialog(app.label, current,onTurnOn = { switch(true) },- dismissLabel = Copy.SWITCH_WITHOUT, onOther = { switch(false) }, onDismiss = { askService = false },+ dismissLabel = Copy.SWITCH_WITHOUT.resolve(), onOther = { switch(false) }, onDismiss = { askService = false },)}Scaffold(@@ -213,12 +218,12 @@ fun LauncherScreen(flow.fireOs -> Copy.INSTALL_PROJECTIVYflow.step == LauncherFlow.Step.Pick -> Copy.CHOOSE_HOMEelse -> Copy.INSTALL_HOME- },+ }.resolve(),)},// Dimmed while it installs: stopping halfway could leave the TV half done.navigationIcon = {- IconButton(onClick = close, enabled = fire?.step != FireInstall.Step.Installing) { Icon(Icons.Default.Close, contentDescription = "Close") }+ IconButton(onClick = close, enabled = fire?.step != FireInstall.Step.Installing) { Icon(Icons.Default.Close, contentDescription = stringResource(R.string.launcher_close)) }},)},@@ -240,36 +245,36 @@ fun LauncherScreen(Row(Modifier.align(Alignment.CenterHorizontally), verticalAlignment = Alignment.CenterVertically) {Icon(Icons.Default.Check, null, Modifier.size(16.dp), tint = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.width(6.dp))- Text(Copy.STORE_RECOMMENDED, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(Copy.STORE_RECOMMENDED.resolve(), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)}}- IconButtonText(OpenInNew, Copy.GET_FROM_STORE, Modifier.fillMaxWidth()) { actions.install(chosen) }+ IconButtonText(OpenInNew, Copy.GET_FROM_STORE.resolve(), Modifier.fillMaxWidth()) { actions.install(chosen) }if (both) {- OutlinedButton(onClick = actions.fireCheck, enabled = flow.fire == null, modifier = Modifier.fillMaxWidth()) { Text(Copy.DOWNLOAD_DIRECTLY) }+ OutlinedButton(onClick = actions.fireCheck, enabled = flow.fire == null, modifier = Modifier.fillMaxWidth()) { Text(Copy.DOWNLOAD_DIRECTLY.resolve()) }}}// Home now, or a TV that can't take it as Home: only Open.!have.home && current != null -> {- TextButton(onClick = { actions.open(chosen) }) { Text(Copy.OPEN) }- IconButtonText(Icons.Outlined.Home, Copy.MAKE_HOME) { if (have.homeService) askService = true else switch(false) }+ TextButton(onClick = { actions.open(chosen) }) { Text(Copy.OPEN.resolve()) }+ IconButtonText(Icons.Outlined.Home, Copy.MAKE_HOME.resolve()) { if (have.homeService) askService = true else switch(false) }}- else -> IconButtonText(DeviceIcons.Tv, Copy.OPEN) { actions.open(chosen) }+ else -> IconButtonText(DeviceIcons.Tv, Copy.OPEN.resolve()) { actions.open(chosen) }}}- LauncherFlow.Step.Waiting -> TextButton(onClick = { actions.install(flow.pkg) }) { Text(Copy.OPEN_STORE_AGAIN) }+ LauncherFlow.Step.Waiting -> TextButton(onClick = { actions.install(flow.pkg) }) { Text(Copy.OPEN_STORE_AGAIN.resolve()) }LauncherFlow.Step.Installed -> {- TextButton(onClick = actions.later) { Text(Copy.NOT_NOW) }+ TextButton(onClick = actions.later) { Text(Copy.NOT_NOW.resolve()) }Button(onClick = { if (app?.homeService == true) askService = true else actions.switch(false) }, enabled = current != null) {- Text(Copy.confirm(Action.Home))+ Text(Copy.confirm(Action.Home).resolve())}}LauncherFlow.Step.NoStore -> {- TextButton(onClick = { actions.chooseAnother(flow.pkg) }) { Text(Copy.CHOOSE_ANOTHER) }- Button(onClick = { actions.install(flow.pkg) }) { Text(Copy.TRY_AGAIN) }+ TextButton(onClick = { actions.chooseAnother(flow.pkg) }) { Text(Copy.CHOOSE_ANOTHER.resolve()) }+ Button(onClick = { actions.install(flow.pkg) }) { Text(Copy.TRY_AGAIN.resolve()) }}LauncherFlow.Step.Left -> {- TextButton(onClick = { actions.chooseAnother(flow.pkg) }) { Text(Copy.CHOOSE_ANOTHER) }- Button(onClick = { actions.install(flow.pkg) }) { Text(Copy.OPEN_STORE_AGAIN) }+ TextButton(onClick = { actions.chooseAnother(flow.pkg) }) { Text(Copy.CHOOSE_ANOTHER.resolve()) }+ Button(onClick = { actions.install(flow.pkg) }) { Text(Copy.OPEN_STORE_AGAIN.resolve()) }}}}@@ -288,38 +293,38 @@ fun LauncherScreen(LauncherFlow.Step.Pick -> if (fire != null) FireBody(fire, device, actions.firePick) else Picker(chosen, apps, direct) { chosen = it }LauncherFlow.Step.Waiting -> {Hero(LauncherIcons.Download, c.secondaryContainer, c.onSecondaryContainer)- Headed(Copy.INSTALL_IT, bold(Copy.installItText(label), label, "Install"))+ Headed(Copy.INSTALL_IT.resolve(), bold(Copy.installItText(label).resolve(), label, stringResource(R.string.launcher_install_word)))Surface(shape = MaterialTheme.shapes.large, color = c.surfaceContainer, modifier = Modifier.fillMaxWidth()) {Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {Column {Text(label, style = MaterialTheme.typography.bodyLarge)- Text(Copy.storeOn(name(device)), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)+ Text(Copy.storeOn(name(device)).resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)}WaitingLine()}}- Text(Copy.DOWNLOADS_TAKE, style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(Copy.DOWNLOADS_TAKE.resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)}LauncherFlow.Step.Installed -> {Hero(Icons.Default.Check, c.secondaryContainer, c.onSecondaryContainer)val explain = if (app != null && current != null && app.homeInstead != null) {- " " + if (flow.fire != null) Copy.explainFireHome(app.label, app.packageName, current)- else Copy.explainHome(app.label, app.packageName, current, app.homeInstead, app.homeService)+ " " + if (flow.fire != null) Copy.explainFireHome(app.label, app.packageName, current).resolve()+ else Copy.explainHome(app.label, app.packageName, current, app.homeInstead, app.homeService).resolve()} else {""}- Headed(Copy.MAKE_IT_HOME, AnnotatedString(Copy.isInstalled(label) + explain))+ Headed(Copy.MAKE_IT_HOME.resolve(), AnnotatedString(Copy.isInstalled(label).resolve() + explain))}LauncherFlow.Step.NoStore -> {Hero(LauncherIcons.ErrorOutline, c.errorContainer, c.onErrorContainer)- Headed(Copy.NO_STORE, bold(Copy.noStoreText(name(device), label), label))+ Headed(Copy.NO_STORE.resolve(), bold(Copy.noStoreText(name(device), label).resolve(), label))Surface(shape = MaterialTheme.shapes.large, color = c.surfaceContainer, modifier = Modifier.fillMaxWidth()) {Box(Modifier.padding(16.dp)) { WaitingLine() }}}LauncherFlow.Step.Left -> {Hero(LauncherIcons.InfoOutline, c.surfaceContainerHighest, c.onSurfaceVariant)- Headed(Copy.notInstalled(label), AnnotatedString(Copy.NOT_INSTALLED_TEXT))+ Headed(Copy.notInstalled(label).resolve(), AnnotatedString(Copy.NOT_INSTALLED_TEXT.resolve()))}}}@@ -345,17 +350,20 @@ private fun Picker(chosen: String, apps: List<AppInfo>, direct: Boolean, onChoosval c = MaterialTheme.colorSchemeval others = otherLaunchers(apps)val canDownload = direct && RECOMMENDED.any { downloadable(it.pkg) && installedLauncher(apps, it.pkg) == null }- Text(if (canDownload) Copy.CHOOSE_HOME_TEXT + " " + Copy.CAN_DOWNLOAD else Copy.CHOOSE_HOME_TEXT, style = MaterialTheme.typography.bodyLarge)+ Text(+ if (canDownload) Copy.CHOOSE_HOME_TEXT.resolve() + " " + Copy.CAN_DOWNLOAD.resolve() else Copy.CHOOSE_HOME_TEXT.resolve(),+ style = MaterialTheme.typography.bodyLarge,+ )Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {if (others.isNotEmpty()) {- Text(Copy.ON_THIS_TV, style = MaterialTheme.typography.labelLarge, color = c.primary, modifier = Modifier.padding(bottom = 8.dp))+ Text(Copy.ON_THIS_TV.resolve(), style = MaterialTheme.typography.labelLarge, color = c.primary, modifier = Modifier.padding(bottom = 8.dp))Column(Modifier.selectableGroup().padding(bottom = 20.dp), verticalArrangement = Arrangement.spacedBy(2.dp)) {others.forEachIndexed { i, a ->PickRow(segment(i, others.lastIndex), a.packageName == chosen, a.label, a, vertical = 12.dp, onClick = { onChoose(a.packageName) })}}}- Text(Copy.RECOMMENDED, style = MaterialTheme.typography.labelLarge, color = c.primary, modifier = Modifier.padding(bottom = 8.dp))+ Text(Copy.RECOMMENDED.resolve(), style = MaterialTheme.typography.labelLarge, color = c.primary, modifier = Modifier.padding(bottom = 8.dp))Column(Modifier.selectableGroup(), verticalArrangement = Arrangement.spacedBy(2.dp)) {RECOMMENDED.forEachIndexed { i, l ->PickRow(segment(i, RECOMMENDED.lastIndex), l.pkg == chosen, l.name, installedLauncher(apps, l.pkg), onClick = { onChoose(l.pkg) }) {@@ -363,13 +371,13 @@ private fun Picker(chosen: String, apps: List<AppInfo>, direct: Boolean, onChoosRow(Modifier.padding(top = 4.dp), verticalAlignment = Alignment.CenterVertically) {Icon(if (l.accessibility) DeviceIcons.Accessibility else LauncherIcons.Code, null, Modifier.size(14.dp), tint = c.onSurfaceVariant)Spacer(Modifier.width(6.dp))- Text(if (l.accessibility) Copy.USES_SERVICE else Copy.NO_SERVICE, style = MaterialTheme.typography.labelMedium, color = c.onSurfaceVariant)+ Text(if (l.accessibility) Copy.USES_SERVICE.resolve() else Copy.NO_SERVICE.resolve(), style = MaterialTheme.typography.labelMedium, color = c.onSurfaceVariant)}}}}- Text(Copy.OTHER_LAUNCHER, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant, modifier = Modifier.padding(top = 12.dp))- Text(Copy.NOT_AFFILIATED, style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant, modifier = Modifier.padding(top = 12.dp))+ Text(Copy.OTHER_LAUNCHER.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant, modifier = Modifier.padding(top = 12.dp))+ Text(Copy.NOT_AFFILIATED.resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant, modifier = Modifier.padding(top = 12.dp))}}@@ -377,7 +385,7 @@ private fun Picker(chosen: String, apps: List<AppInfo>, direct: Boolean, onChoos@Composableprivate fun FirePick() {val c = MaterialTheme.colorScheme- Text(Copy.FIRE_INSTALL_TEXT, style = MaterialTheme.typography.bodyLarge, color = c.onSurfaceVariant)+ Text(Copy.FIRE_INSTALL_TEXT.resolve(), style = MaterialTheme.typography.bodyLarge, color = c.onSurfaceVariant)val l = RECOMMENDED.firstOrNull { it.pkg == PROJECTIVY } ?: returnSurface(shape = MaterialTheme.shapes.large, color = c.surfaceContainer, modifier = Modifier.fillMaxWidth()) {Column(Modifier.padding(16.dp)) {@@ -386,7 +394,7 @@ private fun FirePick() {Row(Modifier.padding(top = 4.dp), verticalAlignment = Alignment.CenterVertically) {Icon(if (l.accessibility) DeviceIcons.Accessibility else LauncherIcons.Code, null, Modifier.size(14.dp), tint = c.onSurfaceVariant)Spacer(Modifier.width(6.dp))- Text(if (l.accessibility) Copy.USES_SERVICE else Copy.NO_SERVICE, style = MaterialTheme.typography.labelMedium, color = c.onSurfaceVariant)+ Text((if (l.accessibility) Copy.USES_SERVICE else Copy.NO_SERVICE).resolve(), style = MaterialTheme.typography.labelMedium, color = c.onSurfaceVariant)}}}@@ -410,50 +418,50 @@ private fun FireBody(f: FireInstall, device: Device, onPick: () -> Unit) {when (f.step) {null, FireInstall.Step.Checking, FireInstall.Step.Confirm -> if (f.store) {WarningBadge()- Text(Copy.downloadDirectly(label), style = MaterialTheme.typography.headlineMedium)- Text(Copy.downloadsFrom(label), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)+ Text(Copy.downloadDirectly(label).resolve(), style = MaterialTheme.typography.headlineMedium)+ Text(Copy.downloadsFrom(label).resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)release?.let { SourceRow(it, openPage) }- Text(Copy.DIRECT_CHECK, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)- Text(Copy.STORE_SAFER, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)+ Text(Copy.DIRECT_CHECK.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)+ Text(Copy.STORE_SAFER.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)} else {FirePick()if (release != null) {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(Copy.WHERE_FROM, style = MaterialTheme.typography.labelLarge, color = c.primary)+ Text(Copy.WHERE_FROM.resolve(), style = MaterialTheme.typography.labelLarge, color = c.primary)SourceRow(release, openPage)}- Text(Copy.SIGNED_CHECK, style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(Copy.SIGNED_CHECK.resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)}}FireInstall.Step.Downloading, FireInstall.Step.Reading, FireInstall.Step.Installing -> {- Text(Copy.installing(label), style = MaterialTheme.typography.labelLarge, color = c.primary)+ Text(Copy.installing(label).resolve(), style = MaterialTheme.typography.labelLarge, color = c.primary)FireSteps(f, device)- Text(Copy.INSTALL_KEEP_OPEN, style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(Copy.INSTALL_KEEP_OPEN.resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)}FireInstall.Step.NotProjectivy -> {Hero(LauncherIcons.ErrorOutline, c.errorContainer, c.onErrorContainer)Headed(- if (f.picked) Copy.NOT_PROJECTIVY_FILE else Copy.NOT_PROJECTIVY,- AnnotatedString(if (f.picked) Copy.NOT_PROJECTIVY_FILE_TEXT else Copy.NOT_PROJECTIVY_TEXT),+ (if (f.picked) Copy.NOT_PROJECTIVY_FILE else Copy.NOT_PROJECTIVY).resolve(),+ AnnotatedString((if (f.picked) Copy.NOT_PROJECTIVY_FILE_TEXT else Copy.NOT_PROJECTIVY_TEXT).resolve()),)FireSteps(f, device)- if (f.store) Text(Copy.STORE_INSTEAD, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)+ if (f.store) Text(Copy.STORE_INSTEAD.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant)}FireInstall.Step.NoDownload -> {Hero(LauncherIcons.ErrorOutline, c.errorContainer, c.onErrorContainer)val text = if (f.until != null) Copy.noDownloadLimited(clockTime(f.until)) else Copy.NO_DOWNLOAD_OFFLINE- Headed(Copy.NO_DOWNLOAD, AnnotatedString(text))+ Headed(Copy.NO_DOWNLOAD.resolve(), AnnotatedString(text.resolve()))Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(Copy.OR_YOURSELF, style = MaterialTheme.typography.labelLarge, color = c.primary)+ Text(Copy.OR_YOURSELF.resolve(), style = MaterialTheme.typography.labelLarge, color = c.primary)Surface(shape = MaterialTheme.shapes.large, color = c.surfaceContainer, modifier = Modifier.fillMaxWidth()) {Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {Numbered(1) {- Text(Copy.YOURSELF_PAGE, style = MaterialTheme.typography.bodyMedium)+ Text(Copy.YOURSELF_PAGE.resolve(), style = MaterialTheme.typography.bodyMedium)SourceRow(release, openPage)}Numbered(2) {- Text(Copy.yourselfPick(release?.apk?.substringAfterLast('/')), style = MaterialTheme.typography.bodyMedium)- FilledTonalButton(onClick = onPick, modifier = Modifier.fillMaxWidth()) { Text(Copy.PICK_DOWNLOADED) }+ Text(Copy.yourselfPick(release?.apk?.substringAfterLast('/')).resolve(), style = MaterialTheme.typography.bodyMedium)+ FilledTonalButton(onClick = onPick, modifier = Modifier.fillMaxWidth()) { Text(Copy.PICK_DOWNLOADED.resolve()) }}}}@@ -461,7 +469,7 @@ private fun FireBody(f: FireInstall, device: Device, onPick: () -> Unit) {}FireInstall.Step.Refused -> {Hero(LauncherIcons.ErrorOutline, c.errorContainer, c.onErrorContainer)- Headed(Copy.cantInstall(label), AnnotatedString(f.error.orEmpty()))+ Headed(Copy.cantInstall(label).resolve(), AnnotatedString(f.error?.resolve().orEmpty()))}}}@@ -473,29 +481,29 @@ private fun FireButtons(f: FireInstall, actions: LauncherActions, modifier: ModiColumn(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {val wide = Modifier.fillMaxWidth()when (f.step) {- null, FireInstall.Step.Checking -> IconButtonText(LauncherIcons.Download, Copy.INSTALL_PROJECTIVY, wide, enabled = f.step == null, onClick = actions.fireCheck)+ null, FireInstall.Step.Checking -> IconButtonText(LauncherIcons.Download, Copy.INSTALL_PROJECTIVY.resolve(), wide, enabled = f.step == null, onClick = actions.fireCheck)// The safe way first and filled; the download only as the outlined second.FireInstall.Step.Confirm -> if (f.store) {- IconButtonText(OpenInNew, Copy.GET_FROM_STORE, wide, onClick = store)- OutlinedButton(onClick = actions.fireInstall, modifier = wide) { Text(Copy.DOWNLOAD_ANYWAY) }+ IconButtonText(OpenInNew, Copy.GET_FROM_STORE.resolve(), wide, onClick = store)+ OutlinedButton(onClick = actions.fireInstall, modifier = wide) { Text(Copy.DOWNLOAD_ANYWAY.resolve()) }} else {- IconButtonText(LauncherIcons.Download, Copy.DOWNLOAD_AND_INSTALL, wide, onClick = actions.fireInstall)+ IconButtonText(LauncherIcons.Download, Copy.DOWNLOAD_AND_INSTALL.resolve(), wide, onClick = actions.fireInstall)}FireInstall.Step.Downloading, FireInstall.Step.Reading, FireInstall.Step.Installing -> UnitFireInstall.Step.NotProjectivy -> when {f.picked -> Row(wide, horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {- TextButton(onClick = actions.firePick) { Text(Copy.PICK_ANOTHER) }- Button(onClick = actions.fireCheck) { Text(Copy.TRY_DOWNLOAD_AGAIN) }+ TextButton(onClick = actions.firePick) { Text(Copy.PICK_ANOTHER.resolve()) }+ Button(onClick = actions.fireCheck) { Text(Copy.TRY_DOWNLOAD_AGAIN.resolve()) }}- f.store -> IconButtonText(OpenInNew, Copy.GET_FROM_STORE, wide, onClick = store)- else -> Button(onClick = actions.fireCheck, modifier = wide) { Text(Copy.TRY_AGAIN) }+ f.store -> IconButtonText(OpenInNew, Copy.GET_FROM_STORE.resolve(), wide, onClick = store)+ else -> Button(onClick = actions.fireCheck, modifier = wide) { Text(Copy.TRY_AGAIN.resolve()) }}FireInstall.Step.NoDownload -> Row(wide, horizontalArrangement = Arrangement.End) {- Button(onClick = actions.fireCheck) { Text(Copy.TRY_AGAIN) }+ Button(onClick = actions.fireCheck) { Text(Copy.TRY_AGAIN.resolve()) }}FireInstall.Step.Refused -> Row(wide, horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {- if (f.picked) TextButton(onClick = actions.firePick) { Text(Copy.PICK_ANOTHER) }- Button(onClick = actions.fireDismiss) { Text("OK") }+ if (f.picked) TextButton(onClick = actions.firePick) { Text(Copy.PICK_ANOTHER.resolve()) }+ Button(onClick = actions.fireDismiss) { Text(stringResource(R.string.launcher_ok)) }}}}@@ -562,7 +570,7 @@ private fun FireSteps(f: FireInstall, device: Device) {@OptIn(ExperimentalMaterial3ExpressiveApi::class)@Composable-private fun StepLine(n: Int, mark: StepMark, title: String, text: String? = null, below: @Composable () -> Unit = {}) {+private fun StepLine(n: Int, mark: StepMark, title: UiText, text: UiText? = null, below: @Composable () -> Unit = {}) {val c = MaterialTheme.colorSchemeRow(horizontalArrangement = Arrangement.spacedBy(12.dp)) {Box(Modifier.size(24.dp), contentAlignment = Alignment.Center) {@@ -580,8 +588,8 @@ private fun StepLine(n: Int, mark: StepMark, title: String, text: String? = null}}Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text(title, style = MaterialTheme.typography.bodyLarge, color = if (mark == StepMark.Todo) c.onSurfaceVariant else c.onSurface)- text?.let { Text(it, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant) }+ Text(title.resolve(), style = MaterialTheme.typography.bodyLarge, color = if (mark == StepMark.Todo) c.onSurfaceVariant else c.onSurface)+ text?.let { Text(it.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant) }below()}}@@ -592,10 +600,10 @@ private fun StepLine(n: Int, mark: StepMark, title: String, text: String? = nullprivate fun StopDialog(onKeep: () -> Unit, onStop: () -> Unit) {AlertDialog(onDismissRequest = onKeep,- title = { Text(Copy.STOP_TITLE) },- text = { Text(Copy.STOP_TEXT) },- confirmButton = { Button(onClick = onKeep) { Text(Copy.KEEP_DOWNLOADING) } },- dismissButton = { TextButton(onClick = onStop) { Text(Copy.STOP) } },+ title = { Text(Copy.STOP_TITLE.resolve()) },+ text = { Text(Copy.STOP_TEXT.resolve()) },+ confirmButton = { Button(onClick = onKeep) { Text(Copy.KEEP_DOWNLOADING.resolve()) } },+ dismissButton = { TextButton(onClick = onStop) { Text(Copy.STOP.resolve()) } },)}@@ -624,7 +632,7 @@ private fun SourceRow(release: LauncherRelease?, onOpen: () -> Unit) {Spacer(Modifier.width(12.dp))Column(Modifier.weight(1f)) {Text(PROJECTIVY_SOURCE, style = MaterialTheme.typography.bodyMedium, color = c.primary, maxLines = 1, overflow = TextOverflow.Ellipsis)- Text(release?.let { Copy.release(it.version, it.size) } ?: Copy.LATEST_RELEASE, style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text((release?.let { Copy.release(it.version, it.size) } ?: Copy.LATEST_RELEASE).resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)}Spacer(Modifier.width(8.dp))Icon(OpenInNew, null, Modifier.size(18.dp), tint = c.primary)@@ -694,7 +702,7 @@ private fun InstalledChip(home: Boolean) {Row(Modifier.height(24.dp).padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {Icon(if (home) Icons.Outlined.Home else Icons.Default.Check, null, Modifier.size(14.dp))Spacer(Modifier.width(4.dp))- Text(if (home) Copy.HOME_NOW else Copy.INSTALLED, style = MaterialTheme.typography.labelMedium)+ Text(if (home) Copy.HOME_NOW.resolve() else Copy.INSTALLED.resolve(), style = MaterialTheme.typography.labelMedium)}}}@@ -721,7 +729,7 @@ private fun WaitingLine() {Row(verticalAlignment = Alignment.CenterVertically) {LoadingIndicator(Modifier.size(24.dp))Spacer(Modifier.width(12.dp))- Text(Copy.WAITING_INSTALL, style = MaterialTheme.typography.bodyMedium)+ Text(Copy.WAITING_INSTALL.resolve(), style = MaterialTheme.typography.bodyMedium)}}diff --git a/app/src/main/java/app/tellyscope/ui/ListsCard.kt b/app/src/main/java/app/tellyscope/ui/ListsCard.ktindex a32c072..b8a7485 100644--- a/app/src/main/java/app/tellyscope/ui/ListsCard.kt+++ b/app/src/main/java/app/tellyscope/ui/ListsCard.kt@@ -67,12 +67,15 @@ import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.platform.LocalContextimport androidx.compose.ui.platform.LocalSoftwareKeyboardControllerimport androidx.compose.ui.platform.LocalUriHandler+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.semantics.Roleimport androidx.compose.ui.state.ToggleableStateimport androidx.compose.ui.text.input.ImeActionimport androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.LayoutDirectionimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.AppInfoimport app.tellyscope.data.Deviceimport app.tellyscope.data.DeviceKind@@ -149,7 +152,7 @@ fun DebloatScreen(showing != null -> showing.groupslists is Suggestions.NoList -> listOf(SuggestedGroup(- "Apps on this TV",+ stringResource(R.string.lists_apps_on_tv),tvApps.filter { it.enabled && it.protectedReason == null && !it.builtInLauncher }.sortedBy { it.label.lowercase() }.map { Suggested(it.packageName, it.label, note = null, optional = false, ticked = false) },),@@ -170,9 +173,9 @@ fun DebloatScreen(snackbarHost = { SnackbarHost(snackbar) },topBar = {TopAppBar(- title = { Text(if (searching) "Which TV is this?" else "Debloat") },+ title = { Text(stringResource(if (searching) R.string.lists_which_tv else R.string.lists_debloat)) },navigationIcon = {- IconButton(onClick = goBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") }+ IconButton(onClick = goBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.lists_back)) }},)},@@ -181,13 +184,13 @@ fun DebloatScreen(Surface(tonalElevation = 3.dp, modifier = Modifier.imePadding()) {Box(Modifier.fillMaxWidth().navigationBarsPadding().padding(16.dp)) {if (searching) {- Button(onClick = use, enabled = marked != null, modifier = Modifier.fillMaxWidth()) { Text("Use this list") }+ Button(onClick = use, enabled = marked != null, modifier = Modifier.fillMaxWidth()) { Text(stringResource(R.string.lists_use_this)) }} else {Button(onClick = { confirming = true },enabled = groups != null && ticked.isNotEmpty() && !busy,modifier = Modifier.fillMaxWidth(),- ) { Text("Disable ${ticked.size} ${if (ticked.size == 1) "app" else "apps"}") }+ ) { Text(pluralStringResource(R.plurals.lists_disable_apps, ticked.size, ticked.size)) }}}}@@ -202,10 +205,10 @@ fun DebloatScreen(item {OutlinedTextField(q, { typed = it },- placeholder = { Text("Brand or model") },+ placeholder = { Text(stringResource(R.string.lists_brand_or_model)) },leadingIcon = { Icon(Icons.Filled.Search, contentDescription = null) },trailingIcon = {- if (q.isNotEmpty()) IconButton(onClick = { typed = "" }) { Icon(Icons.Filled.Clear, contentDescription = "Clear search") }+ if (q.isNotEmpty()) IconButton(onClick = { typed = "" }) { Icon(Icons.Filled.Clear, contentDescription = stringResource(R.string.lists_clear_search)) }},singleLine = true,// The keyboard's action key closes it, and moves on once a TV is picked.@@ -222,7 +225,7 @@ fun DebloatScreen(items(shown, key = { it.id }) { d -> ListRow(d, makers.getValue(d.id), d.id == marked) { marked = d.id } }return@LazyColumn}- if (missed != null) item { Muted("No list for \u201c$missed\u201d. Pick the closest model.") }+ if (missed != null) item { Muted(stringResource(R.string.lists_no_match, missed)) }// Only a connected TV can say which apps it came with.if (missed != null && tv?.state == DeviceState.Online) item { HelpAddCard(onHelpAdd) }// Every list, by maker, with the maker in view while scrolling.@@ -244,8 +247,8 @@ fun DebloatScreen(if (groups == null) {item {Muted(- if (lists == Suggestions.Unavailable) "Couldn't load that list. Check the phone's internet and try again."- else "Loading the list…",+ if (lists == Suggestions.Unavailable) stringResource(R.string.lists_unavailable)+ else stringResource(R.string.lists_loading),)}return@LazyColumn@@ -255,33 +258,35 @@ fun DebloatScreen(val entry = showing?.let { r -> devices.firstOrNull { it.id == r.list.id } ?: devices.firstOrNull { squash(makers.getValue(it.id)) == squash(r.list.name) } }val kind = entry?.let { listKind(it, makers.getValue(it.id)) } ?: tv?.let(::deviceKind) ?: DeviceKind.Tvwhen {- showing == null -> MatchCard(kind, tv?.let(::name) ?: "This TV", "No list for this TV or its maker yet", Match.None) { marked = null; searching = true }- showing.byMaker -> MatchCard(kind, showing.list.name, "No list for this model, so these come from ${showing.list.name}'s other models", Match.Loose) { marked = null; searching = true }- showing.sdkMatches -> MatchCard(kind, showing.list.name, "This model's list · tested on ${showing.list.testedOs ?: showing.sdk?.let(::androidName)}", Match.Exact) { marked = null; searching = true }+ showing == null -> MatchCard(kind, tv?.let(::name) ?: stringResource(R.string.lists_this_tv), stringResource(R.string.lists_match_none), Match.None) { marked = null; searching = true }+ showing.byMaker -> MatchCard(kind, showing.list.name, stringResource(R.string.lists_match_by_maker, showing.list.name), Match.Loose) { marked = null; searching = true }+ showing.sdkMatches -> MatchCard(kind, showing.list.name, stringResource(R.string.lists_match_exact, (showing.list.testedOs ?: showing.sdk?.let(::androidName)).toString()), Match.Exact) { marked = null; searching = true }else -> MatchCard(kind, showing.list.name,- showing.list.testedOs?.let { "This model's list, tested on $it, not this TV's Android" }- ?: "This model's list, with no Android it was tested on",+ showing.list.testedOs?.let { stringResource(R.string.lists_match_other_android, it) }+ ?: stringResource(R.string.lists_match_no_android),Match.Loose,) { marked = null; searching = true }}Text(- when {- showing == null -> "Tick the apps to turn off. Apps the TV needs to run aren't shown."- showing.sdkMatches && !showing.byMaker -> "These apps will be turned off. Untick any you use."- else -> "Nothing is ticked: tick only the apps you know you don't use."- } + " Nothing is deleted, and History can turn each one back on.",+ stringResource(+ when {+ showing == null -> R.string.lists_intro_by_hand+ showing.sdkMatches && !showing.byMaker -> R.string.lists_intro_ticked+ else -> R.string.lists_intro_unticked+ },+ ) + " " + stringResource(R.string.lists_intro_undo),style = MaterialTheme.typography.bodyMedium,modifier = Modifier.padding(top = 12.dp),)// Nobody should debloat from a list they didn't mean to use.if (source != null && showing != null) Text(- "This list comes from ${sourceName(source)}, not tellyscope-devices.",+ stringResource(R.string.lists_custom_source, sourceName(source)),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.error,)if (groups.all { it.packages.isEmpty() }) {- Muted(if (showing == null) "Every app left on is one the TV needs." else "Nothing on the list is still on here.")+ Muted(stringResource(if (showing == null) R.string.lists_all_needed else R.string.lists_all_off))}}// A list's groups are a tree: each heading ticks its whole group. The TV's own apps, with no list, stay flat.@@ -306,7 +311,7 @@ fun DebloatScreen(Column(Modifier.weight(1f)) {Text(p.label, style = MaterialTheme.typography.bodyLarge)Text(- listOfNotNull(p.pkg, p.note, "optional: tick it if you don't use it".takeIf { p.optional }).joinToString(" · "),+ listOfNotNull(p.pkg, p.note, stringResource(R.string.lists_optional).takeIf { p.optional }).joinToString(" · "),style = MaterialTheme.typography.bodySmall,color = MaterialTheme.colorScheme.onSurfaceVariant,)@@ -346,7 +351,7 @@ private fun GroupRow(title: String, on: Int, of: Int, onToggle: () -> Unit) {TriStateCheckbox(state, onClick = null)Spacer(Modifier.width(8.dp))Text(title, style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, modifier = Modifier.weight(1f))- Text("$on of $of", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(start = 8.dp))+ Text(stringResource(R.string.lists_group_count, on, of), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(start = 8.dp))}}@@ -376,12 +381,12 @@ private fun HelpAddCard(onHelpAdd: () -> Unit) {Icon(AddToQueue, contentDescription = null, tint = MaterialTheme.colorScheme.primary)Spacer(Modifier.width(16.dp))Column(Modifier.weight(1f)) {- Text("Not in the list? Help add this TV", style = MaterialTheme.typography.titleSmall)+ Text(stringResource(R.string.lists_help_add_title), style = MaterialTheme.typography.titleSmall)Text(- "Send its model and stock apps to cleanyourtv, where Tellyscope\u2019s lists come from. You see the text first.",+ stringResource(R.string.lists_help_add_text),style = MaterialTheme.typography.bodyMedium,)- FilledTonalButton(onClick = onHelpAdd, modifier = Modifier.align(Alignment.End).padding(top = 8.dp)) { Text("Help add this TV") }+ FilledTonalButton(onClick = onHelpAdd, modifier = Modifier.align(Alignment.End).padding(top = 8.dp)) { Text(stringResource(R.string.lists_help_add_button)) }}}}@@ -407,7 +412,7 @@ private fun MatchCard(kind: DeviceKind, name: String, detail: String, match: MatText(name, style = MaterialTheme.typography.titleMedium)Text(detail, style = MaterialTheme.typography.bodySmall)}- TextButton(onClick = onNotThis) { Text("Not this TV?") }+ TextButton(onClick = onNotThis) { Text(stringResource(R.string.lists_not_this_tv)) }}}}@@ -416,11 +421,11 @@ private fun MatchCard(kind: DeviceKind, name: String, detail: String, match: Matinternal fun DisableDialog(apps: List<Suggested>, onDisable: () -> Unit, onDismiss: () -> Unit, enabled: Boolean = true) {AlertDialog(onDismissRequest = onDismiss,- title = { Text("Disable ${apps.size} ${if (apps.size == 1) "app" else "apps"}?") },+ title = { Text(pluralStringResource(R.plurals.lists_disable_apps_confirm, apps.size, apps.size)) },text = {// Every name, so a list can't slip something in behind a count.Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text("Each one is hidden and stops running. Nothing is deleted; every one shows in History, where you can turn it back on.")+ Text(stringResource(R.string.lists_disable_text))LazyColumn(Modifier.heightIn(max = 280.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {items(apps, key = { it.pkg }) { a ->Column {@@ -431,8 +436,8 @@ internal fun DisableDialog(apps: List<Suggested>, onDisable: () -> Unit, onDismi}}},- confirmButton = { Button(onClick = onDisable, enabled = enabled) { Text("Yes, disable them") } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ confirmButton = { Button(onClick = onDisable, enabled = enabled) { Text(stringResource(R.string.lists_disable_yes)) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.lists_cancel)) } },)}@@ -455,26 +460,26 @@ fun AboutDialog(commit: String?, onDismiss: () -> Unit, version: String = instalval browser = LocalUriHandler.currentAlertDialog(onDismissRequest = onDismiss,- title = { Text("About Tellyscope") },+ title = { Text(stringResource(R.string.lists_about_title)) },text = {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text("Version $version", style = MaterialTheme.typography.titleSmall)- AboutLink("Website", SITE, browser::openUri)+ Text(stringResource(R.string.lists_about_version, version), style = MaterialTheme.typography.titleSmall)+ AboutLink(stringResource(R.string.lists_about_website), SITE, browser::openUri)AboutLink("GitHub", REPO, browser::openUri)- AboutLink("Watch the demo on YouTube", DEMO_VIDEO, browser::openUri)- Text("Free software under the GNU GPL v3.", style = MaterialTheme.typography.bodyMedium)+ AboutLink(stringResource(R.string.lists_about_demo), DEMO_VIDEO, browser::openUri)+ Text(stringResource(R.string.lists_about_licence), style = MaterialTheme.typography.bodyMedium)Text(- "Device lists are adapted from cleanyourtv by Gathin (MIT licence), " +- (commit?.let { "commit ${it.take(12)}." } ?: "once they have downloaded."),+ commit?.let { stringResource(R.string.lists_about_lists_commit, it.take(12)) } ?: stringResource(R.string.lists_about_lists_pending),style = MaterialTheme.typography.bodyMedium,)Text(- "Uses Kadb (Apache 2.0) and spake2-java (GPL v3). Full licence texts are in the NOTICE file.",+ stringResource(R.string.lists_about_libraries),style = MaterialTheme.typography.bodyMedium,)}},- confirmButton = { TextButton(onClick = onDismiss) { Text("Close") } },+ confirmButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.lists_about_close)) } },+)}diff --git a/app/src/main/java/app/tellyscope/ui/LoggedOutScreen.kt b/app/src/main/java/app/tellyscope/ui/LoggedOutScreen.ktindex 3d58127..5bef860 100644--- a/app/src/main/java/app/tellyscope/ui/LoggedOutScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/LoggedOutScreen.kt@@ -29,8 +29,11 @@ import androidx.compose.material3.TopAppBarimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.Device+import app.tellyscope.data.resolve/** "Projector · XGIMI": the TV's name and maker, as the connect and logged-out pages head them. */internal fun connectTitle(d: Device) = listOfNotNull(name(d), d.manufacturer ?: d.hit.maker).distinct().joinToString(" · ")@@ -47,7 +50,7 @@ fun LoggedOutScreen(device: Device, loggedOutAt: Long, now: Long, onConnect: ()topBar = {TopAppBar(title = {},- navigationIcon = { IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") } },+ navigationIcon = { IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.screen_back)) } },)},bottomBar = {@@ -56,8 +59,8 @@ fun LoggedOutScreen(device: Device, loggedOutAt: Long, now: Long, onConnect: ()horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End),verticalAlignment = Alignment.CenterVertically,) {- TextButton(onClick = onBack) { Text("Back to TVs") }- Button(onClick = onConnect) { Text("Connect again") }+ TextButton(onClick = onBack) { Text(stringResource(R.string.logged_out_back_to_tvs)) }+ Button(onClick = onConnect) { Text(stringResource(R.string.logged_out_connect_again)) }}},) { pad ->@@ -75,13 +78,13 @@ fun LoggedOutScreen(device: Device, loggedOutAt: Long, now: Long, onConnect: ()}}Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(Copy.LOGGED_OUT, style = MaterialTheme.typography.headlineMedium)- Text(Copy.LOGGED_OUT_WHY, style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)- Text(Copy.loggedOutAt(loggedOutAt, now), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(Copy.LOGGED_OUT.resolve(), style = MaterialTheme.typography.headlineMedium)+ Text(Copy.LOGGED_OUT_WHY.resolve(), style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(Copy.loggedOutAt(loggedOutAt, now).resolve(), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text("Why this can happen", style = MaterialTheme.typography.titleSmall)- Copy.LOGGED_OUT_CAUSES.forEach { Text("• $it", style = MaterialTheme.typography.bodyMedium) }+ Text(stringResource(R.string.logged_out_causes_title), style = MaterialTheme.typography.titleSmall)+ Copy.LOGGED_OUT_CAUSES.forEach { Text(stringResource(R.string.logged_out_cause, it.resolve()), style = MaterialTheme.typography.bodyMedium) }}}}diff --git a/app/src/main/java/app/tellyscope/ui/PermissionScreen.kt b/app/src/main/java/app/tellyscope/ui/PermissionScreen.ktindex e8c8f94..9c8e28f 100644--- a/app/src/main/java/app/tellyscope/ui/PermissionScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/PermissionScreen.kt@@ -22,7 +22,9 @@ import androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import app.tellyscope.R/*** Shown before the first scan on Android 17+, where talking to anything on the@@ -43,24 +45,23 @@ fun PermissionScreen(denied: Boolean, canAsk: Boolean, onAllow: () -> Unit, onSe) {Icon(Icons.Default.Search, contentDescription = null, Modifier.size(36.dp), tint = MaterialTheme.colorScheme.onPrimaryContainer)}- Text("Find TVs on your Wi-Fi", style = MaterialTheme.typography.headlineMedium)+ Text(stringResource(R.string.permission_title), style = MaterialTheme.typography.headlineMedium)Text(- "Android asks before an app talks to other devices on your Wi-Fi. " +- "Tellyscope only connects to the TVs you pick.",+ stringResource(R.string.permission_local_network_text),style = MaterialTheme.typography.bodyLarge,)if (denied) {Text(- "Without it, Tellyscope can't see any TV. In Settings, open Permissions → Nearby devices and choose Allow.",+ stringResource(R.string.permission_denied),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.error,)Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- Button(onClick = onSettings) { Text("Open Settings") }- if (canAsk) TextButton(onClick = onAllow) { Text("Ask again") }+ Button(onClick = onSettings) { Text(stringResource(R.string.permission_open_settings)) }+ if (canAsk) TextButton(onClick = onAllow) { Text(stringResource(R.string.permission_ask_again)) }}} else {- Button(onClick = onAllow) { Text("Continue") }+ Button(onClick = onAllow) { Text(stringResource(R.string.screen_continue)) }}}}diff --git a/app/src/main/java/app/tellyscope/ui/RemoteScreen.kt b/app/src/main/java/app/tellyscope/ui/RemoteScreen.ktindex a55975a..f638cac 100644--- a/app/src/main/java/app/tellyscope/ui/RemoteScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/RemoteScreen.kt@@ -157,12 +157,17 @@ import androidx.compose.ui.text.buildAnnotatedStringimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.withStyleimport app.tellyscope.data.Device+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import app.tellyscope.R+import app.tellyscope.data.UiText+import app.tellyscope.data.resolvedata class RemoteActions(/** Suspends until the TV answers, so a held key never queues up presses. False when it didn't take the key. */val press: suspend (RemoteKey) -> Boolean = { true },/** Returns why the text can't be typed, or null once it's sent. */- val type: (String) -> String? = { null },+ val type: (String) -> UiText? = { null },val reboot: () -> Unit = {},val back: () -> Unit = {},/** A restart running late: try the TV again and wait another minute. */@@ -287,7 +292,7 @@ fun RemoteScreen(horizontalAlignment = Alignment.CenterHorizontally,) {Row(Modifier.weight(1f).fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {- if (short) RoundKey(RemoteKey.MUTE, "Mute or unmute", live, actions.press, size = 56.dp) { Icon(RemoteIcons.VolumeOff, null) }+ if (short) RoundKey(RemoteKey.MUTE, stringResource(R.string.remote_mute), live, actions.press, size = 56.dp) { Icon(RemoteIcons.VolumeOff, null) }BoxWithConstraints(Modifier.weight(1f).fillMaxHeight(), contentAlignment = Alignment.Center) {val room = minOf(maxWidth, maxHeight)val cramped = room < DPAD_MIN@@ -302,11 +307,11 @@ fun RemoteScreen(val (outer, inner) = 28.dp to 4.dpval tall = Modifier.fillMaxWidth().height(72.dp)KeySurface(- RemoteKey.VOLUME_UP, "Volume up", live, actions.press, RoundedCornerShape(outer, outer, inner, inner),+ RemoteKey.VOLUME_UP, stringResource(R.string.remote_volume_up), live, actions.press, RoundedCornerShape(outer, outer, inner, inner),MaterialTheme.colorScheme.secondaryContainer, tall,) { Icon(RemoteIcons.VolumeUp, null) }KeySurface(- RemoteKey.VOLUME_DOWN, "Volume down", live, actions.press, RoundedCornerShape(inner, inner, outer, outer),+ RemoteKey.VOLUME_DOWN, stringResource(R.string.remote_volume_down), live, actions.press, RoundedCornerShape(inner, inner, outer, outer),MaterialTheme.colorScheme.secondaryContainer, tall,) { Icon(RemoteIcons.VolumeDown, null) }}@@ -314,25 +319,25 @@ fun RemoteScreen(// While typing these shrink so the D-pad keeps its room; 48 dp is still a full touch target.val side = if (typing) 48.dp else 64.dpBox(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {- RoundKey(RemoteKey.BACK, "Back", live, actions.press, Modifier.align(Alignment.CenterStart), size = side) { Icon(Icons.AutoMirrored.Filled.ArrowBack, null) }- RoundKey(RemoteKey.HOME, "Home", live, actions.press, size = if (typing) 56.dp else 80.dp) {+ RoundKey(RemoteKey.BACK, stringResource(R.string.remote_back), live, actions.press, Modifier.align(Alignment.CenterStart), size = side) { Icon(Icons.AutoMirrored.Filled.ArrowBack, null) }+ RoundKey(RemoteKey.HOME, stringResource(R.string.remote_home), live, actions.press, size = if (typing) 56.dp else 80.dp) {Icon(Icons.Outlined.Home, null, Modifier.size(if (typing) 24.dp else 32.dp))}- RoundKey(RemoteKey.MENU, "Menu", live, actions.press, Modifier.align(Alignment.CenterEnd), size = side) { Icon(Icons.Default.Menu, null) }+ RoundKey(RemoteKey.MENU, stringResource(R.string.remote_menu), live, actions.press, Modifier.align(Alignment.CenterEnd), size = side) { Icon(Icons.Default.Menu, null) }}if (!typing && !short) {Spacer(Modifier.height(rowGap))Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.CenterVertically) {- RoundKey(RemoteKey.MUTE, "Mute or unmute", live, actions.press) { Icon(RemoteIcons.VolumeOff, null) }+ RoundKey(RemoteKey.MUTE, stringResource(R.string.remote_mute), live, actions.press) { Icon(RemoteIcons.VolumeOff, null) }// One split pill: two halves of the same key, so the gap stays narrow.Row(Modifier.weight(1f), horizontalArrangement = Arrangement.spacedBy(4.dp)) {val (outer, inner) = 32.dp to 4.dpKeySurface(- RemoteKey.VOLUME_DOWN, "Volume down", live, actions.press, RoundedCornerShape(outer, inner, inner, outer),+ RemoteKey.VOLUME_DOWN, stringResource(R.string.remote_volume_down), live, actions.press, RoundedCornerShape(outer, inner, inner, outer),MaterialTheme.colorScheme.secondaryContainer, Modifier.weight(1f).height(64.dp),) { Icon(RemoteIcons.VolumeDown, null) }KeySurface(- RemoteKey.VOLUME_UP, "Volume up", live, actions.press, RoundedCornerShape(inner, outer, outer, inner),+ RemoteKey.VOLUME_UP, stringResource(R.string.remote_volume_up), live, actions.press, RoundedCornerShape(inner, outer, outer, inner),MaterialTheme.colorScheme.secondaryContainer, Modifier.weight(1f).height(64.dp),) { Icon(RemoteIcons.VolumeUp, null) }}@@ -372,10 +377,10 @@ private fun RemoteHeader(state: UiState, device: Device, restart: Restart?, screText(name(device), style = MaterialTheme.typography.titleLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)when {restart != null -> RestartStatus(late = restart.phase(state.clock()) != Restart.Phase.Waiting, onClick = onRestartTap)- screenOff -> StateLine(Copy.SCREEN_OFF, Copy.SCREEN_OFF_WAKE)- device.state != DeviceState.Online -> StateLine(Copy.state(device.state), Copy.REMOTE_OFFLINE_WAKE)+ screenOff -> StateLine(Copy.SCREEN_OFF.resolve(), Copy.SCREEN_OFF_WAKE.resolve())+ device.state != DeviceState.Online -> StateLine(Copy.state(device.state).resolve(), Copy.REMOTE_OFFLINE_WAKE.resolve())else -> {- val health = state.device.snapshot?.let { Copy.health(it, heaviest(it, state.device.apps)).text }+ val health = state.device.snapshot?.let { Copy.health(it, heaviest(it, state.device.apps)).text.resolve() }val line = listOf(makerLine(device), health.orEmpty()).filter { it.isNotEmpty() }.joinToString(" · ")if (line.isNotEmpty()) Text(line, style = MaterialTheme.typography.bodyMedium, color = c.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)}@@ -411,20 +416,20 @@ private fun DPad(enabled: Boolean, press: suspend (RemoteKey) -> Boolean, size:val arrow = Modifier.size(80.dp * scale)val glyph = Modifier.size(40.dp * scale)val tint = MaterialTheme.colorScheme.onSurface- KeySurface(RemoteKey.UP, "Up", enabled, press, CircleShape, Color.Transparent, arrow.align(Alignment.TopCenter)) {+ KeySurface(RemoteKey.UP, stringResource(R.string.remote_up), enabled, press, CircleShape, Color.Transparent, arrow.align(Alignment.TopCenter)) {Icon(Icons.Default.KeyboardArrowUp, null, glyph, tint = tint)}- KeySurface(RemoteKey.DOWN, "Down", enabled, press, CircleShape, Color.Transparent, arrow.align(Alignment.BottomCenter)) {+ KeySurface(RemoteKey.DOWN, stringResource(R.string.remote_down), enabled, press, CircleShape, Color.Transparent, arrow.align(Alignment.BottomCenter)) {Icon(Icons.Default.KeyboardArrowDown, null, glyph, tint = tint)}- KeySurface(RemoteKey.LEFT, "Left", enabled, press, CircleShape, Color.Transparent, arrow.align(Alignment.CenterStart)) {+ KeySurface(RemoteKey.LEFT, stringResource(R.string.remote_left), enabled, press, CircleShape, Color.Transparent, arrow.align(Alignment.CenterStart)) {Icon(Icons.Default.KeyboardArrowLeft, null, glyph, tint = tint)}- KeySurface(RemoteKey.RIGHT, "Right", enabled, press, CircleShape, Color.Transparent, arrow.align(Alignment.CenterEnd)) {+ KeySurface(RemoteKey.RIGHT, stringResource(R.string.remote_right), enabled, press, CircleShape, Color.Transparent, arrow.align(Alignment.CenterEnd)) {Icon(Icons.Default.KeyboardArrowRight, null, glyph, tint = tint)}KeySurface(- RemoteKey.OK, "OK", enabled, press, CircleShape, MaterialTheme.colorScheme.primary,+ RemoteKey.OK, stringResource(R.string.remote_ok), enabled, press, CircleShape, MaterialTheme.colorScheme.primary,Modifier.size(112.dp * scale).align(Alignment.Center),) {}}@@ -501,23 +506,24 @@ private fun KeySurface(@OptIn(ExperimentalMaterial3Api::class)private fun Keyboard(enabled: Boolean,- type: (String) -> String?,+ type: (String) -> UiText?,press: suspend (RemoteKey) -> Boolean,hint: Boolean = true,modifier: Modifier = Modifier,) {var text by rememberSaveable { mutableStateOf("") }var error by rememberSaveable { mutableStateOf<String?>(null) }+ val context = LocalContext.currentfun send() {- error = type(text)+ error = type(text)?.resolve(context)if (error == null) text = ""}OutlinedTextField(value = text,onValueChange = { text = it; error = null },enabled = enabled,- label = { Text("Type on the TV") },- supportingText = if (error != null || hint) ({ Text(error ?: Copy.TYPE_HINT) }) else null,+ label = { Text(stringResource(R.string.remote_type_label)) },+ supportingText = if (error != null || hint) ({ Text(error ?: Copy.TYPE_HINT.resolve()) }) else null,isError = error != null,singleLine = true,keyboardOptions = KeyboardOptions(imeAction = ImeAction.Send),@@ -527,11 +533,11 @@ private fun Keyboard(// A key, not a button: holding it repeats like the D-pad. It deletes on the TV only;// the field above is the unsent draft, which the phone's keyboard edits.KeySurface(- RemoteKey.DEL, Copy.BACKSPACE, enabled, press,+ RemoteKey.DEL, Copy.BACKSPACE.resolve(), enabled, press,CircleShape, Color.Transparent, Modifier.size(48.dp),) { Icon(RemoteIcons.Backspace, null, tint = LocalContentColor.current.copy(alpha = if (enabled) 1f else 0.38f)) }IconButton(onClick = ::send, enabled = enabled && text.isNotEmpty()) {- Icon(Icons.AutoMirrored.Filled.Send, contentDescription = "Send to the TV")+ Icon(Icons.AutoMirrored.Filled.Send, contentDescription = stringResource(R.string.remote_send))}}},@@ -543,10 +549,10 @@ private fun Keyboard(fun RebootDialog(onRestart: () -> Unit, onDismiss: () -> Unit) {AlertDialog(onDismissRequest = onDismiss,- title = { Text(Copy.REBOOT_TITLE) },- text = { Text(Copy.REBOOT_TEXT) },- confirmButton = { Button(onClick = onRestart) { Text("Restart") } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ title = { Text(Copy.REBOOT_TITLE.resolve()) },+ text = { Text(Copy.REBOOT_TEXT.resolve()) },+ confirmButton = { Button(onClick = onRestart) { Text(stringResource(R.string.remote_restart)) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.remote_cancel)) } },)}@@ -562,8 +568,8 @@ fun RestartingCard(restart: Restart, now: Long) {LoadingIndicator(Modifier.size(48.dp))Spacer(Modifier.width(12.dp))Column(Modifier.weight(1f)) {- Text("Restarting", style = MaterialTheme.typography.titleSmall)- Text(Copy.restarting((now - restart.since) / 60_000), style = MaterialTheme.typography.bodyMedium)+ Text(stringResource(R.string.remote_restarting), style = MaterialTheme.typography.titleSmall)+ Text(Copy.restarting((now - restart.since) / 60_000).resolve(), style = MaterialTheme.typography.bodyMedium)}}}@@ -582,30 +588,30 @@ private fun RestartDialog(restart: Restart, now: Long, tvName: String, onHide: (onDismissRequest = onHide,// Wavy, not the loading indicator: that one is for waits under a few seconds.icon = { CircularWavyProgressIndicator(Modifier.size(48.dp)) },- title = { Text(Copy.RESTARTING_TITLE) },+ title = { Text(Copy.RESTARTING_TITLE.resolve()) },text = {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(Copy.RESTARTING_TEXT)- Text(Copy.waitingFor(tvName, now - restart.since), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)+ Text(Copy.RESTARTING_TEXT.resolve())+ Text(Copy.waitingFor(tvName, now - restart.since).resolve(), style = MaterialTheme.typography.bodySmall, color = c.onSurfaceVariant)}},- confirmButton = { TextButton(onClick = onHide) { Text("Hide") } },+ confirmButton = { TextButton(onClick = onHide) { Text(stringResource(R.string.remote_hide)) } },)Restart.Phase.Late -> AlertDialog(onDismissRequest = onHide,icon = { StatusShape(RemoteIcons.HourglassTop, c.secondaryContainer, c.onSecondaryContainer) },- title = { Text(Copy.RESTART_LATE_TITLE) },- text = { Text(Copy.RESTART_LATE_TEXT) },- confirmButton = { Button(onClick = onRetry) { Text("Retry") } },- dismissButton = { TextButton(onClick = onHide) { Text("Close") } },+ title = { Text(Copy.RESTART_LATE_TITLE.resolve()) },+ text = { Text(Copy.RESTART_LATE_TEXT.resolve()) },+ confirmButton = { Button(onClick = onRetry) { Text(stringResource(R.string.remote_retry)) } },+ dismissButton = { TextButton(onClick = onHide) { Text(stringResource(R.string.remote_close)) } },)Restart.Phase.Lost -> AlertDialog(onDismissRequest = onStop,icon = { StatusShape(RemoteIcons.LinkOff, c.errorContainer, c.onErrorContainer) },- title = { Text(Copy.restartLost(tvName)) },- text = { Text(Copy.RESTART_LOST_TEXT) },- confirmButton = { Button(onClick = onRetry) { Text("Retry") } },- dismissButton = { TextButton(onClick = onStop) { Text("Close") } },+ title = { Text(Copy.restartLost(tvName).resolve()) },+ text = { Text(Copy.RESTART_LOST_TEXT.resolve()) },+ confirmButton = { Button(onClick = onRetry) { Text(stringResource(R.string.remote_retry)) } },+ dismissButton = { TextButton(onClick = onStop) { Text(stringResource(R.string.remote_close)) } },)}}@@ -640,41 +646,41 @@ private fun HeaderMenu(screenControl: Boolean, off: Boolean, live: Boolean, showtooltip = {PlainTooltip {Column(Modifier.padding(vertical = 4.dp)) {- Text(Copy.SCREEN_OFF, style = MaterialTheme.typography.labelLarge)- Text(Copy.SCREEN_OFF_TIP)+ Text(Copy.SCREEN_OFF.resolve(), style = MaterialTheme.typography.labelLarge)+ Text(Copy.SCREEN_OFF_TIP.resolve())}}},state = tip,enableUserInput = false,) {- IconButton(onClick = { open = true }) { Icon(Icons.Default.MoreVert, contentDescription = Copy.MORE) }+ IconButton(onClick = { open = true }) { Icon(Icons.Default.MoreVert, contentDescription = Copy.MORE.resolve()) }}DropdownMenu(open, onDismissRequest = { open = false }, shape = MaterialTheme.shapes.large) {if (screenControl) {// While the picture is off, the item turns it back on.if (off) DropdownMenuItem(- text = { Text(Copy.SCREEN_ON) },+ text = { Text(Copy.SCREEN_ON.resolve()) },leadingIcon = { Icon(RemoteIcons.Tv, null) },enabled = live,onClick = { open = false; actions.screenOff(false) },)else DropdownMenuItem(- text = { Text(Copy.SCREEN_OFF) },+ text = { Text(Copy.SCREEN_OFF.resolve()) },leadingIcon = { Icon(RemoteIcons.TvOff, null) },enabled = live,onClick = { open = false; actions.screenOff(true) },)}DropdownMenuItem(- text = { Text(Copy.REMOTE_RESTART) },+ text = { Text(Copy.REMOTE_RESTART.resolve()) },leadingIcon = { Icon(RemoteIcons.RestartAlt, null) },enabled = live,onClick = { open = false; onRestart() },)HorizontalDivider(Modifier.padding(vertical = 4.dp))DropdownMenuItem(- text = { Text(Copy.REMOTE_BUTTONS) },+ text = { Text(Copy.REMOTE_BUTTONS.resolve()) },leadingIcon = { Icon(Icons.Default.Edit, null) },onClick = { open = false; onButtons() },)@@ -687,7 +693,7 @@ private fun HeaderMenu(screenControl: Boolean, off: Boolean, live: Boolean, show@Composableprivate fun RestartStatus(late: Boolean, onClick: () -> Unit) {Row(- Modifier.clip(MaterialTheme.shapes.small).clickable(onClickLabel = "Show the restart", onClick = onClick),+ Modifier.clip(MaterialTheme.shapes.small).clickable(onClickLabel = stringResource(R.string.remote_show_restart), onClick = onClick),verticalAlignment = Alignment.CenterVertically,horizontalArrangement = Arrangement.spacedBy(4.dp),) {@@ -696,7 +702,7 @@ private fun RestartStatus(late: Boolean, onClick: () -> Unit) {} else {LoadingIndicator(Modifier.size(18.dp))}- Text(if (late) Copy.RESTART_LATE_STATUS else Copy.RESTARTING_TITLE, style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium)+ Text(if (late) Copy.RESTART_LATE_STATUS.resolve() else Copy.RESTARTING_TITLE.resolve(), style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium)Icon(Icons.Default.KeyboardArrowRight, contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(18.dp))}}@@ -735,8 +741,8 @@ private fun ServiceButton(s: StreamingService, enabled: Boolean, onOpen: () -> Uindication = null,enabled = enabled,role = Role.Button,- onClickLabel = Copy.OPEN_ON_TV,- onLongClickLabel = Copy.REMOTE_BUTTONS,+ onClickLabel = Copy.OPEN_ON_TV.resolve(),+ onLongClickLabel = Copy.REMOTE_BUTTONS.resolve(),onLongClick = { haptic.performHapticFeedback(HapticFeedbackType.LongPress); onHold() },onClick = { if (haptics) haptic.performHapticFeedback(HapticFeedbackType.VirtualKey); onOpen() },)@@ -762,7 +768,7 @@ private fun AddButtons(enabled: Boolean, onClick: () -> Unit, modifier: ModifierRow(horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically) {Icon(Icons.Default.Add, contentDescription = null, tint = c.primary, modifier = Modifier.size(20.dp))Spacer(Modifier.width(8.dp))- Text(Copy.REMOTE_BUTTONS, style = MaterialTheme.typography.labelLarge, color = c.onSurfaceVariant)+ Text(Copy.REMOTE_BUTTONS.resolve(), style = MaterialTheme.typography.labelLarge, color = c.onSurfaceVariant)}}}@@ -821,16 +827,16 @@ private fun ButtonsSheet(dock: List<Docked>, apps: List<AppInfo>, cap: Int, setDval rowPx = with(LocalDensity.current) { SHEET_ROW.toPx() }ModalBottomSheet(onDismissRequest = onDismiss) {Column(Modifier.padding(horizontal = 32.dp).padding(bottom = 8.dp)) {- Text(Copy.REMOTE_BUTTONS, style = MaterialTheme.typography.titleLarge)- Text(Copy.buttonsHint(cap), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(Copy.REMOTE_BUTTONS.resolve(), style = MaterialTheme.typography.titleLarge)+ Text(Copy.buttonsHint(cap).resolve(), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)}Column(Modifier.verticalScroll(rememberScrollState()).padding(bottom = 16.dp)) {ticked.forEachIndexed { i, s ->key(s.name) {val up = lifted == s.nameval moves = listOfNotNull(- CustomAccessibilityAction("Move up") { setDock(Dock.move(mine, i, i - 1)); true }.takeIf { i > 0 },- CustomAccessibilityAction("Move down") { setDock(Dock.move(mine, i, i + 1)); true }.takeIf { i < ticked.lastIndex },+ CustomAccessibilityAction(stringResource(R.string.remote_move_up)) { setDock(Dock.move(mine, i, i - 1)); true }.takeIf { i > 0 },+ CustomAccessibilityAction(stringResource(R.string.remote_move_down)) { setDock(Dock.move(mine, i, i + 1)); true }.takeIf { i < ticked.lastIndex },)ServiceRow(s, checked = true, enabled = true, onToggle = { toggle(s) },diff --git a/app/src/main/java/app/tellyscope/ui/ReportScreen.kt b/app/src/main/java/app/tellyscope/ui/ReportScreen.ktindex 6a6e8a4..31641ef 100644--- a/app/src/main/java/app/tellyscope/ui/ReportScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/ReportScreen.kt@@ -58,11 +58,15 @@ import androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.graphics.vector.PathParserimport androidx.compose.ui.platform.LocalClipboardManagerimport androidx.compose.ui.platform.LocalUriHandler+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.AnnotatedStringimport androidx.compose.ui.text.font.FontFamilyimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.adb.Reportimport app.tellyscope.adb.Reports+import app.tellyscope.data.resolve/*** Report a problem, or Help add this TV: what the TV said about itself, the form's dropdowns, what@@ -84,10 +88,11 @@ fun ReportScreen(r: ReportUi, onOpened: (Report) -> Unit, close: () -> Unit) {var outcome by rememberSaveable { mutableStateOf<Reports.Outcome?>(null) }var stage by rememberSaveable { mutableStateOf<Reports.Stage?>(null) }var details by rememberSaveable { mutableStateOf(r.details) }+ val log = r.log?.resolve()// Null until the form's required dropdown is picked, and for a new TV, until it's been read.- val report = remember(r.tv, r.log, connection, outcome, stage, details) {+ val report = remember(r.tv, log, connection, outcome, stage, details) {when (r.kind) {- ReportKind.Problem -> outcome?.let { Reports.problem(r.app, r.tv, connection, it, details, r.log) }+ ReportKind.Problem -> outcome?.let { Reports.problem(r.app, r.tv, connection, it, details, log) }ReportKind.NewTv -> if (r.tv == null) null else stage?.let { Reports.newTv(r.app, r.tv, it, details) }}}@@ -97,29 +102,28 @@ fun ReportScreen(r: ReportUi, onOpened: (Report) -> Unit, close: () -> Unit) {TopAppBar(title = {Column {- Text(if (newTv) "Help add this TV" else "Report a problem")+ Text(stringResource(if (newTv) R.string.report_title_new_tv else R.string.report_title_problem))Text(- if (newTv) "Opens cleanyourtv’s “My TV” form on GitHub" else "Opens an issue on Tellyscope’s GitHub",+ stringResource(if (newTv) R.string.report_subtitle_new_tv else R.string.report_subtitle_problem),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,)}},- navigationIcon = { IconButton(onClick = close) { Icon(Icons.Default.Close, contentDescription = "Close") } },+ navigationIcon = { IconButton(onClick = close) { Icon(Icons.Default.Close, contentDescription = stringResource(R.string.report_close)) } },)},bottomBar = {if (posted == null) Actions(- note = "You post it from your own GitHub account. " + (- report?.rest?.let { "What doesn’t fit the link can go in a comment after you post." }- ?: "Tellyscope sends nothing by itself."- ),+ note = stringResource(R.string.report_note_own_account) + " " + stringResource(+ if (report?.rest != null) R.string.report_note_rest else R.string.report_note_nothing_sent,+ ),cancel = close,) {Button(onClick = { report?.let { runCatching { browser.openUri(it.link) }; onOpened(it) } },enabled = report != null,- ) { ButtonIcon(OpenInNew); Text("Open GitHub") }+ ) { ButtonIcon(OpenInNew); Text(stringResource(R.string.report_open_github)) }}},) { pad ->@@ -134,34 +138,34 @@ fun ReportScreen(r: ReportUi, onOpened: (Report) -> Unit, close: () -> Unit) {// Read from the TV, so shown as facts rather than fields to edit.Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer)) {val tv = r.tv- val reading = if (r.reading) "Reading the TV…" else "No TV connected"- Fact(if (newTv) "TV model" else "TV", tv?.name ?: reading)+ val reading = stringResource(if (r.reading) R.string.report_reading_tv else R.string.report_no_tv)+ Fact(stringResource(if (newTv) R.string.report_tv_model else R.string.report_tv), tv?.name ?: reading)HorizontalDivider(color = MaterialTheme.colorScheme.surface)- Fact("Android version and firmware build", tv?.android ?: reading)+ Fact(stringResource(R.string.report_android_build), tv?.android ?: reading)}if (newTv) {- Choice("How far did you get?", stage, Reports.Stage.entries, { it.option }) { stage = it }+ Choice(stringResource(R.string.report_how_far), stage, Reports.Stage.entries, { it.option }) { stage = it }} else {Choice(- "How did you connect?", connection, Reports.Connection.entries, { it.option },- help = "Filled in from this connection; change it if it’s wrong.",+ stringResource(R.string.report_how_connect), connection, Reports.Connection.entries, { it.option },+ help = stringResource(R.string.report_how_connect_help),) { connection = it }- Choice("What happened?", outcome, Reports.Outcome.entries, { it.option }) { outcome = it }+ Choice(stringResource(R.string.report_what_happened), outcome, Reports.Outcome.entries, { it.option }) { outcome = it }}OutlinedTextField(details, { details = it },- label = { Text("Details (optional)") },- placeholder = { Text(if (newTv) "Anything else?" else "What were you doing?") },+ label = { Text(stringResource(R.string.report_details)) },+ placeholder = { Text(stringResource(if (newTv) R.string.report_details_new_tv else R.string.report_details_problem)) },minLines = 3,modifier = Modifier.fillMaxWidth(),)- Text("What gets sent", style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary)+ Text(stringResource(R.string.report_what_gets_sent), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary)if (report == null) {Text(when {- newTv && r.tv == null -> if (r.reading) "Reading the TV…" else "Connect the TV to list its apps."- newTv -> "Pick how far you got to see the report."- else -> "Pick what happened to see the report."+ newTv && r.tv == null -> stringResource(if (r.reading) R.string.report_reading_tv else R.string.report_connect_tv)+ newTv -> stringResource(R.string.report_pick_stage)+ else -> stringResource(R.string.report_pick_outcome)},style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,@@ -187,27 +191,27 @@ fun AddRestScreen(posted: Report, back: () -> Unit, done: () -> Unit) {TopAppBar(title = {Column {- Text("Add the rest")+ Text(stringResource(R.string.report_add_rest))Text(- "As a comment on your newest issue on ${posted.repo.substringAfter('/')}",+ stringResource(R.string.report_add_rest_subtitle, posted.repo.substringAfter('/')),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,)}},- navigationIcon = { IconButton(onClick = back) { Icon(Icons.Default.Close, contentDescription = "Close") } },+ navigationIcon = { IconButton(onClick = back) { Icon(Icons.Default.Close, contentDescription = stringResource(R.string.report_close)) } },)},bottomBar = {Actions(- note = "Opens your newest issue on ${posted.repo}. If it’s not the right one, pick yours from the list there.",+ note = stringResource(R.string.report_add_rest_note, posted.repo),cancel = back,) {Button(onClick = {clipboard.setText(AnnotatedString(rest))runCatching { browser.openUri(posted.myIssues) }done()- }) { ButtonIcon(CopyIcon); Text("Copy and open your issue") }+ }) { ButtonIcon(CopyIcon); Text(stringResource(R.string.report_copy_and_open)) }}},) { pad ->@@ -216,8 +220,7 @@ fun AddRestScreen(posted: Report, back: () -> Unit, done: () -> Unit) {verticalArrangement = Arrangement.spacedBy(16.dp),) {Text(- "This is the comment. GitHub can’t fill in a comment from a link, so Tellyscope copies it and opens " +- "your issue: tap the comment box there and paste.",+ stringResource(R.string.report_add_rest_text),style = MaterialTheme.typography.bodyMedium,)Sent(rest, tall = true)@@ -232,15 +235,15 @@ private fun PostedCard(posted: Report, notNow: () -> Unit, addRest: () -> Unit)val lines = posted.rest.orEmpty().lines().size - 1Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primaryContainer)) {Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text("Posted it? Add the rest as a comment", style = MaterialTheme.typography.titleMedium)+ Text(stringResource(R.string.report_posted_title), style = MaterialTheme.typography.titleMedium)Text(- if (posted.repo == Reports.CLEANYOURTV) "$lines apps didn’t fit in the link. Adding them helps cleanyourtv write the full list."- else "Part of the report didn’t fit in the link. Adding it helps us find the problem.",+ if (posted.repo == Reports.CLEANYOURTV) pluralStringResource(R.plurals.report_posted_apps_cut, lines, lines)+ else stringResource(R.string.report_posted_part_cut),style = MaterialTheme.typography.bodyMedium,)Row(Modifier.fillMaxWidth().padding(top = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {- TextButton(onClick = notNow) { Text("Not now") }- Button(onClick = addRest) { Text("Add the rest") }+ TextButton(onClick = notNow) { Text(stringResource(R.string.report_not_now)) }+ Button(onClick = addRest) { Text(stringResource(R.string.report_add_rest)) }}}}@@ -260,7 +263,7 @@ private fun <T> Choice(label: String, value: T?, options: List<T>, text: (T) ->var open by remember { mutableStateOf(false) }ExposedDropdownMenuBox(open, onExpandedChange = { open = it }) {OutlinedTextField(- value?.let(text) ?: "Choose one", {},+ value?.let(text) ?: stringResource(R.string.report_choose_one), {},readOnly = true,label = { Text(label) },supportingText = help?.let { { Text(it) } },@@ -290,7 +293,7 @@ private fun Removed() = Row(verticalAlignment = Alignment.CenterVertically) {Icon(Icons.Default.Lock, null, Modifier.size(16.dp), tint = MaterialTheme.colorScheme.primary)Spacer(Modifier.width(8.dp))Text(- "Removed first: serial numbers, IP addresses, ADB keys and fingerprints.",+ stringResource(R.string.report_removed_first),style = MaterialTheme.typography.bodySmall,color = MaterialTheme.colorScheme.onSurfaceVariant,)@@ -303,7 +306,8 @@ private fun Actions(note: String, cancel: () -> Unit, action: @Composable () ->Column(Modifier.fillMaxWidth().navigationBarsPadding().imePadding().padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {Text(note, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {- TextButton(onClick = cancel) { Text("Cancel") }+ TextButton(onClick = cancel) { Text(stringResource(R.string.report_cancel)) }+action()}}diff --git a/app/src/main/java/app/tellyscope/ui/RequestDialog.kt b/app/src/main/java/app/tellyscope/ui/RequestDialog.ktindex 1efad70..1127fc4 100644--- a/app/src/main/java/app/tellyscope/ui/RequestDialog.kt+++ b/app/src/main/java/app/tellyscope/ui/RequestDialog.kt@@ -30,8 +30,11 @@ import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.semantics.Roleimport androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.adb.ConnectionRequest+import app.tellyscope.data.resolve/*** The TV's "Allow debugging?" prompt, answered from the phone, as a dialog like the TV's own. The@@ -52,10 +55,10 @@ fun RequestDialog(AlertDialog(onDismissRequest = { if (!busy) dismiss() },icon = { Icon(AccessIcons.Shield, contentDescription = null) },- title = { Text(Copy.REQUEST_TITLE) },+ title = { Text(Copy.REQUEST_TITLE.resolve()) },text = {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(Copy.REQUEST_TEXT)+ Text(Copy.REQUEST_TEXT.resolve())// Eight pairs a line, so a pair is never split when comparing it with the other device.Text(request.fingerprint.split(':').chunked(8).joinToString("\n") { it.joinToString(":") },@@ -68,14 +71,14 @@ fun RequestDialog(verticalAlignment = Alignment.CenterVertically,) {Checkbox(checked = always, onCheckedChange = null, enabled = !busy)- Text(Copy.REQUEST_ALWAYS, Modifier.padding(start = 8.dp))+ Text(Copy.REQUEST_ALWAYS.resolve(), Modifier.padding(start = 8.dp))}}},confirmButton = {- Button(onClick = { answer(true, always && request.canAlwaysAllow) }, enabled = !busy) { Text(Copy.REQUEST_ALLOW) }+ Button(onClick = { answer(true, always && request.canAlwaysAllow) }, enabled = !busy) { Text(Copy.REQUEST_ALLOW.resolve()) }},- dismissButton = { TextButton(onClick = { answer(false, false) }, enabled = !busy) { Text(Copy.REQUEST_DENY) } },+ dismissButton = { TextButton(onClick = { answer(false, false) }, enabled = !busy) { Text(Copy.REQUEST_DENY.resolve()) } },)}@@ -90,19 +93,19 @@ private fun BehindAlertDialog(busy: Boolean, closeAlert: () -> Unit, dismiss: ()AlertDialog(onDismissRequest = { if (!busy) dismiss() },icon = { Icon(AccessIcons.Shield, contentDescription = null) },- title = { Text(Copy.REQUEST_TITLE) },+ title = { Text(Copy.REQUEST_TITLE.resolve()) },text = {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(Copy.REQUEST_BEHIND_ALERT)- Text(Copy.REQUEST_THEN)+ Text(Copy.REQUEST_BEHIND_ALERT.resolve())+ Text(Copy.REQUEST_THEN.resolve())Row(Modifier.padding(top = 8.dp), verticalAlignment = Alignment.CenterVertically) {LoadingIndicator(Modifier.size(24.dp))Spacer(Modifier.width(12.dp))- Text(Copy.REQUEST_WAITING, style = MaterialTheme.typography.bodyMedium)+ Text(Copy.REQUEST_WAITING.resolve(), style = MaterialTheme.typography.bodyMedium)}}},- confirmButton = { FilledTonalButton(onClick = closeAlert, enabled = !busy) { Text(Copy.PRESS_OK) } },- dismissButton = { TextButton(onClick = dismiss, enabled = !busy) { Text("Close") } },+ confirmButton = { FilledTonalButton(onClick = closeAlert, enabled = !busy) { Text(Copy.PRESS_OK.resolve()) } },+ dismissButton = { TextButton(onClick = dismiss, enabled = !busy) { Text(stringResource(R.string.request_close)) } },)}diff --git a/app/src/main/java/app/tellyscope/ui/ResetScreen.kt b/app/src/main/java/app/tellyscope/ui/ResetScreen.ktindex cfa4f62..119baf3 100644--- a/app/src/main/java/app/tellyscope/ui/ResetScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/ResetScreen.kt@@ -57,14 +57,18 @@ import androidx.compose.ui.graphics.Shapeimport androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.graphics.vector.ImageVectorimport androidx.compose.ui.graphics.vector.PathParser+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.Deviceimport app.tellyscope.data.ResetAppimport app.tellyscope.data.ResetFailureimport app.tellyscope.data.ResetPartimport app.tellyscope.data.ResetPlanimport app.tellyscope.data.ResetProgress+import app.tellyscope.data.UiText+import app.tellyscope.data.resolve/** What Reset TV's screen can do, for MainActivity to wire to the view model. */data class ResetActions(@@ -90,12 +94,12 @@ fun ResetScreen(state: UiState, actions: ResetActions) {TopAppBar(title = {Column {- Text(Copy.RESET_TV)+ Text(Copy.RESET_TV.resolve())Text(name(device), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}},navigationIcon = {- IconButton(onClick = actions.back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back to the TV's page") }+ IconButton(onClick = actions.back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.screen_back_to_tv)) }},)},@@ -103,17 +107,17 @@ fun ResetScreen(state: UiState, actions: ResetActions) {Row(Modifier.fillMaxWidth().navigationBarsPadding().padding(16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {when {plan == null || (plan.changes == 0 && !ui.ran) -> Unit- ui.running != null -> Button(onClick = {}, enabled = false) { Text(Copy.RESETTING) }+ ui.running != null -> Button(onClick = {}, enabled = false) { Text(Copy.RESETTING.resolve()) }ui.ran -> {- if (ui.failed.isEmpty()) Button(onClick = actions.back) { Text("Done") }+ if (ui.failed.isEmpty()) Button(onClick = actions.back) { Text(stringResource(R.string.screen_done)) }else {- TextButton(onClick = actions.back) { Text("Done") }- Button(onClick = actions.retry) { Text(Copy.tryAgain(ui.failed.singleOrNull()?.app?.label)) }+ TextButton(onClick = actions.back) { Text(stringResource(R.string.screen_done)) }+ Button(onClick = actions.retry) { Text(Copy.tryAgain(ui.failed.singleOrNull()?.app?.label).resolve()) }}}else -> {- TextButton(onClick = actions.back) { Text("Cancel") }- Button(onClick = actions.reset) { Text(Copy.RESET_BUTTON) }+ TextButton(onClick = actions.back) { Text(stringResource(R.string.screen_cancel)) }+ Button(onClick = actions.reset) { Text(Copy.RESET_BUTTON.resolve()) }}}}@@ -122,18 +126,18 @@ fun ResetScreen(state: UiState, actions: ResetActions) {Box(Modifier.fillMaxSize().padding(pad)) {when {ui.error != null -> Column(Modifier.fillMaxWidth().padding(horizontal = 24.dp), horizontalAlignment = Alignment.CenterHorizontally) {- EmptyState(Icons.Default.Warning, "Couldn't read the TV", ui.error)- TextButton(onClick = actions.reload) { Text("Try again") }+ EmptyState(Icons.Default.Warning, stringResource(R.string.reset_read_failed), ui.error.resolve())+ TextButton(onClick = actions.reload) { Text(stringResource(R.string.screen_try_again)) }}plan == null -> Column(Modifier.fillMaxWidth().padding(top = 96.dp), horizontalAlignment = Alignment.CenterHorizontally) {LoadingIndicator(Modifier.size(48.dp))Spacer(Modifier.height(16.dp))- Text("Reading the TV…", style = MaterialTheme.typography.titleSmall)+ Text(stringResource(R.string.reset_reading), style = MaterialTheme.typography.titleSmall)}// Try again runs on this screen too, so a run in progress comes before the last run's result.ui.running == null && ui.ran -> Result(plan, ui.failed)plan.changes == 0 -> Box(Modifier.padding(horizontal = 24.dp)) {- EmptyState(Icons.Default.Check, Copy.NOTHING_TO_RESET, Copy.nothingToReset(plan.ownHome, maker))+ EmptyState(Icons.Default.Check, Copy.NOTHING_TO_RESET.resolve(), Copy.nothingToReset(plan.ownHome, maker).resolve())}else -> Found(plan, ui.running, ui.progress, maker)}@@ -151,8 +155,8 @@ private fun Found(plan: ResetPlan, running: ResetPlan?, progress: ResetProgress?if (running == null) {Surface(color = c.primaryContainer, shape = MaterialTheme.shapes.large, modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp)) {Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text(Copy.resetFound(plan.changes), style = MaterialTheme.typography.titleSmall, color = c.onPrimaryContainer)- Text(Copy.RESET_FOUND_TEXT, style = MaterialTheme.typography.bodyMedium, color = c.onPrimaryContainer)+ Text(Copy.resetFound(plan.changes).resolve(), style = MaterialTheme.typography.titleSmall, color = c.onPrimaryContainer)+ Text(Copy.RESET_FOUND_TEXT.resolve(), style = MaterialTheme.typography.bodyMedium, color = c.onPrimaryContainer)}}} else {@@ -160,7 +164,7 @@ private fun Found(plan: ResetPlan, running: ResetPlan?, progress: ResetProgress?val done = progress?.let { p -> ResetPart.entries.filter { it < p.part }.sumOf { count(running, it) } + p.done } ?: 0LinearProgressIndicator(progress = { done.toFloat() / total }, modifier = Modifier.fillMaxWidth().padding(top = 8.dp))Text(- progress?.let { Copy.resetting(it, plan.home?.toLabel) } ?: Copy.RESETTING,+ progress?.let { Copy.resetting(it, plan.home?.toLabel).resolve() } ?: Copy.RESETTING.resolve(),style = MaterialTheme.typography.bodyMedium,color = c.onSurfaceVariant,modifier = Modifier.padding(top = 12.dp, bottom = 16.dp),@@ -175,7 +179,7 @@ private fun Found(plan: ResetPlan, running: ResetPlan?, progress: ResetProgress?}item {Text(- Copy.resetLeaves(plan.shippedOff, maker),+ Copy.resetLeaves(plan.shippedOff, maker).resolve(),style = MaterialTheme.typography.bodySmall,color = c.onSurfaceVariant,modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp),@@ -209,9 +213,9 @@ private fun Section(plan: ResetPlan, part: ResetPart, status: Status?) {val c = MaterialTheme.colorSchemevar open by rememberSaveable(part) { mutableStateOf(false) }val (icon, title, text) = when (part) {- ResetPart.TurnOn -> Triple(HistoryIcons.TurnedOn, Copy.turnOnApps(plan.turnOn.size), Copy.TURN_ON_TEXT)- ResetPart.BringBack -> Triple(ResetIcons.BringBack, Copy.bringBackApps(plan.bringBack.size), Copy.BRING_BACK_TEXT)- ResetPart.Home -> plan.home!!.let { Triple(Icons.Default.Home, Copy.resetHome(it.toLabel), Copy.resetHomeText(it.fromLabel, it.service)) }+ ResetPart.TurnOn -> Triple(HistoryIcons.TurnedOn, Copy.turnOnApps(plan.turnOn.size).resolve(), Copy.TURN_ON_TEXT.resolve())+ ResetPart.BringBack -> Triple(ResetIcons.BringBack, Copy.bringBackApps(plan.bringBack.size).resolve(), Copy.BRING_BACK_TEXT.resolve())+ ResetPart.Home -> plan.home!!.let { Triple(Icons.Default.Home, Copy.resetHome(it.toLabel).resolve(), Copy.resetHomeText(it.fromLabel, it.service).resolve()) }}Column {Row(@@ -226,10 +230,10 @@ private fun Section(plan: ResetPlan, part: ResetPart, status: Status?) {}Spacer(Modifier.width(16.dp))when (status) {- null -> Icon(if (open) Icons.Default.KeyboardArrowUp else Icons.Default.KeyboardArrowDown, contentDescription = if (open) "Hide the list" else "Show the list")+ null -> Icon(if (open) Icons.Default.KeyboardArrowUp else Icons.Default.KeyboardArrowDown, contentDescription = stringResource(if (open) R.string.reset_hide_list else R.string.reset_show_list))Status.Running -> CircularProgressIndicator(Modifier.size(20.dp), strokeWidth = 2.dp)- Status.Waiting -> Icon(ResetIcons.Waiting, contentDescription = "Waiting", tint = c.onSurfaceVariant)- Status.Done -> Icon(HistoryIcons.TurnedOn, contentDescription = "Done", tint = c.primary)+ Status.Waiting -> Icon(ResetIcons.Waiting, contentDescription = stringResource(R.string.screen_waiting), tint = c.onSurfaceVariant)+ Status.Done -> Icon(HistoryIcons.TurnedOn, contentDescription = stringResource(R.string.screen_done), tint = c.primary)}}if (open && status == null) {@@ -254,7 +258,7 @@ private fun AppList(apps: List<ResetApp>) {Text(a.packageName, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)}}- if (!all && apps.size > SHOWN) TextButton(onClick = { all = true }) { Text(Copy.showAll(apps.size)) }+ if (!all && apps.size > SHOWN) TextButton(onClick = { all = true }) { Text(Copy.showAll(apps.size).resolve()) }}}@@ -270,18 +274,22 @@ private fun Result(plan: ResetPlan, failed: List<ResetFailure>) {val home = plan.home?.takeIf { failures(ResetPart.Home).isEmpty() }LazyColumn(contentPadding = PaddingValues(start = 16.dp, end = 16.dp, top = 32.dp, bottom = 24.dp), horizontalAlignment = Alignment.CenterHorizontally) {item {- ResultHead(ok, if (ok) Copy.RESET_DONE else Copy.RESET_PARTLY, if (ok) Copy.resetDoneText(on + back, home?.toLabel) else Copy.resetPartlyText(failed.size))+ ResultHead(ok, if (ok) Copy.RESET_DONE.resolve() else Copy.RESET_PARTLY.resolve(), if (ok) Copy.resetDoneText(on + back, home?.toLabel).resolve() else Copy.resetPartlyText(failed.size).resolve())}val rows = ResetPart.entries.filter { count(plan, it) > 0 }itemsIndexed(rows) { i, part ->val miss = failures(part)val line = when (part) {- ResetPart.TurnOn -> Copy.turnedOn(on, plan.turnOn.size)- ResetPart.BringBack -> Copy.broughtBack(back, plan.bringBack.size)+ ResetPart.TurnOn -> Copy.turnedOn(on, plan.turnOn.size).resolve()+ ResetPart.BringBack -> Copy.broughtBack(back, plan.bringBack.size).resolve()// A miss with an app is only the service: Home did move.- ResetPart.Home -> plan.home!!.let { if (miss.all { m -> m.app != null }) Copy.isHome(it.toLabel) else Copy.stillHome(it.fromLabel) }+ ResetPart.Home -> plan.home!!.let { if (miss.all { m -> m.app != null }) Copy.isHome(it.toLabel).resolve() else Copy.stillHome(it.fromLabel).resolve() }+ }+ val why = miss.firstOrNull()?.let { f ->+ val reason = UiText.Capitalized(f.reason).resolve().trimEnd('.')+ f.app?.takeIf { f.part != ResetPart.Home }?.let { stringResource(R.string.result_reason_app, it.label, reason) }+ ?: stringResource(R.string.result_reason, reason)}- val why = miss.firstOrNull()?.let { f -> (f.app?.takeIf { f.part != ResetPart.Home }?.let { "${it.label}: " } ?: "") + f.reason.replaceFirstChar(Char::uppercase).trimEnd('.') + "." }ResultRow(line, why, groupShape(i, rows.size))}}diff --git a/app/src/main/java/app/tellyscope/ui/ScanScreen.kt b/app/src/main/java/app/tellyscope/ui/ScanScreen.ktindex 436e069..20b14e9 100644--- a/app/src/main/java/app/tellyscope/ui/ScanScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/ScanScreen.kt@@ -61,6 +61,8 @@ import androidx.compose.ui.unit.dpimport app.tellyscope.Rimport app.tellyscope.data.ScanHitimport app.tellyscope.ui.theme.SmallNumber+import app.tellyscope.data.UiText+import app.tellyscope.data.resolve/*** "Add your TV": pick the brand, follow its steps one at a time, then pick the TV the scan found.@@ -76,7 +78,7 @@ fun ScanScreen(onConnect: (ScanHit) -> Unit,onCode: (ScanHit, String) -> Unit,onPair: (ScanHit) -> Unit,- onAddByIp: (String) -> String?,+ onAddByIp: (String) -> UiText?,onBack: (() -> Unit)? = null,onOpenWifi: () -> Unit = {},phoneKey: String? = null,@@ -112,7 +114,7 @@ fun ScanScreen(TopAppBar(title = {},navigationIcon = {- if (onBack != null) IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") }+ if (onBack != null) IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.scan_back)) }},)},@@ -123,14 +125,14 @@ fun ScanScreen(Modifier.fillMaxSize().padding(pad).verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp),verticalArrangement = Arrangement.spacedBy(20.dp),) {- Text("Add your TV", style = MaterialTheme.typography.headlineMedium)+ Text(stringResource(R.string.scan_title), style = MaterialTheme.typography.headlineMedium)Surface(shape = MaterialTheme.shapes.large, color = MaterialTheme.colorScheme.secondaryContainer) {Row(Modifier.fillMaxWidth().padding(16.dp), verticalAlignment = Alignment.CenterVertically) {Icon(Icons.Default.Info, null, Modifier.size(20.dp), tint = MaterialTheme.colorScheme.onSecondaryContainer)Spacer(Modifier.width(12.dp))Text(- if (scan.noLan) "You're not on Wi-Fi, so only TVs that announce themselves show up. Join your TV's Wi-Fi."- else "Keep your phone and TV on the same Wi-Fi.",+ if (scan.noLan) stringResource(R.string.scan_no_lan)+ else stringResource(R.string.scan_same_wifi),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSecondaryContainer,)@@ -148,9 +150,9 @@ fun ScanScreen(TextButton(onClick = { adding = true }) {Icon(Icons.Default.Add, null, Modifier.size(18.dp))Spacer(Modifier.width(8.dp))- Text("Add by IP address")+ Text(stringResource(R.string.scan_add_by_ip))}- TextButton(onClick = { help = true }) { Text("Can't find your TV?") }+ TextButton(onClick = { help = true }) { Text(stringResource(R.string.scan_cant_find)) }}}}@@ -184,7 +186,7 @@ private fun FoundTvs(scan: ScanUi, now: Long, onRescan: () -> Unit, onPick: (ScaIcon(DeviceIcons.Tv, null, Modifier.size(24.dp), tint = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.width(16.dp))Column(Modifier.weight(1f)) {- Text(hit.hostname ?: hit.maker ?: "Android device", style = MaterialTheme.typography.titleMedium)+ Text(hit.hostname ?: hit.maker ?: stringResource(R.string.scan_android_device), style = MaterialTheme.typography.titleMedium)Text(listOfNotNull(hit.maker, hit.ip).joinToString(" · "),style = MaterialTheme.typography.bodyMedium,@@ -194,9 +196,9 @@ private fun FoundTvs(scan: ScanUi, now: Long, onRescan: () -> Unit, onPick: (ScaFilledTonalButton(onClick = { onPick(hit) }) {Text(when (row) {- RowState.Found -> "Connect"- RowState.NotAllowed -> "Try again"- else -> "Continue"+ RowState.Found -> stringResource(R.string.scan_connect)+ RowState.NotAllowed -> stringResource(R.string.scan_try_again)+ else -> stringResource(R.string.scan_continue)},)}@@ -210,7 +212,7 @@ private fun FoundTvs(scan: ScanUi, now: Long, onRescan: () -> Unit, onPick: (ScaLoadingIndicator(Modifier.size(32.dp))Spacer(Modifier.width(12.dp))Text(- "Looking for ${if (scan.hits.isEmpty()) "your TV" else "more TVs"}…",+ stringResource(if (scan.hits.isEmpty()) R.string.scan_looking_first else R.string.scan_looking_more),Modifier.weight(1f),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,@@ -231,14 +233,14 @@ private fun FoundTvs(scan: ScanUi, now: Long, onRescan: () -> Unit, onPick: (Sca)}scan.hits.isEmpty() -> Text(- "No TV yet. Tellyscope looks again in a moment.",+ stringResource(R.string.scan_none_yet),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,)else -> TextButton(onClick = onRescan) {Icon(Icons.Default.Refresh, null, Modifier.size(18.dp))Spacer(Modifier.width(8.dp))- Text("Scan again")+ Text(stringResource(R.string.scan_again))}}}@@ -265,44 +267,44 @@ private fun OffWifi(modifier: Modifier, onOpenWifi: () -> Unit, onAddByIp: () ->}}Spacer(Modifier.height(8.dp))- Text("This phone isn't on Wi-Fi", style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center)+ Text(stringResource(R.string.scan_off_wifi_title), style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center)Text(- "Join the same Wi-Fi as your TV. Tellyscope looks for it again as soon as you're on.",+ stringResource(R.string.scan_off_wifi_text),style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.onSurfaceVariant,textAlign = TextAlign.Center,)Spacer(Modifier.height(4.dp))- Button(onClick = onOpenWifi) { Text("Open Wi-Fi settings") }+ Button(onClick = onOpenWifi) { Text(stringResource(R.string.scan_open_wifi)) }// VPNs and odd setups can still reach a TV by its address.- TextButton(onClick = onAddByIp) { Text("Add by IP address") }+ TextButton(onClick = onAddByIp) { Text(stringResource(R.string.scan_add_by_ip)) }}}@Composable-private fun AddByIpDialog(subnet: String?, onDismiss: () -> Unit, onSubmit: (String) -> String?) {+private fun AddByIpDialog(subnet: String?, onDismiss: () -> Unit, onSubmit: (String) -> UiText?) {var text by remember { mutableStateOf("") }- var error by remember { mutableStateOf<String?>(null) }+ var error by remember { mutableStateOf<UiText?>(null) }AlertDialog(onDismissRequest = onDismiss,- title = { Text("Add by IP address") },+ title = { Text(stringResource(R.string.scan_add_by_ip)) },text = {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text("Find it on the TV under Settings → Network → your Wi-Fi.")+ Text(stringResource(R.string.scan_ip_hint))// The scan screen says "your Wi-Fi"; the range is only useful here, while typing.- if (subnet != null) Text("Your Wi-Fi: $subnet", style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant)+ if (subnet != null) Text(stringResource(R.string.scan_subnet, subnet), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant)OutlinedTextField(value = text,onValueChange = { text = it; error = null },singleLine = true,textStyle = MaterialTheme.typography.titleLarge.copy(fontFeatureSettings = "tnum"),isError = error != null,- supportingText = error?.let { { Text(it) } },+ supportingText = error?.let { { Text(it.resolve()) } },keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),)}},- confirmButton = { Button(onClick = { error = onSubmit(text) }) { Text("Connect") } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ confirmButton = { Button(onClick = { error = onSubmit(text) }) { Text(stringResource(R.string.scan_connect)) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.scan_cancel)) } },)}diff --git a/app/src/main/java/app/tellyscope/ui/SettingsScreen.kt b/app/src/main/java/app/tellyscope/ui/SettingsScreen.ktindex b82fca9..b6d6f3f 100644--- a/app/src/main/java/app/tellyscope/ui/SettingsScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/SettingsScreen.kt@@ -61,6 +61,10 @@ import androidx.compose.ui.semantics.Roleimport androidx.compose.ui.unit.dpimport app.tellyscope.data.RELEASESimport app.tellyscope.data.sourceName+import androidx.compose.ui.res.stringResource+import app.tellyscope.R+import app.tellyscope.data.UiText+import app.tellyscope.data.resolve/** Where the lists come from, credited in Settings. Its star count is written in, not fetched. */internal const val CLEANYOURTV = "https://github.com/Gathin23/cleanyourtv"@@ -69,11 +73,11 @@ internal const val CLEANYOURTV = "https://github.com/Gathin23/cleanyourtv"internal val OWN_LISTS_GUIDE = RELEASES.removeSuffix("/releases") + "/blob/main/CONTRIBUTING.md#using-your-own-lists"/** What Share Tellyscope sends: what it is, then the repo, whose page shows it and how to install. */-internal val SHARE_TEXT = "I just found Tellyscope, an open-source app that cleans up your Android TV from your phone: turn off the bloat, install apps and send files, with no root and no PC. Free, no tracking. $REPO"+internal val SHARE_TEXT = UiText(R.string.settings_share_text, REPO)/** Android's share sheet with [SHARE_TEXT], so any app the user picks can send it on. */internal fun shareTellyscope(context: Context) {- val send = Intent(Intent.ACTION_SEND).setType("text/plain").putExtra(Intent.EXTRA_TEXT, SHARE_TEXT)+ val send = Intent(Intent.ACTION_SEND).setType("text/plain").putExtra(Intent.EXTRA_TEXT, SHARE_TEXT.resolve(context))runCatching { context.startActivity(Intent.createChooser(send, null)) }}@@ -108,9 +112,9 @@ fun SettingsScreen(snackbarHost = { SnackbarHost(snackbar) },topBar = {TopAppBar(- title = { Text("Settings") },+ title = { Text(stringResource(R.string.settings_title)) },navigationIcon = {- IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back to the TV's page") }+ IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.settings_back_to_tv)) }},)},@@ -129,10 +133,9 @@ fun SettingsScreen(verticalAlignment = Alignment.CenterVertically,) {Column(Modifier.weight(1f)) {- Text("Check for updates", style = MaterialTheme.typography.titleSmall)+ Text(stringResource(R.string.settings_check_updates), style = MaterialTheme.typography.titleSmall)Text(- (if (alphaBuild) "Every 5 minutes on alpha builds" else "Every 30 minutes") +- ", ask GitHub whether a newer Tellyscope is out. Nothing is downloaded.",+ stringResource(if (alphaBuild) R.string.settings_check_updates_alpha else R.string.settings_check_updates_release),style = MaterialTheme.typography.bodyMedium,)}@@ -147,8 +150,8 @@ fun SettingsScreen(verticalAlignment = Alignment.CenterVertically,) {Column(Modifier.weight(1f)) {- Text("Vibrate on key press", style = MaterialTheme.typography.titleSmall)- Text("A short tick for each key on the Remote.", style = MaterialTheme.typography.bodyMedium)+ Text(stringResource(R.string.settings_key_haptics), style = MaterialTheme.typography.titleSmall)+ Text(stringResource(R.string.settings_key_haptics_text), style = MaterialTheme.typography.bodyMedium)}Spacer(Modifier.width(16.dp))Switch(checked = keyHaptics, onCheckedChange = null)@@ -158,8 +161,8 @@ fun SettingsScreen(Icon(BugReport, contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.width(16.dp))Column(Modifier.weight(1f)) {- Text("Report a problem", style = MaterialTheme.typography.titleSmall)- Text("Opens an issue on Tellyscope\u2019s GitHub. You see the text first.", style = MaterialTheme.typography.bodyMedium)+ Text(stringResource(R.string.settings_report), style = MaterialTheme.typography.titleSmall)+ Text(stringResource(R.string.settings_report_text), style = MaterialTheme.typography.bodyMedium)}Spacer(Modifier.width(16.dp))Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null)@@ -169,8 +172,8 @@ fun SettingsScreen(Icon(Icons.Default.Share, contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant)Spacer(Modifier.width(16.dp))Column(Modifier.weight(1f)) {- Text(Copy.SHARE, style = MaterialTheme.typography.titleSmall)- Text("Send someone the link to Tellyscope\u2019s GitHub page.", style = MaterialTheme.typography.bodyMedium)+ Text(Copy.SHARE.resolve(), style = MaterialTheme.typography.titleSmall)+ Text(stringResource(R.string.settings_share_hint), style = MaterialTheme.typography.bodyMedium)}Spacer(Modifier.width(16.dp))Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null)@@ -184,7 +187,7 @@ fun SettingsScreen(.padding(horizontal = 4.dp, vertical = 12.dp),verticalAlignment = Alignment.CenterVertically,) {- Text("Advanced", style = MaterialTheme.typography.titleSmall, modifier = Modifier.weight(1f))+ Text(stringResource(R.string.settings_advanced), style = MaterialTheme.typography.titleSmall, modifier = Modifier.weight(1f))Icon(if (advanced) Icons.Default.KeyboardArrowUp else Icons.Default.KeyboardArrowDown, contentDescription = null)}}@@ -193,20 +196,20 @@ fun SettingsScreen(ListsFrom(listSource, onOpen = { open(CLEANYOURTV) })HorizontalDivider(color = MaterialTheme.colorScheme.surface)Column(Modifier.fillMaxWidth().padding(16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text("Change", style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(stringResource(R.string.settings_change), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)Text(- "Paste the HTTPS raw folder that holds index.json, e.g. raw.githubusercontent.com/<you>/tellyscope-devices/main/",+ stringResource(R.string.settings_change_text),style = MaterialTheme.typography.bodyMedium,)Row(Modifier.clickable { open(OWN_LISTS_GUIDE) }.padding(vertical = 4.dp), verticalAlignment = Alignment.CenterVertically) {- Text("How to use your own lists", style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary)+ Text(stringResource(R.string.settings_own_lists_guide), style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary)Spacer(Modifier.width(4.dp))Icon(OpenInNew, contentDescription = null, Modifier.size(16.dp), tint = MaterialTheme.colorScheme.primary)}}HorizontalDivider(color = MaterialTheme.colorScheme.surface)Row(Modifier.fillMaxWidth().clickable { editing = true }.padding(16.dp), verticalAlignment = Alignment.CenterVertically) {- Text("Use your own debloat lists", style = MaterialTheme.typography.bodyLarge, modifier = Modifier.weight(1f))+ Text(stringResource(R.string.settings_own_lists), style = MaterialTheme.typography.bodyLarge, modifier = Modifier.weight(1f))Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null)}}@@ -227,7 +230,7 @@ private fun ListsFrom(source: String?, onOpen: () -> Unit) {verticalAlignment = Alignment.CenterVertically,) {Column(Modifier.weight(1f)) {- Text("Lists from", style = MaterialTheme.typography.labelMedium, color = c.onSurfaceVariant)+ Text(stringResource(R.string.settings_lists_from), style = MaterialTheme.typography.labelMedium, color = c.onSurfaceVariant)Row(verticalAlignment = Alignment.CenterVertically) {Text(if (source == null) "cleanyourtv" else sourceName(source), style = MaterialTheme.typography.titleMedium)if (source == null) {@@ -237,7 +240,7 @@ private fun ListsFrom(source: String?, onOpen: () -> Unit) {}}}- if (source == null) Icon(OpenInNew, contentDescription = "Open cleanyourtv on GitHub", tint = c.onSurfaceVariant)+ if (source == null) Icon(OpenInNew, contentDescription = stringResource(R.string.settings_open_cleanyourtv), tint = c.onSurfaceVariant)}}@@ -254,12 +257,11 @@ private fun SourceDialog(source: String?, onSave: (String?) -> Unit, onDismiss:var url by rememberSaveable { mutableStateOf(source.orEmpty()) }AlertDialog(onDismissRequest = onDismiss,- title = { Text("Where the lists come from") },+ title = { Text(stringResource(R.string.settings_source_title)) },text = {Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {Text(- "To use your own lists, fork tellyscope-devices, edit it, and paste the address of the folder that holds index.json, " +- "like https://raw.githubusercontent.com/you/tellyscope-devices/main/. Protected apps stay protected whatever a list says.",+ stringResource(R.string.settings_source_text),style = MaterialTheme.typography.bodyMedium,)OutlinedTextField(url, { url = it }, placeholder = { Text("https://…") }, singleLine = true, modifier = Modifier.fillMaxWidth())@@ -267,13 +269,13 @@ private fun SourceDialog(source: String?, onSave: (String?) -> Unit, onDismiss:},// Three actions stack full width; two sit side by side.confirmButton = {- val use = @Composable { m: Modifier -> Button(onClick = { onSave(url) }, enabled = url.isNotBlank(), modifier = m) { Text("Use these lists") } }+ val use = @Composable { m: Modifier -> Button(onClick = { onSave(url) }, enabled = url.isNotBlank(), modifier = m) { Text(stringResource(R.string.settings_use_lists)) } }if (source == null) use(Modifier) else Column(Modifier.fillMaxWidth()) {use(Modifier.fillMaxWidth())- TextButton(onClick = { onSave(null) }, Modifier.fillMaxWidth()) { Text("Reset to default") }- TextButton(onClick = onDismiss, Modifier.fillMaxWidth()) { Text("Cancel") }+ TextButton(onClick = { onSave(null) }, Modifier.fillMaxWidth()) { Text(stringResource(R.string.settings_reset)) }+ TextButton(onClick = onDismiss, Modifier.fillMaxWidth()) { Text(stringResource(R.string.settings_cancel)) }}},- dismissButton = if (source == null) ({ TextButton(onClick = onDismiss) { Text("Cancel") } }) else null,+ dismissButton = if (source == null) ({ TextButton(onClick = onDismiss) { Text(stringResource(R.string.settings_cancel)) } }) else null,)}diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.ktindex 97737e2..e98c5b1 100644--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt@@ -5,6 +5,7 @@ package app.tellyscope.uiimport android.net.Uriimport androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScope+import app.tellyscope.Rimport app.tellyscope.adb.AppFactsimport app.tellyscope.adb.ConnectionRequestimport app.tellyscope.adb.InstallKind@@ -61,6 +62,8 @@ import app.tellyscope.data.Updateimport app.tellyscope.data.FoldBookimport app.tellyscope.data.SeenBookimport app.tellyscope.data.UpdateCheck+import app.tellyscope.data.UiText+import app.tellyscope.data.whyimport kotlinx.coroutines.CancellationExceptionimport kotlinx.coroutines.CompletableDeferredimport kotlinx.coroutines.Dispatchers@@ -86,7 +89,7 @@ sealed interface RowState {data object Found : RowStatedata class Waiting(val since: Long) : RowState/** [error] is the plain sentence; [detail] is what the TV said, shown under Details. */- data class Code(val input: String = "", val busy: Boolean = false, val error: String? = null, val detail: String? = null) : RowState+ data class Code(val input: String = "", val busy: Boolean = false, val error: UiText? = null, val detail: String? = null) : RowStatedata object NotAllowed : RowState}@@ -151,7 +154,7 @@ data class DeviceUi(data class DebloatRun(val apps: List<ResetApp>,val at: Int = 0,- val failed: Map<String, String> = emptyMap(),+ val failed: Map<String, UiText> = emptyMap(),val ran: Boolean = false,)@@ -162,7 +165,7 @@ data class DebloatRun(*/data class ResetUi(val plan: ResetPlan? = null,- val error: String? = null,+ val error: UiText? = null,val running: ResetPlan? = null,val progress: ResetProgress? = null,val ran: Boolean = false,@@ -196,7 +199,7 @@ data class FireInstall(val step: Step? = null,val release: LauncherRelease? = null,val progress: Progress? = null,- val error: String? = null,+ val error: UiText? = null,val store: Boolean = false,val picked: Boolean = false,val until: Long? = null,@@ -220,7 +223,7 @@ data class Removal(/** The TV said no to this phone (Cancel, or the prompt timed out): offer to ask again. */val refused: Boolean = false,/** Who is still there, for [Step.StillConnected]: "a connection from …", or a computer's name. */- val still: String? = null,+ val still: UiText? = null,/** [still] is a connection left open, which only a restart ends; false when a computer was allowed again. */val open: Boolean = false,) {@@ -235,7 +238,7 @@ data class SideloadUi(/** Set only by the user's own tick on the downgrade warning. */val allowDowngrade: Boolean = false,val progress: Progress? = null,- val error: String? = null,+ val error: UiText? = null,/** The TV's own words for a refusal, shown small under the explanation. */val detail: String? = null,) {@@ -259,7 +262,7 @@ data class ReportUi(/** What the entry point already knows, to start the user's details: the app that failed to install. */val details: String = "",/** This session's messages, then the TV's own words for a failed install. */- val log: String? = null,+ val log: UiText? = null,/** Opened on GitHub with something cut: the screen offers to add it as a comment. */val posted: Report? = null,)@@ -268,7 +271,7 @@ data class FilesUi(val folder: TvFolder = TvFolder.DOWNLOAD,/** Null while loading. */val list: List<TvFile>? = null,- val error: String? = null,+ val error: UiText? = null,)data class TransferUi(val name: String, val toTv: Boolean, val folder: TvFolder, val progress: Progress? = null)@@ -375,7 +378,7 @@ fun outcome(access: TvAccess?): Removal = when {access?.connected == null || access.allowed == null -> Removal(Removal.Step.Unconfirmed)access.onlyThisPhone -> Removal(Removal.Step.Done)else -> access.others.firstOrNull()?.let { Removal(Removal.Step.StillConnected, still = Copy.connectionFrom(it.address), open = true) }- ?: Removal(Removal.Step.StillConnected, still = access.allowed.firstOrNull { !it.phone }?.let { it.name ?: Copy.UNNAMED_COMPUTER })+ ?: Removal(Removal.Step.StillConnected, still = access.allowed.firstOrNull { !it.phone }?.let { it.name?.let(UiText::Raw) ?: Copy.UNNAMED_COMPUTER })}class TellyscopeViewModel(@@ -407,11 +410,11 @@ class TellyscopeViewModel(val done: StateFlow<Done?> = _done.asStateFlow()/** One-shot snackbar lines: the TV refused, went away mid-action, or a restore or copy finished. */- private val _notice = MutableStateFlow<String?>(null)- val notice: StateFlow<String?> = _notice.asStateFlow()+ private val _notice = MutableStateFlow<UiText?>(null)+ val notice: StateFlow<UiText?> = _notice.asStateFlow()/** This session's messages, newest last, for a report's log. Kept in memory only. */- private val sessionLog = ArrayDeque<String>()+ private val sessionLog = ArrayDeque<UiText>()/** Last stats per TV, so an offline page shows where it stood instead of blanks. Lives as long as the app. */private val lastSnapshot = mutableMapOf<String, Snapshot>()@@ -623,17 +626,17 @@ class TellyscopeViewModel(is ConnectResult.WrongCode -> setRow(hit.ip, row.copy(busy = false, error = Copy.WRONG_CODE, detail = r.message))is ConnectResult.Unreachable -> setRow(hit.ip, row.copy(busy = false, error = Copy.UNREACHABLE, detail = r.message))ConnectResult.NotAllowed -> setRow(hit.ip, row.copy(busy = false, error = Copy.PAIR_INSTEAD))- ConnectResult.NeedsPairing -> setRow(hit.ip, row.copy(busy = false, error = "The TV still wants a code. Check the number on screen and try again."))+ ConnectResult.NeedsPairing -> setRow(hit.ip, row.copy(busy = false, error = UiText(R.string.vm_still_wants_code)))}}}/** "Add by IP": `ip` or `ip:port`. Returns an error line, or null when the connect started. */- fun addByIp(text: String): String? {+ fun addByIp(text: String): UiText? {val m = Regex("""^(\d{1,3}(?:\.\d{1,3}){3})(?::(\d{1,5}))?$""").find(text.trim())- ?: return "That doesn't look like an IP address. It should look like four numbers with dots, like the one in your TV's network settings."+ ?: return UiText(R.string.vm_not_an_ip)val port = m.groupValues[2].toIntOrNull() ?: 5555- if (port !in 1..65535) return "The port after the colon should be a number from 1 to 65535, like 5555."+ if (port !in 1..65535) return UiText(R.string.vm_bad_port)val kind = if (port == 5555) app.tellyscope.data.ScanKind.Classic else app.tellyscope.data.ScanKind.Wirelessval hit = ScanHit(m.groupValues[1], port, kind, null, null)_state.update { s ->@@ -827,7 +830,7 @@ class TellyscopeViewModel(} catch (e: CancellationException) {throw e} catch (e: Exception) {- _notice.value = e.message?.replaceFirstChar(Char::uppercase) ?: "That didn't work."+ _notice.value = UiText.Capitalized(e.why(R.string.vm_didnt_work))rereadAfterFailure(id)return@launch}@@ -1142,7 +1145,7 @@ class TellyscopeViewModel(val history = source.history(id)updateDevice(id) { it.copy(busy = null, history = history) }undoing?.let(undoInFlight::remove) // a failed Undo can be tried again- _notice.value = e.message?.replaceFirstChar(Char::uppercase) ?: "That didn't work."+ _notice.value = UiText.Capitalized(e.why(R.string.vm_didnt_work))return@launch}val history = source.history(id)@@ -1160,7 +1163,7 @@ class TellyscopeViewModel(} catch (e: CancellationException) {throw e} catch (e: Exception) {- e.message?.replaceFirstChar(Char::uppercase) ?: "That didn't work."+ UiText.Capitalized(e.why(R.string.vm_didnt_work))}val history = source.history(id)updateDevice(id) { it.copy(busy = null, history = history) }@@ -1213,7 +1216,7 @@ class TellyscopeViewModel(undoing?.let(undoInFlight::remove) // a failed Undo can be tried again// A reset's Undo can get partway, so History shows where it ended.if (undoing != null) runCatching { source.history(id) }.getOrNull()?.let { h -> updateDevice(id) { it.copy(history = h) } }- _notice.value = e.message?.replaceFirstChar(Char::uppercase) ?: "That didn't work."+ _notice.value = UiText.Capitalized(e.why(R.string.vm_didnt_work))rereadAfterFailure(id)return@launch}@@ -1277,15 +1280,15 @@ class TellyscopeViewModel(runCatching { source.apps(id) }.onSuccess { apps -> updateDevice(id) { it.copy(apps = apps) } }}is InstallResult.Refused -> updateDevice(id) {- log("Install ${app.info.packageName} ${app.info.versionName.orEmpty()}: ${r.detail ?: r.reason}")+ log(UiText.Raw("Install ${app.info.packageName} ${app.info.versionName.orEmpty()}: ${r.detail ?: r.reason}"))it.copy(sideload = ready.copy(step = SideloadUi.Step.Failed, error = Copy.installRefused(r.reason, app.label), detail = r.detail))}}}}- private fun log(line: String) = synchronized(sessionLog) {- sessionLog.addLast(SimpleDateFormat("HH:mm:ss", Locale.ROOT).format(Date(clock())) + " " + line)+ private fun log(line: UiText) = synchronized(sessionLog) {+ sessionLog.addLast(UiText.Join(listOf(UiText.Raw(SimpleDateFormat("HH:mm:ss", Locale.ROOT).format(Date(clock()))), line), " "))while (sessionLog.size > LOG_LINES) sessionLog.removeFirst()}@@ -1295,13 +1298,13 @@ class TellyscopeViewModel(*/fun openReport(kind: ReportKind, details: String = "", said: String? = null) {val tv = _state.value.selected?.takeIf { it.state == DeviceState.Online }- val log = synchronized(sessionLog) { sessionLog.toList() } + listOfNotNull(said?.let { "The TV said: $it" })+ val log = synchronized(sessionLog) { sessionLog.toList() } + listOfNotNull(said?.let { UiText(R.string.vm_report_tv_said, it) })val connection = when (tv?.hit?.kind) {ScanKind.Classic -> Reports.Connection.PORT_5555ScanKind.Wireless -> Reports.Connection.WIRELESS_DEBUGGINGnull -> Reports.Connection.COULD_NOT_CONNECT}- _state.update { it.copy(report = ReportUi(kind, appFacts, connection, reading = tv != null, details = details, log = log.joinToString("\n").ifEmpty { null })) }+ _state.update { it.copy(report = ReportUi(kind, appFacts, connection, reading = tv != null, details = details, log = log.takeIf { it.isNotEmpty() }?.let { UiText.Join(it, "\n") })) }tv ?: returnviewModelScope.launch {val facts = try { source.facts(tv.id) } catch (e: CancellationException) { throw e } catch (_: Exception) { null }@@ -1455,11 +1458,11 @@ class TellyscopeViewModel(viewModelScope.launch {_notice.value = try {val n = source.restoreAll(id).size- if (n == 0) "Nothing to turn back on." else "Turned $n ${if (n == 1) "app" else "apps"} back on."+ if (n == 0) UiText(R.string.vm_nothing_to_turn_on) else UiText.plural(R.plurals.vm_turned_back_on, n)} catch (e: CancellationException) {throw e} catch (e: Exception) {- e.message?.replaceFirstChar(Char::uppercase) ?: "That didn't work."+ UiText.Capitalized(e.why(R.string.vm_didnt_work))}val apps = runCatching { source.apps(id) }.getOrNull()val history = source.history(id)@@ -1729,7 +1732,7 @@ class TellyscopeViewModel(} catch (e: CancellationException) {throw e} catch (e: Exception) {- _notice.value = e.message?.replaceFirstChar(Char::uppercase) ?: "That didn't work."+ _notice.value = UiText.Capitalized(e.why(R.string.vm_didnt_work))return@launch}val now = source.listSource()@@ -1798,7 +1801,7 @@ class TellyscopeViewModel(throw e} catch (e: Exception) {// The TV refused this one or dropped; its row says why.- e.message ?: "the TV refused"+ e.why(R.string.vm_tv_refused)}updateDevice(id) { d ->d.copy(debloat = d.debloat?.let { r -> r.copy(at = r.at + 1, failed = if (why == null) r.failed else r.failed + (app.packageName to why)) })@@ -1905,7 +1908,7 @@ class TellyscopeViewModel(} catch (e: CancellationException) {throw e} catch (e: Exception) {- ResetUi(error = e.message?.replaceFirstChar(Char::uppercase) ?: "The TV didn't answer.")+ ResetUi(error = UiText.Capitalized(e.why(R.string.vm_tv_didnt_answer)))}updateDevice(id) { d -> d.copy(reset = d.reset?.let { ui }) }}@@ -1931,7 +1934,7 @@ class TellyscopeViewModel(throw e} catch (e: Exception) {// The TV went away before any step could say: every step it was to run failed.- val why = e.message ?: "the TV didn't answer"+ val why = e.why(R.string.vm_tv_didnt_answer_reason)ui.entry to todo.turnOn.map { ResetFailure(ResetPart.TurnOn, it, why) } +todo.bringBack.map { ResetFailure(ResetPart.BringBack, it, why) } +listOfNotNull(todo.home?.let { ResetFailure(ResetPart.Home, null, why) })@@ -1997,7 +2000,7 @@ class TellyscopeViewModel(}/** Types on the TV. Returns why it can't, or null once it's on its way. */- fun type(text: String): String? {+ fun type(text: String): UiText? {if (!Remote.typeable(text)) return Copy.cantType(text)val id = _state.value.selectedId ?: return nullviewModelScope.launch {diff --git a/app/src/main/java/app/tellyscope/ui/Transfers.kt b/app/src/main/java/app/tellyscope/ui/Transfers.ktindex 1538533..e0cb847 100644--- a/app/src/main/java/app/tellyscope/ui/Transfers.kt+++ b/app/src/main/java/app/tellyscope/ui/Transfers.kt@@ -50,6 +50,10 @@ import app.tellyscope.adb.InstallKindimport app.tellyscope.adb.TvFileimport app.tellyscope.adb.TvFolderimport app.tellyscope.ui.theme.SmallNumber+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResource+import app.tellyscope.R+import app.tellyscope.data.resolve/*** Both dialogs here close only through their own buttons: a tap outside or Back would otherwise@@ -65,20 +69,20 @@ internal val Sticky = DialogProperties(dismissOnBackPress = false, dismissOnClic@Composablefun 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(Icons.Default.Add, stringResource(R.string.transfers_install_app), actions.pickApp, Modifier.weight(1f))Tile(- Broom, if (disabling) "Disabling…" else "Debloat", onDebloat, Modifier.weight(1f),+ Broom, if (disabling) stringResource(R.string.transfers_disabling) else stringResource(R.string.transfers_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)) {@Suppress("DEPRECATION") // the AutoMirrored set isn't in icons-core- Tile(Icons.Default.Send, "Send file", { choosing = true }, Modifier.fillMaxWidth())+ Tile(Icons.Default.Send, stringResource(R.string.transfers_send_file), { choosing = true }, Modifier.fillMaxWidth())DropdownMenu(choosing, onDismissRequest = { choosing = false }) {TvFolder.entries.forEach { f ->DropdownMenuItem(- text = { Text("To ${Copy.folder(f)}") },+ text = { Text(stringResource(R.string.transfers_to_folder, Copy.folder(f).resolve())) },onClick = { choosing = false; actions.pickFile(f) },)}@@ -149,11 +153,11 @@ fun FilesBlock(files: FilesUi, now: Long, actions: DeviceActions) {@OptIn(ExperimentalMaterial3ExpressiveApi::class)LoadingIndicator(Modifier.size(32.dp))}- files.error != null -> Muted(files.error)+ files.error != null -> Muted(files.error.resolve())else -> {list.forEach { f -> FileRow(f, now) { actions.saveFile(f) } }// Only with files to tap; an empty folder shows its own page instead.- if (list.isNotEmpty()) Muted("Tap a file to save a copy on your phone.")+ if (list.isNotEmpty()) Muted(stringResource(R.string.transfers_tap_to_save))}}}@@ -167,12 +171,12 @@ private fun FileRow(f: TvFile, now: Long, onSave: () -> Unit) {Column(Modifier.weight(1f)) {Text(f.name, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.MiddleEllipsis)Text(- "${Copy.bytes(f.size)} · ${Copy.ago(f.modifiedMillis, now)}",+ "${Copy.bytes(f.size).resolve()} · ${Copy.ago(f.modifiedMillis, now).resolve()}",style = MaterialTheme.typography.bodySmall,color = MaterialTheme.colorScheme.onSurfaceVariant,)}- TextButton(onClick = onSave) { Text("Save") }+ TextButton(onClick = onSave) { Text(stringResource(R.string.transfers_save)) }}}@@ -197,9 +201,9 @@ fun SideloadDialog(s: SideloadUi, actions: DeviceActions) {title = {Text(when (s.step) {- SideloadUi.Step.Reading -> "Reading the app"- SideloadUi.Step.Failed -> app?.let { "Couldn't install ${it.label}" } ?: "Can't install that"- SideloadUi.Step.Installed -> Copy.installed(kind ?: InstallKind.NEW, app?.label.orEmpty())+ SideloadUi.Step.Reading -> stringResource(R.string.transfers_reading)+ SideloadUi.Step.Failed -> app?.let { stringResource(R.string.transfers_install_failed, it.label) } ?: stringResource(R.string.transfers_cant_install)+ SideloadUi.Step.Installed -> Copy.installed(kind ?: InstallKind.NEW, app?.label.orEmpty()).resolve()else -> app?.label.orEmpty()},)@@ -214,9 +218,9 @@ fun SideloadDialog(s: SideloadUi, actions: DeviceActions) {Text(app.info.packageName, style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant)Text(listOfNotNull(- "Version ${app.info.versionName ?: app.info.versionCode}",- Copy.bytes(app.sizeBytes),- if (app.files.size > 1) "${app.files.size} parts" else null,+ stringResource(R.string.transfers_version, app.info.versionName ?: app.info.versionCode),+ Copy.bytes(app.sizeBytes).resolve(),+ if (app.files.size > 1) pluralStringResource(R.plurals.transfers_parts, app.files.size, app.files.size) else null,).joinToString(" · "),style = SmallNumber,color = MaterialTheme.colorScheme.onSurfaceVariant,@@ -225,7 +229,7 @@ fun SideloadDialog(s: SideloadUi, actions: DeviceActions) {}when (s.step) {SideloadUi.Step.Ready -> if (kind != null) {- Text(Copy.installKind(kind, s.installed?.versionName, app?.info?.versionName), style = MaterialTheme.typography.bodyMedium)+ Text(Copy.installKind(kind, s.installed?.versionName, app?.info?.versionName).resolve(), style = MaterialTheme.typography.bodyMedium)if (kind == InstallKind.DOWNGRADE) {Row(Modifier.fillMaxWidth().clickable { actions.allowDowngrade(!s.allowDowngrade) },@@ -233,7 +237,7 @@ fun SideloadDialog(s: SideloadUi, actions: DeviceActions) {) {Checkbox(s.allowDowngrade, onCheckedChange = null)Spacer(Modifier.width(12.dp))- Text(Copy.ALLOW_DOWNGRADE, style = MaterialTheme.typography.bodyMedium)+ Text(Copy.ALLOW_DOWNGRADE.resolve(), style = MaterialTheme.typography.bodyMedium)}}}@@ -244,15 +248,15 @@ fun SideloadDialog(s: SideloadUi, actions: DeviceActions) {if (sending) LinearWavyProgressIndicator(progress = { f }, Modifier.fillMaxWidth())else LinearWavyProgressIndicator(Modifier.fillMaxWidth())Text(- if (sending) "Sending to the TV · ${(f * 100).toInt()}%" else "Installing on the TV…",+ if (sending) stringResource(R.string.transfers_sending_percent, (f * 100).toInt()) else stringResource(R.string.transfers_installing),style = MaterialTheme.typography.bodyMedium,)- Muted(Copy.INSTALL_KEEP_OPEN)+ Muted(Copy.INSTALL_KEEP_OPEN.resolve())}SideloadUi.Step.Failed -> {- Text(s.error.orEmpty(), style = MaterialTheme.typography.bodyMedium)+ Text(s.error?.resolve().orEmpty(), style = MaterialTheme.typography.bodyMedium)s.detail?.takeIf { it.isNotBlank() }?.let {- Text("The TV said: $it", style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 4, overflow = TextOverflow.Ellipsis)+ Text(stringResource(R.string.transfers_tv_said, it), style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 4, overflow = TextOverflow.Ellipsis)}}else -> Unit@@ -264,17 +268,17 @@ fun SideloadDialog(s: SideloadUi, actions: DeviceActions) {SideloadUi.Step.Ready -> if (kind != null) Button(onClick = actions.install,enabled = kind != InstallKind.DOWNGRADE || s.allowDowngrade,- ) { Text(Copy.installButton(kind)) }- SideloadUi.Step.Installed -> Button(onClick = actions.openInstalled) { Text("Open on TV") }- SideloadUi.Step.Failed -> Button(onClick = actions.closeSideload) { Text("OK") }+ ) { Text(Copy.installButton(kind).resolve()) }+ SideloadUi.Step.Installed -> Button(onClick = actions.openInstalled) { Text(stringResource(R.string.transfers_open_on_tv)) }+ SideloadUi.Step.Failed -> Button(onClick = actions.closeSideload) { Text(stringResource(R.string.transfers_ok)) }else -> Unit}},dismissButton = {when (s.step) {- SideloadUi.Step.Reading, SideloadUi.Step.Ready -> TextButton(onClick = actions.closeSideload) { Text("Cancel") }- SideloadUi.Step.Installed -> TextButton(onClick = actions.closeSideload) { Text("Done") }- SideloadUi.Step.Failed -> TextButton(onClick = { actions.reportInstall(s) }) { Text("Report a problem") }+ SideloadUi.Step.Reading, SideloadUi.Step.Ready -> TextButton(onClick = actions.closeSideload) { Text(stringResource(R.string.transfers_cancel)) }+ SideloadUi.Step.Installed -> TextButton(onClick = actions.closeSideload) { Text(stringResource(R.string.transfers_done)) }+ SideloadUi.Step.Failed -> TextButton(onClick = { actions.reportInstall(s) }) { Text(stringResource(R.string.transfers_report)) }else -> Unit}},@@ -288,7 +292,7 @@ fun TransferDialog(t: TransferUi, onCancel: () -> Unit) {AlertDialog(onDismissRequest = {},properties = Sticky,- title = { Text(if (t.toTv) "Sending to ${Copy.folder(t.folder)}" else "Saving to your phone") },+ title = { Text(if (t.toTv) stringResource(R.string.transfers_sending_to, Copy.folder(t.folder).resolve()) else stringResource(R.string.transfers_saving)) },text = {Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {Text(t.name, style = MaterialTheme.typography.bodyLarge, maxLines = 2, overflow = TextOverflow.MiddleEllipsis)@@ -296,13 +300,13 @@ fun TransferDialog(t: TransferUi, onCancel: () -> Unit) {if (f != null) LinearWavyProgressIndicator(progress = { f }, Modifier.fillMaxWidth())else LinearWavyProgressIndicator(Modifier.fillMaxWidth())Text(- t.progress?.let { p -> p.total?.let { "${Copy.bytes(p.done)} of ${Copy.bytes(it)}" } ?: Copy.bytes(p.done) } ?: "Starting…",+ t.progress?.let { p -> p.total?.let { stringResource(R.string.transfers_progress, Copy.bytes(p.done).resolve(), Copy.bytes(it).resolve()) } ?: Copy.bytes(p.done).resolve() } ?: stringResource(R.string.transfers_starting),style = SmallNumber,color = MaterialTheme.colorScheme.onSurfaceVariant,)}},confirmButton = {},- dismissButton = { TextButton(onClick = onCancel) { Text("Cancel") } },+ dismissButton = { TextButton(onClick = onCancel) { Text(stringResource(R.string.transfers_cancel)) } },)}diff --git a/app/src/main/java/app/tellyscope/ui/TvHeader.kt b/app/src/main/java/app/tellyscope/ui/TvHeader.ktindex a2e1f4d..78c87cb 100644--- a/app/src/main/java/app/tellyscope/ui/TvHeader.kt+++ b/app/src/main/java/app/tellyscope/ui/TvHeader.kt@@ -59,6 +59,7 @@ import androidx.compose.ui.layout.layoutimport androidx.compose.ui.layout.onGloballyPositionedimport androidx.compose.ui.layout.onSizeChangedimport androidx.compose.ui.layout.positionInRoot+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.semantics.clearAndSetSemanticsimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.style.TextOverflow@@ -67,10 +68,12 @@ import androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.dpimport androidx.compose.ui.unit.toSizeimport androidx.compose.ui.util.lerp+import app.tellyscope.Rimport app.tellyscope.data.Deviceimport app.tellyscope.data.DeviceStateimport app.tellyscope.data.Snapshotimport app.tellyscope.data.deviceKind+import app.tellyscope.data.resolve/** The TV's header, shared by the tabs that lead with the TV: the big hero, which collapses as the@@ -172,7 +175,7 @@ fun TvHero(state: UiState, live: Snapshot?, actions: DeviceActions, chips: BooleIcon(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)+ Text((health?.text ?: Copy.state(device.state)).resolve(), style = MaterialTheme.typography.labelLarge)}}}@@ -214,7 +217,7 @@ fun TvBarTitle(device: Device, collapse: () -> Float, morph: HeroMorph, modifierRow(Modifier.padding(horizontal = 8.dp, vertical = 2.dp), verticalAlignment = Alignment.CenterVertically) {StateDot(device.state)Spacer(Modifier.width(6.dp))- Text(Copy.state(device.state), style = MaterialTheme.typography.labelMedium)+ Text(Copy.state(device.state).resolve(), style = MaterialTheme.typography.labelMedium)}}}@@ -261,7 +264,7 @@ internal fun HeroMorphOverlay(device: Device, morph: HeroMorph, collapse: () ->@Composableprivate fun LoggedOutBadge() {Box(Modifier.size(14.dp).clip(CircleShape).background(MaterialTheme.colorScheme.error), contentAlignment = Alignment.Center) {- Icon(DeviceIcons.Logout, contentDescription = Copy.LOGGED_OUT, Modifier.size(10.dp), tint = MaterialTheme.colorScheme.onError)+ Icon(DeviceIcons.Logout, contentDescription = Copy.LOGGED_OUT.resolve(), Modifier.size(10.dp), tint = MaterialTheme.colorScheme.onError)}}@@ -291,7 +294,7 @@ private fun TvChips(state: UiState, actions: DeviceActions) {)}// 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)) })+ AssistChip(onClick = actions.addDevice, label = { Text(stringResource(R.string.header_add_device_label)) }, leadingIcon = { Icon(Icons.Default.Add, contentDescription = stringResource(R.string.header_add_device_icon), Modifier.size(18.dp)) })}}@@ -352,8 +355,9 @@ internal fun AppsLoading() {Column(Modifier.fillMaxWidth().padding(top = 96.dp, bottom = 24.dp), horizontalAlignment = Alignment.CenterHorizontally) {ContainedLoadingIndicator(Modifier.size(56.dp))Spacer(Modifier.height(16.dp))- Text(Copy.READING_APPS, style = MaterialTheme.typography.titleSmall, textAlign = TextAlign.Center)+ Text(Copy.READING_APPS.resolve(), style = MaterialTheme.typography.titleSmall, textAlign = TextAlign.Center)Spacer(Modifier.height(4.dp))- Text(Copy.READING_APPS_LINE, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.Center)+ Text(Copy.READING_APPS_LINE.resolve(), style+ = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.Center)}}diff --git a/app/src/main/java/app/tellyscope/ui/TweaksBlock.kt b/app/src/main/java/app/tellyscope/ui/TweaksBlock.ktindex be4c7a0..ca7136d 100644--- a/app/src/main/java/app/tellyscope/ui/TweaksBlock.kt+++ b/app/src/main/java/app/tellyscope/ui/TweaksBlock.kt@@ -26,11 +26,14 @@ import androidx.compose.runtime.saveable.rememberSaveableimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.semantics.Roleimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.adb.Tweakimport app.tellyscope.adb.Tweaksimport app.tellyscope.data.TvSettings+import app.tellyscope.data.resolve/*** Whole-TV settings and housekeeping. The two switches land in History with Undo; clearing@@ -44,19 +47,19 @@ fun TweaksBlock(ui: DeviceUi, actions: DeviceActions) {if (ui.busy in TWEAK_BUSY) LinearProgressIndicator(Modifier.fillMaxWidth())val dnsOk = tweaks?.dnsSupported != falseSwitchRow(- Copy.DNS_TITLE,- if (dnsOk) Copy.dnsState(tweaks?.dnsHost) else Copy.DNS_TOO_OLD,+ Copy.DNS_TITLE.resolve(),+ if (dnsOk) Copy.dnsState(tweaks?.dnsHost).resolve() else Copy.DNS_TOO_OLD.resolve(),dnsOn,enabled = tweaks != null && dnsOk && ui.busy == null,) { on ->if (on) askDns = true else actions.setDns(null)}val fast = tweaks?.animationScale == TvSettings.FAST- SwitchRow(Copy.ANIMATIONS_TITLE, Copy.animationsState(tweaks?.animationScale), fast, enabled = tweaks != null && ui.busy == null) {+ SwitchRow(Copy.ANIMATIONS_TITLE.resolve(), Copy.animationsState(tweaks?.animationScale).resolve(), fast, enabled = tweaks != null && ui.busy == null) {actions.setFastAnimations(it)}- ButtonRow(Copy.CACHES_TITLE, Copy.CACHES_TEXT, Copy.CACHES_BUTTON, enabled = ui.busy == null, actions.clearCaches)- ButtonRow(Copy.SCREENSHOT_TITLE, Copy.SCREENSHOT_TEXT, Copy.SCREENSHOT_BUTTON, enabled = ui.busy == null, actions.screenshot)+ ButtonRow(Copy.CACHES_TITLE.resolve(), Copy.CACHES_TEXT.resolve(), Copy.CACHES_BUTTON.resolve(), enabled = ui.busy == null, actions.clearCaches)+ ButtonRow(Copy.SCREENSHOT_TITLE.resolve(), Copy.SCREENSHOT_TEXT.resolve(), Copy.SCREENSHOT_BUTTON.resolve(), enabled = ui.busy == null, actions.screenshot)if (askDns) DnsDialog(onDismiss = { askDns = false }) { host -> askDns = false; actions.setDns(host) }}@@ -92,22 +95,22 @@ private fun DnsDialog(onDismiss: () -> Unit, onConfirm: (String) -> Unit) {val valid = Tweaks.isHostname(host.trim())AlertDialog(onDismissRequest = onDismiss,- title = { Text(Copy.DNS_DIALOG) },+ title = { Text(Copy.DNS_DIALOG.resolve()) },text = {Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {- Text(Copy.DNS_TEXT)+ Text(Copy.DNS_TEXT.resolve())OutlinedTextField(value = host,onValueChange = { host = it },- label = { Text(Copy.DNS_FIELD) },+ label = { Text(Copy.DNS_FIELD.resolve()) },singleLine = true,isError = !valid,- supportingText = { if (!valid) Text(Copy.DNS_BAD) },+ supportingText = { if (!valid) Text(Copy.DNS_BAD.resolve()) },)}},- confirmButton = { Button(onClick = { onConfirm(host.trim()) }, enabled = valid) { Text(Copy.DNS_CONFIRM) } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ confirmButton = { Button(onClick = { onConfirm(host.trim()) }, enabled = valid) { Text(Copy.DNS_CONFIRM.resolve()) } },+ dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.screen_cancel)) } },)}diff --git a/app/src/main/java/app/tellyscope/ui/UpdateDialog.kt b/app/src/main/java/app/tellyscope/ui/UpdateDialog.ktindex ced5228..fdee7a1 100644--- a/app/src/main/java/app/tellyscope/ui/UpdateDialog.kt+++ b/app/src/main/java/app/tellyscope/ui/UpdateDialog.kt@@ -14,12 +14,14 @@ import androidx.compose.material3.Textimport androidx.compose.material3.TextButtonimport androidx.compose.runtime.Composableimport androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.AnnotatedStringimport androidx.compose.ui.text.SpanStyleimport androidx.compose.ui.text.buildAnnotatedStringimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.withStyleimport androidx.compose.ui.unit.dp+import app.tellyscope.Rimport app.tellyscope.data.Update/** A newer release is out. Get it opens its GitHub page; the app never downloads it itself. */@@ -27,18 +29,18 @@ import app.tellyscope.data.Updatefun UpdateDialog(update: Update, onGet: () -> Unit, onLater: () -> Unit, onSkip: () -> Unit) {AlertDialog(onDismissRequest = onLater,- title = { Text("🎉 Tellyscope ${update.version} is out") },+ title = { Text(stringResource(R.string.update_title, update.version)) },text = {Column(Modifier.heightIn(max = 320.dp).verticalScroll(rememberScrollState())) {- Text(boldSpans(dialogNotes(update.notes).ifEmpty { "No release notes." }), style = MaterialTheme.typography.bodyMedium)+ Text(boldSpans(dialogNotes(update.notes, stringResource(R.string.update_more_notes)).ifEmpty { stringResource(R.string.update_no_notes) }), style = MaterialTheme.typography.bodyMedium)}},// Three actions stack full width.confirmButton = {Column(Modifier.fillMaxWidth()) {- Button(onClick = onGet, Modifier.fillMaxWidth()) { Text("Get it") }- TextButton(onClick = onSkip, Modifier.fillMaxWidth()) { Text("Skip this version") }- TextButton(onClick = onLater, Modifier.fillMaxWidth()) { Text("Later") }+ Button(onClick = onGet, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_get)) }+ TextButton(onClick = onSkip, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_skip)) }+ TextButton(onClick = onLater, Modifier.fillMaxWidth()) { Text(stringResource(R.string.update_later)) }}},)@@ -46,13 +48,13 @@ fun UpdateDialog(update: Update, onGet: () -> Unit, onLater: () -> Unit, onSkip:/*** release.yml's body as plain lines: the CHANGELOG part (prod) or the alpha line, without the- * commit list, code ticks or the trailing PR links, capped at [max] lines. `**` stays for [boldSpans].+ * commit list, code ticks or the trailing PR links, capped at [max] lines, then [more]. `**` stays for [boldSpans].*/-internal fun dialogNotes(body: String, max: Int = 12): String {+internal fun dialogNotes(body: String, more: String, max: Int = 12): String {val lines = body.substringBefore("### Commits").lines().map { it.replace("`", "").replace(PR_LINK, "").trimEnd() }.filter { it.isNotBlank() }- return (if (lines.size > max) lines.take(max) + "…and more on GitHub" else lines).joinToString("\n")+ return (if (lines.size > max) lines.take(max) + more else lines).joinToString("\n")}private val PR_LINK = Regex("""\s*\[#\d+]\([^)]*\)\s*$""")diff --git a/app/src/main/java/app/tellyscope/ui/WelcomeScreen.kt b/app/src/main/java/app/tellyscope/ui/WelcomeScreen.ktindex 4a91ce4..3462093 100644--- a/app/src/main/java/app/tellyscope/ui/WelcomeScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/WelcomeScreen.kt@@ -31,6 +31,7 @@ import androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clipimport androidx.compose.ui.res.colorResourceimport androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dpimport app.tellyscope.Rimport app.tellyscope.ui.theme.SmallNumber@@ -48,8 +49,8 @@ fun WelcomeScreen(askLocalNetwork: Boolean, onContinue: () -> Unit, onSkip: () -horizontalArrangement = Arrangement.SpaceBetween,verticalAlignment = Alignment.CenterVertically,) {- TextButton(onClick = onSkip) { Text("Skip") }- Button(onClick = onContinue) { Text("Continue") }+ TextButton(onClick = onSkip) { Text(stringResource(R.string.welcome_skip)) }+ Button(onClick = onContinue) { Text(stringResource(R.string.screen_continue)) }}},) { pad ->@@ -65,9 +66,9 @@ fun WelcomeScreen(askLocalNetwork: Boolean, onContinue: () -> Unit, onSkip: () -// The foreground keeps its art inside the adaptive-icon safe zone; oversize it so the art fills the tile.Image(painterResource(R.drawable.ic_launcher_foreground), contentDescription = null, Modifier.requiredSize(108.dp))}- Text("Welcome to Tellyscope", style = MaterialTheme.typography.headlineMedium)+ Text(stringResource(R.string.welcome_title), style = MaterialTheme.typography.headlineMedium)Text(- "See what's running on your Android TV, and turn off the apps you don't need. All from your phone, over Wi-Fi.",+ stringResource(R.string.welcome_text),style = MaterialTheme.typography.bodyLarge,)Card(@@ -79,14 +80,14 @@ fun WelcomeScreen(askLocalNetwork: Boolean, onContinue: () -> Unit, onSkip: () -Row {Text("${i + 1}", Modifier.alignByBaseline(), style = SmallNumber, color = MaterialTheme.colorScheme.primary)Spacer(Modifier.width(12.dp))- Text(step, Modifier.alignByBaseline(), style = MaterialTheme.typography.bodyLarge)+ Text(stringResource(step), Modifier.alignByBaseline(), style = MaterialTheme.typography.bodyLarge)}}}}if (askLocalNetwork) {Text(- "Android asks before an app talks to other devices on your Wi-Fi. Tellyscope only connects to the TVs you pick.",+ stringResource(R.string.permission_local_network_text),style = MaterialTheme.typography.bodySmall,color = MaterialTheme.colorScheme.onSurfaceVariant,)@@ -96,7 +97,7 @@ fun WelcomeScreen(askLocalNetwork: Boolean, onContinue: () -> Unit, onSkip: () -}private val steps = listOf(- "Turn on debugging on your TV. The next screen shows how for your brand.",- "Tellyscope finds the TV on your Wi-Fi.",- "Type the code the TV shows, or choose Allow when it asks.",+ R.string.welcome_step_1,+ R.string.welcome_step_2,+ R.string.welcome_step_3,)diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex b028cbf..edab66e 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -1,5 +1,1382 @@+<?xml version="1.0" encoding="utf-8"?><resources><string name="app_name" translatable="false">Tellyscope</string>++ <!-- copy -->++ <!-- App actions: button, confirm, explanation, result -->+ <string name="copy_button_stop">Stop</string>+ <string name="copy_button_disable">Disable</string>+ <string name="copy_button_enable">Turn on</string>+ <string name="copy_button_open">Open</string>+ <string name="copy_button_uninstall">Uninstall</string>++ <string name="copy_confirm_stop">Yes, stop it</string>+ <string name="copy_confirm_disable">Yes, disable it</string>+ <string name="copy_confirm_enable">Yes, turn it on</string>+ <string name="copy_confirm_open">Yes, open it</string>+ <string name="copy_confirm_uninstall">Yes, uninstall it</string>+ <string name="copy_confirm_home">Yes, switch home screen</string>+ <string name="copy_confirm_home_back">Yes, switch back</string>++ <!-- %1$s is the app's label, %2$s its package id -->+ <string name="copy_explain_stop">Stops %1$s (%2$s) until you open it again.</string>+ <string name="copy_explain_disable">Hides %1$s (%2$s) and stops it running. Nothing is deleted; you can turn it back on here.</string>+ <string name="copy_explain_enable">Turns %1$s (%2$s) back on.</string>+ <string name="copy_explain_open">Opens %1$s (%2$s) on the TV.</string>+ <string name="copy_explain_uninstall">Removes %1$s (%2$s) and everything saved in it. This can\'t be undone; to get it back, install it again.</string>++ <string name="copy_done_stop">Stopped %1$s</string>+ <string name="copy_done_disable">Disabled %1$s</string>+ <string name="copy_done_enable">Turned on %1$s</string>+ <string name="copy_done_open">Opened %1$s</string>+ <string name="copy_done_uninstall">Uninstalled %1$s</string>+ <string name="copy_done_clear_caches">Cleared %1$s</string>+ <string name="copy_done_home">Made %1$s Home</string>+ <string name="copy_done_home_back">Switched home back to %1$s</string>++ <string name="copy_keep_warning">This TV\'s list says to keep this.</string>++ <string name="copy_list_source_default">Lists from tellyscope-devices, built from cleanyourtv</string>+ <!-- %1$s is where a custom list comes from, like a GitHub repo -->+ <string name="copy_list_source_custom">Lists from %1$s</string>++ <!-- Home screen card -->+ <string name="copy_home_screen">Home screen</string>+ <string name="copy_opens_on_home">%1$s opens when you press Home.</string>+ <string name="copy_no_default">No default: pick one below.</string>+ <string name="copy_added">Added</string>+ <string name="copy_built_in">Built into the TV</string>+ <string name="copy_built_in_off">Built into the TV · turned off</string>+ <string name="copy_current">Current</string>+ <string name="copy_keeps_home">Keeps Home with its accessibility service</string>+ <string name="copy_make_home">Make Home</string>+ <string name="copy_get_launcher">Get another launcher</string>+ <string name="copy_get_launcher_text">Install one from the Play Store, like Projectivy or FLauncher. Switch back any time.</string>+ <string name="copy_get_projectivy_text">Install Projectivy. Switch back any time.</string>+ <string name="copy_home_settings">Home screen settings</string>+ <string name="copy_make_home_title">Make %1$s the home screen?</string>++ <!-- explainReplace paragraphs; %1$s the new launcher, %2$s the TV's built-in one -->+ <string name="copy_explain_replace_opens">Home opens %1$s. To stop the TV switching back by itself, Tellyscope turns off %2$s, the TV\'s built-in launcher.</string>+ <string name="copy_explain_replace_only">That\'s the only launcher it ever turns off. Launchers you added stay on, so you can switch between them any time.</string>+ <string name="copy_explain_replace_undo">Undo in History turns %1$s back on.</string>+ <!-- %1$s is the Google TV launcher being turned off -->+ <string name="copy_google_features">Some Google TV features, like the Apps row and the Live tab, are part of %1$s and go away with it.</string>+ <string name="copy_next_service">Next, you choose whether to turn on its accessibility service.</string>++ <!-- explainLeave; %1$s the launcher Home switches to, the other arg the current one -->+ <string name="copy_explain_leave_turns_on">Tellyscope turns %1$s back on and makes it open when you press Home.</string>+ <string name="copy_explain_leave_makes">Tellyscope makes %1$s open when you press Home.</string>+ <string name="copy_explain_leave_service">It also turns off %1$s\'s accessibility service, which would otherwise take Home straight back.</string>+ <string name="copy_explain_leave_stays">%1$s stays installed and on, so you can make it Home again any time.</string>+ <string name="copy_explain_leave_undo">Undo in History makes %1$s Home again.</string>+ <string name="copy_explain_leave_undo_service">Undo in History makes %1$s Home again and turns its service back on.</string>++ <!-- %1$s (%2$s) the new launcher and its package, %3$s (%4$s) the one it replaces -->+ <string name="copy_explain_home">Makes %1$s (%2$s) open when you press Home, then disables %3$s (%4$s) so the TV can\'t switch back by itself. Undo in History turns %3$s back on and makes it Home again.</string>+ <!-- Fire OS: %1$s (%2$s) the launcher and its package, %3$s Amazon's launcher; copy_next_service follows -->+ <string name="copy_explain_fire_home">Makes Home open %1$s (%2$s) through its accessibility service. Fire OS won\'t let %3$s be turned off or replaced, so it stays on and nothing else changes. Undo in History turns the service off.</string>+ <string name="copy_explain_first_home">Makes %1$s (%2$s) open when you press Home. The TV has no default home screen now, and nothing else is turned off.</string>++ <string name="copy_service_title">Turn on %1$s\'s accessibility service?</string>+ <!-- %1$s the launcher, %2$s the one Home may open without its service -->+ <string name="copy_explain_service">It keeps the Home button opening %1$s. Without it, this TV\'s Home button may still open %2$s.\n\nAn accessibility service can see what\'s on screen. Turn it on only if you trust %1$s.\n\nUndo in History, or making another launcher Home, turns it off.</string>++ <string name="copy_turn_it_on">Turn it on</string>+ <string name="copy_switch_without">Switch without it</string>+ <string name="copy_not_now">Not now</string>+ <string name="copy_turn_on">Turn on</string>+ <string name="copy_got_it">Got it</string>+ <string name="copy_service_off">Accessibility service off</string>+ <string name="copy_service_off_title">Home may open %1$s</string>+ <string name="copy_tv_own_launcher">the TV\'s own launcher</string>++ <!-- Installing a home screen -->+ <string name="copy_better_home">Get a better home screen</string>+ <!-- %1$s is the current launcher's name, or copy_the_tvs_home_screen -->+ <string name="copy_better_home_text">Swap %1$s for a launcher without ads. Free on the Play Store; switch back any time.</string>+ <!-- Fire OS: there's no Play Store and Tellyscope installs it. %1$s as in copy_better_home_text -->+ <string name="copy_better_home_text_fire">Swap %1$s for a launcher without ads; switch back any time.</string>+ <string name="copy_the_tvs_home_screen">the TV\'s home screen</string>+ <string name="copy_choose_one">Choose one</string>+ <string name="copy_install_one">Install it</string>+ <string name="copy_choose_home">Choose a home screen</string>+ <string name="copy_choose_home_text">Each one replaces the TV\'s home screen. Tellyscope opens it in the Play Store on the TV; you install it with the remote.</string>+ <string name="copy_can_download">Some can also be downloaded directly.</string>+ <string name="copy_no_launcher_list">Couldn\'t load the list of home screens. Check the phone\'s internet and try again.</string>+ <string name="copy_recommended">Recommended</string>+ <string name="copy_on_this_tv">On this TV</string>+ <string name="copy_installed">Installed</string>+ <string name="copy_home_now">Home now</string>+ <string name="copy_open">Open</string>+ <string name="copy_uses_service">Uses an accessibility service</string>+ <string name="copy_no_service">Open source · no accessibility service</string>+ <!-- %1$s is copy_on_this_tv -->+ <string name="copy_other_launcher">Prefer another launcher? Install it from the Play Store on your TV, then come back here. It shows up under %1$s.</string>+ <string name="copy_not_affiliated">Tellyscope isn\'t affiliated with any of these launchers or their developers.</string>+ <string name="copy_get_from_store">Get it from Play Store</string>+ <string name="copy_store_recommended">Play Store recommended: it updates itself</string>+ <string name="copy_download_directly">Download directly</string>+ <string name="copy_install_home">Install a home screen</string>+ <string name="copy_install_it">Install it on your TV</string>+ <string name="copy_install_it_text">The Play Store is open on the TV, on %1$s\'s page. Use the remote to select Install. Tellyscope moves on by itself once it\'s installed.</string>+ <string name="copy_store_on">Play Store on %1$s</string>+ <string name="copy_waiting_install">Waiting for install…</string>+ <string name="copy_downloads_take">Downloads can take a minute. Tellyscope can\'t see the download, only when it\'s done.</string>+ <string name="copy_open_store_again">Open Play Store again</string>+ <string name="copy_make_it_home">Make it the home screen?</string>+ <string name="copy_is_installed">%1$s is installed.</string>+ <!-- %2$s is copy_make_home, %3$s is copy_home_screen -->+ <string name="copy_launcher_later">%1$s is installed. To use it later, choose %2$s on it in Tweaks, under %3$s.</string>+ <string name="copy_launcher_installed">%1$s is installed. Press Home on the remote to pick it.</string>+ <string name="copy_launcher_is_home">%1$s is already your home screen.</string>+ <string name="copy_no_store">The Play Store didn\'t open</string>+ <!-- %1$s the TV's name, %2$s the launcher's -->+ <string name="copy_no_store_text">%1$s didn\'t open the Play Store for Tellyscope. On the TV, open the Play Store yourself and search for %2$s. Tellyscope keeps watching and moves on once it\'s installed.</string>+ <string name="copy_choose_another">Choose another</string>+ <string name="copy_not_installed">%1$s isn\'t installed</string>+ <string name="copy_wasnt_installed">%1$s wasn\'t installed</string>+ <string name="copy_not_installed_text">The Play Store closed on the TV before it was installed. If the Store said it isn\'t available for this TV, choose another launcher.</string>++ <!-- Installing Projectivy on Fire OS: downloaded from its developer's GitHub, installed over adb -->+ <string name="copy_install_projectivy">Install Projectivy</string>+ <string name="copy_fire_install_text">A home screen without ads. Tellyscope installs it on the TV for you; there\'s nothing to do on the TV.</string>+ <!-- %1$s the app's name -->+ <string name="copy_downloads_from">Tellyscope downloads %1$s from the developer\'s own release page:</string>+ <!-- %1$s the version, %2$s its size (copy_size_*) -->+ <string name="copy_release">Release %1$s · %2$s</string>+ <string name="copy_where_from">Where it comes from</string>+ <string name="copy_signed_check">Tellyscope checks it\'s signed by Projectivy\'s developer before installing it on the TV. Tellyscope isn\'t affiliated with Projectivy.</string>+ <string name="copy_download_and_install">Download and install</string>+ <!-- Download directly, on a TV with the Play Store; %1$s the app's name -->+ <string name="copy_download_directly_title">Download %1$s directly?</string>+ <string name="copy_direct_check">Tellyscope checks the app carries the developer\'s signature. It does not scan the app for malicious code, and the app won\'t update on its own.</string>+ <string name="copy_store_safer">Getting it from Play Store is safer and keeps it updated.</string>+ <string name="copy_download_anyway">Download anyway</string>+ <string name="copy_store_instead">Get it from the Play Store on the TV instead.</string>+ <string name="copy_installing">Installing %1$s</string>+ <string name="copy_step_download">Download from GitHub</string>+ <string name="copy_step_downloaded">Downloaded</string>+ <!-- %1$d percent done, %2$s and %3$s sizes (copy_size_*) -->+ <string name="copy_downloading">Downloading · %1$d%% · %2$s of %3$s</string>+ <string name="copy_step_picked">Picked a file</string>+ <string name="copy_step_check">Check it\'s Projectivy</string>+ <string name="copy_step_checking">Checking it\'s Projectivy…</string>+ <string name="copy_step_checked">It\'s Projectivy</string>+ <string name="copy_step_checked_text">Signed by its developer</string>+ <string name="copy_step_failed">Not Projectivy</string>+ <string name="copy_step_failed_text">Package name or signature didn\'t match</string>+ <string name="copy_install_on">Install on %1$s</string>+ <string name="copy_stop_title">Stop the download?</string>+ <string name="copy_stop_text">Nothing is on the TV yet. You can start again any time.</string>+ <string name="copy_stop">Stop</string>+ <string name="copy_keep_downloading">Keep downloading</string>+ <!-- %1$s the TV's name -->+ <string name="copy_installing_on">Installing on %1$s…</string>+ <string name="copy_not_projectivy">That download isn\'t Projectivy</string>+ <string name="copy_not_projectivy_text">The file from GitHub didn\'t match Projectivy\'s package name or its developer\'s signature, so Tellyscope installed nothing on the TV.</string>+ <string name="copy_not_projectivy_file">That file isn\'t Projectivy</string>+ <string name="copy_not_projectivy_file_text">It didn\'t match Projectivy\'s package name or its developer\'s signature, so Tellyscope installed nothing on the TV.</string>+ <string name="copy_cant_read_file">Tellyscope couldn\'t read that file. Pick it again, or download it again.</string>+ <string name="copy_cant_install">Couldn\'t install %1$s</string>+ <string name="copy_no_download">Couldn\'t download Projectivy</string>+ <string name="copy_no_download_offline">The phone can\'t reach GitHub. Check its internet, then try again.</string>+ <!-- %1$s a clock time, like 18:44 -->+ <string name="copy_no_download_limited_until">GitHub is limiting downloads from your network until %1$s. Try again then, or download it yourself.</string>+ <string name="copy_no_download_limited">GitHub is limiting downloads from your network for a while. Try again then, or download it yourself.</string>+ <string name="copy_or_yourself">Or download it yourself</string>+ <string name="copy_yourself_page">Download the app file (.apk) from the release page in your browser.</string>+ <!-- %1$s the release's file name, like Projectivy.apk -->+ <string name="copy_yourself_pick_file">Come back and pick %1$s. Tellyscope checks it\'s Projectivy before installing it.</string>+ <string name="copy_yourself_pick">Come back and pick it. Tellyscope checks it\'s Projectivy before installing it.</string>+ <string name="copy_latest_release">Latest release</string>+ <string name="copy_pick_downloaded">Pick the downloaded file</string>+ <string name="copy_pick_another">Pick another file</string>+ <string name="copy_try_download_again">Try download again</string>+ <string name="copy_service_off_text">%1$s\'s accessibility service is off, so the TV can take Home back.</string>++ <string name="copy_open_again">Open again</string>+ <string name="copy_undo">Undo</string>++ <!-- Time and sizes -->+ <string name="copy_just_now">just now</string>+ <plurals name="copy_seconds_ago">+ <item quantity="one">%1$d s ago</item>+ <item quantity="other">%1$d s ago</item>+ </plurals>+ <plurals name="copy_minutes_ago">+ <item quantity="one">%1$d min ago</item>+ <item quantity="other">%1$d min ago</item>+ </plurals>+ <plurals name="copy_hours_ago">+ <item quantity="one">%1$d h ago</item>+ <item quantity="other">%1$d h ago</item>+ </plurals>+ <plurals name="copy_days_ago">+ <item quantity="one">%1$d d ago</item>+ <item quantity="other">%1$d d ago</item>+ </plurals>++ <!-- Compact uptime: days, hours, minutes -->+ <string name="copy_uptime_days_hours">%1$dd %2$dh</string>+ <string name="copy_uptime_hours_minutes">%1$dh %2$dm</string>+ <string name="copy_uptime_minutes">%1$dm</string>++ <plurals name="copy_days">+ <item quantity="one">%1$d day</item>+ <item quantity="other">%1$d days</item>+ </plurals>+ <plurals name="copy_hours">+ <item quantity="one">%1$d hour</item>+ <item quantity="other">%1$d hours</item>+ </plurals>+ <plurals name="copy_minutes">+ <item quantity="one">%1$d minute</item>+ <item quantity="other">%1$d minutes</item>+ </plurals>+ <!-- Uptime: %1$s days, %2$s hours -->+ <string name="copy_days_hours">%1$s, %2$s</string>++ <!-- A network speed; %1$s is a size like 1.5 MB -->+ <string name="copy_speed">%1$s/s</string>+ <string name="copy_size_gb">%1$.1f GB</string>+ <string name="copy_size_mb">%1$.1f MB</string>+ <string name="copy_size_gb_whole">%1$d GB</string>+ <string name="copy_size_mb_whole">%1$d MB</string>+ <string name="copy_size_kb">%1$d KB</string>+ <plurals name="copy_size_bytes">+ <item quantity="one">%1$d bytes</item>+ <item quantity="other">%1$d bytes</item>+ </plurals>++ <string name="copy_uninstall_title">Uninstall %1$s?</string>+ <!-- Uninstalling the launcher on Home: paragraphs; %1$s the launcher, the numbers are step numbers -->+ <string name="copy_uninstall_home_intro">%1$s is your home screen. Before removing it, Tellyscope:</string>+ <string name="copy_uninstall_home_back">1. Makes %1$s the home screen again, turning it back on if it\'s off.</string>+ <string name="copy_uninstall_home_service">2. Turns off %1$s\'s accessibility service.</string>+ <string name="copy_uninstall_home_remove">%1$d. Uninstalls it, with everything saved in it. This can\'t be undone.</string>+ <string name="copy_uninstall_home_fails">If a step fails, Tellyscope stops there, says which one, and doesn\'t uninstall.</string>++ <string name="copy_system">System</string>+ <string name="copy_system_why">Needed by the TV · can\'t be changed</string>++ <!-- Debloat with nothing left -->+ <string name="copy_gate_title">Everything on the list is off</string>+ <string name="copy_gate_done">All the apps the cleanyourtv list suggests for this TV are already off.</string>+ <string name="copy_gate_launcher">To trim it further, switch to a minimal home screen. It replaces the TV\'s own, with its ads and suggestions.</string>+ <string name="copy_gate_apps">You can still choose, app by app, what to keep or turn off in Apps.</string>+ <string name="copy_go_to_apps">Go to Apps</string>+ <string name="copy_dont_show_again">Don\'t show again</string>++ <string name="copy_reading_apps">Reading the TV\'s apps…</string>+ <string name="copy_reading_apps_line">This takes a few seconds.</string>+ <string name="copy_tv_offline">TV offline</string>+ <string name="copy_running_offline">Running apps show here once the TV is connected.</string>++ <!-- Connection state, next to the status dot -->+ <string name="copy_state_online">Connected</string>+ <string name="copy_state_offline">Offline</string>+ <string name="copy_state_not_allowed">Not allowed</string>+ <string name="copy_state_waiting">Connecting</string>+ <string name="copy_state_needs_pairing">Needs the pairing code</string>+ <string name="copy_state_found">Not connected</string>++ <!-- Storage: used of total -->+ <string name="copy_gb_of_small">%1$.1f of %2$.1f GB</string>+ <string name="copy_gb_of">%1$.1f of %2$.0f GB</string>+ <string name="copy_free_gb_small">%1$.1f GB free</string>+ <string name="copy_free_gb">%1$d GB free</string>++ <string name="copy_no_stats_not_allowed">Stats show up once the TV allows this phone.</string>+ <string name="copy_no_stats">No stats yet. They show up once the TV is back on.</string>++ <string name="copy_wrong_code">That code didn\'t work. Check the 6 digits on the TV and try again.</string>+ <string name="copy_unreachable">The TV didn\'t answer. Check it\'s on and on the same Wi-Fi as this phone, then try again.</string>+ <string name="copy_pair_instead">The TV didn\'t let this phone in yet. Pair it once with the code from the TV.</string>+ <string name="copy_logged_out">You were logged out</string>+ <string name="copy_logged_out_why">The TV removed this phone\'s access. Tellyscope disconnected and stopped asking, so nothing pops up on the TV until you connect again.</string>+ <!-- Names of options in the TV's Developer options menu -->+ <string name="copy_logged_out_cause_revoke">Revoke USB debugging authorisations was chosen on the TV.</string>+ <string name="copy_logged_out_cause_remove">Remove all other access was used from another phone, or from another Tellyscope build on this phone.</string>+ <string name="copy_logged_out_of">Logged out of %1$s</string>+ <string name="copy_logged_out_just_now">Logged out just now</string>+ <!-- %1$s is a time of day, like 23:00 -->+ <string name="copy_logged_out_today">Logged out today, %1$s</string>+ <string name="copy_logged_out_yesterday">Logged out yesterday</string>+ <plurals name="copy_logged_out_days_ago">+ <item quantity="one">Logged out %1$d day ago</item>+ <item quantity="other">Logged out %1$d days ago</item>+ </plurals>++ <!-- Health line at the top of a TV's page -->+ <string name="copy_health_storage_full">Storage almost full</string>+ <string name="copy_health_memory_full">Memory almost full</string>+ <!-- %1$s is the app that uses the most memory -->+ <string name="copy_health_memory_full_one">Memory almost full: %1$s use the most</string>+ <string name="copy_health_memory_full_two">Memory almost full: %1$s and %2$s use the most</string>+ <string name="copy_health_hot">Running hot</string>+ <string name="copy_health_fine">Running fine</string>++ <!-- TV folders -->+ <string name="copy_folder_download">Download</string>+ <string name="copy_folder_movies">Movies</string>++ <!-- Sideload -->+ <string name="copy_install_new">Install</string>+ <string name="copy_install_update">Update</string>+ <string name="copy_install_reinstall">Reinstall</string>+ <string name="copy_install_downgrade">Install older version</string>+ <string name="copy_install_kind_new">Not on this TV yet. This installs it.</string>+ <!-- %1$s the version on the TV, %2$s the picked one -->+ <string name="copy_install_kind_update_versions">Updates the TV\'s copy from %1$s to %2$s. Its settings stay.</string>+ <string name="copy_install_kind_update">Updates the TV\'s copy. Its settings stay.</string>+ <string name="copy_install_kind_reinstall_version">The TV already has this version (%1$s). This installs it again over itself.</string>+ <string name="copy_install_kind_reinstall">The TV already has this version. This installs it again over itself.</string>+ <!-- %1$s the picked version, %2$s the one on the TV -->+ <string name="copy_install_kind_downgrade_versions">This is older than the one on the TV (%1$s here, %2$s on the TV). Android normally refuses that, and the app\'s saved data may not work with the older version.</string>+ <string name="copy_install_kind_downgrade">This is older than the one on the TV. Android normally refuses that, and the app\'s saved data may not work with the older version.</string>+ <string name="copy_allow_downgrade">Install the older version anyway</string>+ <string name="copy_install_keep_open">Keep Tellyscope open until it\'s done.</string>+ <string name="copy_installed_update">Updated %1$s.</string>+ <string name="copy_installed_reinstall">Reinstalled %1$s.</string>+ <string name="copy_installed_new">Installed %1$s.</string>++ <!-- Why the TV refused an install; %1$s is the app -->+ <string name="copy_install_refused_signature">The %1$s on the TV comes from a different developer, so Android won\'t replace it. If you\'re sure, uninstall it first: from Apps here if you installed it, or on the TV.</string>+ <string name="copy_install_refused_downgrade">The TV has a newer %1$s and won\'t go back to an older one.</string>+ <string name="copy_install_refused_no_space">The TV is out of space. Disable or uninstall something there, then try again.</string>+ <string name="copy_install_refused_tv_said_no">The TV blocked the install. Look in the TV\'s security settings for installing apps from unknown sources, or for app verification, then try again.</string>+ <string name="copy_install_refused_tv_too_old">%1$s needs a newer version of Android than this TV has.</string>+ <string name="copy_install_refused_wrong_cpu">This %1$s is built for a different kind of processor. Look for a version made for this TV, often marked armeabi-v7a or arm64-v8a.</string>+ <string name="copy_install_refused_app_too_old">%1$s was made for a very old version of Android, and this TV won\'t install it.</string>+ <string name="copy_install_refused_missing_feature">%1$s needs something this TV doesn\'t have, like a touchscreen or a camera.</string>+ <string name="copy_install_refused_missing_parts">%1$s comes in several parts and one is missing. Pick all of its .apk files together, or its .apks bundle.</string>+ <string name="copy_install_refused_test_only">This is a developer test build of %1$s, which the TV won\'t install.</string>+ <string name="copy_install_refused_conflict">Another app on the TV already uses something %1$s needs, so the TV refused it.</string>+ <string name="copy_install_refused_broken">This file isn\'t a working app. It may be damaged or only half downloaded; try getting it again.</string>+ <string name="copy_install_refused_unknown">The TV didn\'t install %1$s.</string>+ <string name="copy_not_an_app">That file isn\'t an Android app. Pick an .apk, several split .apk files, or an .apks or .xapk bundle.</string>+ <string name="copy_sideload_lost">Lost the TV partway through. Check it\'s still on and connected, then try again.</string>++ <!-- Files; %2$s is a TV folder (copy_folder_*) -->+ <string name="copy_sent">Sent %1$s to %2$s</string>+ <!-- %1$s the folder, %2$s the name it was saved as, %3$s the original name -->+ <string name="copy_sent_renamed">Sent to %1$s as %2$s, since %3$s was already there</string>+ <string name="copy_saved">Saved %1$s to your phone</string>+ <string name="copy_send_failed">Couldn\'t send %1$s. Check the TV is still connected and has space.</string>+ <string name="copy_save_failed">Couldn\'t save %1$s. Check the TV is still connected and the phone has space.</string>+ <string name="copy_cancelled_send">Cancelled. Nothing was left on the TV.</string>+ <string name="copy_cancelled_save">Cancelled. Nothing was saved.</string>+ <string name="copy_cant_read">Couldn\'t read that file on your phone.</string>+ <string name="copy_cant_undo">This version of Tellyscope can\'t undo that setting.</string>+ <string name="copy_files_lost">Couldn\'t read this folder. Check the TV is still connected.</string>++ <!-- Remote -->+ <string name="copy_key_refused">The TV didn\'t take that key.</string>+ <string name="copy_type_refused">The TV didn\'t take the text. Select a text box on the TV first, then send again.</string>+ <string name="copy_remote_lost">Lost the TV. Check it\'s still on and connected.</string>+ <string name="copy_no_update_screen">This TV has no update screen Tellyscope can open. Look in its Settings, under System or About.</string>+ <string name="copy_updates_opened">Opened the update screen on the TV. Look at the TV to check for updates.</string>+ <string name="copy_reboot_refused">The TV said no to restarting. Use its own remote or power button instead.</string>+ <string name="copy_reboot_ignored">The TV didn\'t restart. Use its own remote or power button instead.</string>+ <!-- Lower case: shown after the TV's state -->+ <string name="copy_remote_offline_wake">works again once it reconnects</string>+ <string name="copy_type_hint">Select a text box on the TV, like a search box, then type here.</string>+ <string name="copy_backspace">Delete the last letter you typed on the TV</string>+ <string name="copy_screen_off">Screen off</string>+ <string name="copy_screen_on">Screen on</string>+ <!-- Lower case: shown after copy_screen_off -->+ <string name="copy_screen_off_wake">tap any key to wake</string>+ <string name="copy_screen_off_tip">Turns off the TV\'s picture. The app stays connected; any key wakes it.</string>+ <string name="copy_screen_off_refused">This TV can\'t turn its picture off from Tellyscope.</string>+ <string name="copy_screen_on_refused">The TV\'s picture didn\'t come back on. Try again, or restart the TV.</string>+ <string name="copy_cant_type_empty">Type something first.</string>+ <plurals name="copy_cant_type_too_long">+ <item quantity="one">That\'s too long to send in one go. Send up to %1$d character at a time.</item>+ <item quantity="other">That\'s too long to send in one go. Send up to %1$d characters at a time.</item>+ </plurals>+ <string name="copy_cant_type_one_line">The TV can only take one line at a time.</string>+ <!-- %1$s is the one character the TV can't type -->+ <string name="copy_cant_type_odd">The TV can only type plain letters, numbers and symbols, not “%1$s”.</string>+ <!-- %s here is literal: the text the user typed contains it -->+ <string name="copy_cant_type_percent_s" formatted="false">The TV reads “%s” as a space, so it can\'t type that.</string>++ <string name="copy_remote_restart">Restart TV</string>+ <string name="copy_reboot_title">Restart the TV?</string>+ <string name="copy_reboot_text">The TV turns off and on again. Tellyscope reconnects by itself when it\'s back, usually within a minute.</string>+ <string name="copy_restarting_title">Restarting…</string>+ <string name="copy_restarting_text">The TV is restarting. Tellyscope will reconnect by itself.</string>+ <string name="copy_restart_late_title">The TV hasn\'t come back yet</string>+ <string name="copy_restart_late_status">Not back yet</string>+ <string name="copy_restart_late_text">It\'s been a minute. Some TVs take longer to start; Retry waits another minute.</string>+ <string name="copy_restart_lost_text">Use the TV\'s own remote to turn it on, then tap Retry.</string>+ <!-- %1$s the TV, then minutes:seconds waited -->+ <string name="copy_waiting_for">Waiting for %1$s · %2$d:%3$02d</string>+ <string name="copy_restart_lost">Still can\'t reach %1$s</string>+ <string name="copy_back_online">Back online. %1$s reconnected.</string>++ <!-- Remote buttons -->+ <string name="copy_remote_buttons">Remote buttons</string>+ <string name="copy_more">More options</string>+ <string name="copy_buttons_hint">Pick up to %1$d. Drag to set the order. To pick another, untick one first.</string>+ <string name="copy_not_on_tv">%1$s isn\'t on this TV. Install it from the Play Store on the TV.</string>+ <string name="copy_cant_open">The TV couldn\'t open %1$s. If it\'s turned off, turn it on in Apps.</string>+ <string name="copy_left_dock_one">%1$s was uninstalled, so its button left the Remote.</string>+ <plurals name="copy_left_dock">+ <item quantity="one">%1$d app was uninstalled, so its button left the Remote.</item>+ <item quantity="other">%1$d apps were uninstalled, so their buttons left the Remote.</item>+ </plurals>+ <string name="copy_restarting_soon">Tellyscope reconnects on its own when the TV is back, usually within a couple of minutes.</string>+ <string name="copy_restarting_long">Taking a while. Some TVs turn network debugging off when they restart. If it doesn\'t come back, turn it on again in the TV\'s Developer options.</string>++ <!-- TV tweaks -->+ <string name="copy_tweaks">TV tweaks</string>+ <string name="copy_dns_title">Block ads with Private DNS</string>+ <!-- %1$s is the DNS hostname -->+ <string name="copy_dns_state_on">On: %1$s</string>+ <string name="copy_dns_state_off">Off. Turn on to block ads and trackers in every app on the TV.</string>+ <string name="copy_dns_too_old">Needs Android 9 or newer. This TV is older.</string>+ <string name="copy_dns_dialog">Block ads on the whole TV?</string>+ <string name="copy_dns_text">The TV will look up every address through this ad-blocking DNS provider. AdGuard is free and needs no account. Tellyscope then checks the TV can still look addresses up, and puts it back if not. Undo is in History.</string>+ <string name="copy_dns_field">DNS provider</string>+ <string name="copy_dns_bad">Enter a hostname like dns.adguard-dns.com. An IP address won\'t work here.</string>+ <string name="copy_dns_confirm">Turn on</string>+ <string name="copy_animations_title">Faster animations</string>+ <string name="copy_animations_state_on">On: menus move at twice the speed</string>+ <string name="copy_animations_state_off">Off. Turn on to make menus feel snappier.</string>+ <string name="copy_caches_title">Clear all app caches</string>+ <string name="copy_caches_text">Frees space by clearing every app\'s temporary files. App data and sign-ins stay.</string>+ <string name="copy_caches_button">Clear caches</string>+ <string name="copy_caches_cleared">Cleared app caches</string>+ <!-- %1$s is a size, like 120 MB -->+ <string name="copy_caches_cleared_freed">Cleared app caches, freed %1$s</string>+ <string name="copy_screenshot_title">Screenshot</string>+ <string name="copy_screenshot_text">Saves what the TV shows to your phone. Protected video, like most streaming apps, shows as black.</string>+ <string name="copy_screenshot_button">Take screenshot</string>+ <string name="copy_screenshot_saved">Screenshot saved to your phone</string>+ <string name="copy_screenshot_failed">Couldn\'t take a screenshot. Check the TV is still connected.</string>+ <string name="copy_request_title">Another device wants to control this TV</string>+ <string name="copy_request_text">The TV is asking whether to allow debugging from a device with this key fingerprint. Allow it only if you started this yourself and the fingerprint matches the one that device shows.</string>+ <string name="copy_request_always">Always allow this device</string>+ <string name="copy_request_allow">Allow</string>+ <string name="copy_request_deny">Deny</string>+ <string name="copy_request_allowed">Allowed. That device can control the TV now.</string>+ <string name="copy_request_denied">Denied. That device can\'t connect.</string>+ <string name="copy_request_gone">The TV\'s prompt had closed or changed, so nothing was pressed.</string>+ <string name="copy_request_behind_alert">The TV\'s prompt is behind an Amazon alert, “Unable to Detect Your Remote”. Press OK on your TV remote to close it.</string>+ <string name="copy_request_then">Then the prompt shows here, so you can check its fingerprint.</string>+ <string name="copy_request_waiting">Waiting for the TV\'s prompt</string>+ <string name="copy_press_ok">Press OK on the TV</string>++ <!-- Who has access -->+ <string name="copy_warning_title">Another computer is connected to this TV</string>+ <string name="copy_warning_text">It can do everything Tellyscope can: install or remove apps, read files and control the screen.</string>+ <string name="copy_its_mine">It\'s mine</string>+ <string name="copy_remove_access">Remove all other access…</string>+ <string name="copy_connected_now">Connected now</string>+ <string name="copy_who_has_access">Who has access</string>+ <string name="copy_history">History</string>+ <string name="copy_advanced_monitor">Advanced monitor</string>+ <string name="copy_share">Share Tellyscope</string>++ <!-- Reset TV -->+ <string name="copy_reset_tv">Reset TV to how it shipped</string>+ <string name="copy_reset_keeps">Keeps apps\' data and sign-ins</string>+ <plurals name="copy_apps">+ <item quantity="one">%1$d app</item>+ <item quantity="other">%1$d apps</item>+ </plurals>+ <plurals name="copy_reset_found">+ <item quantity="one">%1$d change since this TV left the factory</item>+ <item quantity="other">%1$d changes since this TV left the factory</item>+ </plurals>+ <string name="copy_reset_found_text">Your apps\' data and sign-ins stay. Nothing has changed yet.</string>+ <plurals name="copy_turn_on_apps">+ <item quantity="one">Turn on %1$d app</item>+ <item quantity="other">Turn on %1$d apps</item>+ </plurals>+ <string name="copy_turn_on_text">Preinstalled apps turned off by hand, from any phone or tool</string>+ <plurals name="copy_bring_back_apps">+ <item quantity="one">Bring back %1$d app</item>+ <item quantity="other">Bring back %1$d apps</item>+ </plurals>+ <string name="copy_bring_back_text">Preinstalled apps that were uninstalled. They\'re still on the TV.</string>+ <string name="copy_reset_home">Make %1$s the home screen</string>+ <!-- %1$s is the launcher Home moves away from -->+ <string name="copy_reset_home_text">Instead of %1$s. %1$s stays installed.</string>+ <string name="copy_reset_home_text_service">Instead of %1$s, with its accessibility service turned off. %1$s stays installed.</string>+ <!-- %2$s is the TV's brand, or copy_the_maker -->+ <plurals name="copy_reset_leaves_off">+ <item quantity="one">%1$d app %2$s shipped switched off stay off.</item>+ <item quantity="other">%1$d apps %2$s shipped switched off stay off.</item>+ </plurals>+ <string name="copy_reset_leaves">Apps and launchers you installed stay installed.</string>+ <string name="copy_the_maker">the maker</string>+ <string name="copy_nothing_to_reset_title">Nothing to reset</string>+ <string name="copy_nothing_to_reset_on">Every preinstalled app is on.</string>+ <string name="copy_nothing_to_reset_on_home">Every preinstalled app is on, and %1$s is the home screen.</string>+ <!-- %1$s is the TV's brand, or copy_the_maker -->+ <string name="copy_nothing_to_reset_maker">Apps %1$s shipped switched off stay off.</string>+ <!-- Reset progress: done of total -->+ <string name="copy_resetting_turn_on">Turning on apps: %1$d of %2$d.</string>+ <string name="copy_resetting_bring_back">Bringing back apps: %1$d of %2$d.</string>+ <string name="copy_resetting_home">Making %1$s the home screen.</string>+ <string name="copy_keep_tv_on">Keep the TV on and connected.</string>+ <string name="copy_resetting">Resetting…</string>+ <string name="copy_reset_apps_stale">Reset done, but the app list didn\'t refresh. Open the TV again to see it.</string>+ <string name="copy_reset_button">Reset TV</string>+ <string name="copy_reset_done">TV reset to how it shipped</string>+ <string name="copy_reset_partly">Reset partly done</string>+ <!-- After a reset; %2$s is the launcher now on Home -->+ <plurals name="copy_reset_done_apps_home">+ <item quantity="one">%1$d preinstalled app is back, and %2$s is the home screen. Apps\' data and sign-ins stayed.</item>+ <item quantity="other">%1$d preinstalled apps are back, and %2$s is the home screen. Apps\' data and sign-ins stayed.</item>+ </plurals>+ <plurals name="copy_reset_done_apps">+ <item quantity="one">%1$d preinstalled app is back. Apps\' data and sign-ins stayed.</item>+ <item quantity="other">%1$d preinstalled apps are back. Apps\' data and sign-ins stayed.</item>+ </plurals>+ <string name="copy_reset_done_home">%1$s is the home screen. Apps\' data and sign-ins stayed.</string>+ <!-- Only reached when a reset changed nothing; the leading ". " is as the app always showed it -->+ <string name="copy_reset_done_nothing">. Apps\' data and sign-ins stayed.</string>+ <plurals name="copy_reset_partly_text">+ <item quantity="one">One step didn\'t work. Everything else is back to how it shipped. Nothing was lost.</item>+ <item quantity="other">%1$d steps didn\'t work. Everything else is back to how it shipped. Nothing was lost.</item>+ </plurals>+ <plurals name="copy_turned_on_all">+ <item quantity="one">Turned on %1$d app</item>+ <item quantity="other">Turned on %1$d apps</item>+ </plurals>+ <!-- %1$d done of %2$d apps -->+ <plurals name="copy_turned_on_some">+ <item quantity="one">Turned on %1$d of %2$d app</item>+ <item quantity="other">Turned on %1$d of %2$d apps</item>+ </plurals>+ <plurals name="copy_brought_back_all">+ <item quantity="one">Brought back %1$d app</item>+ <item quantity="other">Brought back %1$d apps</item>+ </plurals>+ <plurals name="copy_brought_back_some">+ <item quantity="one">Brought back %1$d of %2$d app</item>+ <item quantity="other">Brought back %1$d of %2$d apps</item>+ </plurals>+ <string name="copy_is_home">%1$s is the home screen</string>+ <string name="copy_still_home">%1$s is still the home screen</string>+ <string name="copy_try_app_again">Try %1$s again</string>+ <string name="copy_try_again">Try again</string>++ <!-- Debloat -->+ <string name="copy_disabling_apps">Turning off apps: %1$d of %2$d. Keep the TV on and connected.</string>+ <string name="copy_disabling">Disabling…</string>+ <string name="copy_disabling_note">Nothing is deleted. Turn any back on from History.</string>+ <string name="copy_debloat_done">Debloat done</string>+ <string name="copy_debloat_partly">Debloat partly done</string>+ <string name="copy_debloat_result_text">Nothing was deleted; undo any of them from History.</string>+ <plurals name="copy_turned_off_all">+ <item quantity="one">Turned off %1$d app</item>+ <item quantity="other">Turned off %1$d apps</item>+ </plurals>+ <plurals name="copy_turned_off_some">+ <item quantity="one">Turned off %1$d of %2$d app</item>+ <item quantity="other">Turned off %1$d of %2$d apps</item>+ </plurals>+ <string name="copy_still_on">%1$s is still on</string>++ <plurals name="copy_still_off">+ <item quantity="one">%1$d app still off</item>+ <item quantity="other">%1$d apps still off</item>+ </plurals>+ <plurals name="copy_still_off_title">+ <item quantity="one">%1$d app Tellyscope turned off is still off</item>+ <item quantity="other">%1$d apps Tellyscope turned off are still off</item>+ </plurals>+ <string name="copy_still_off_text">Restore everything turns them back on. Apps that were off before Tellyscope\'s first change stay off.</string>+ <plurals name="copy_others_connected">+ <item quantity="one">%1$d other connected now</item>+ <item quantity="other">%1$d others connected now</item>+ </plurals>+ <plurals name="copy_connections">+ <item quantity="one">%1$d connection</item>+ <item quantity="other">%1$d connections</item>+ </plurals>+ <!-- %1$s is an IP address -->+ <plurals name="copy_connected_from">+ <item quantity="one">From %1$s · %2$d connection</item>+ <item quantity="other">From %1$s · %2$d connections</item>+ </plurals>+ <string name="copy_on_tv">An app on this TV</string>+ <string name="copy_access_intro">Each computer allowed to use ADB can install or remove apps, read files and control the screen.</string>+ <string name="copy_this_phone">This phone</string>+ <string name="copy_not_this_phone">Not this phone</string>+ <string name="copy_yours">Yours</string>+ <string name="copy_waiting_chip">Waiting</string>+ <string name="copy_waiting_line">Waiting for you to allow it on the TV</string>+ <string name="copy_waiting_text">An Allow prompt for it is on the TV now. It can\'t do anything until you choose Allow there. Not yours? Choose Deny.</string>+ <string name="copy_answer">Answer</string>+ <string name="copy_new_chip">New</string>+ <string name="copy_new_key_text">Allowed on the TV while Tellyscope wasn\'t watching. Not yours? Remove all other access.</string>+ <string name="copy_allowed_computers">Allowed computers</string>+ <string name="copy_unnamed_computer">Unnamed computer</string>+ <string name="copy_cant_check_connected">This TV doesn\'t say who is connected.</string>+ <string name="copy_cant_check_allowed">This TV doesn\'t list its allowed computers.</string>+ <string name="copy_nobody_allowed">No computer is allowed. The next one to connect has to be allowed on the TV.</string>+ <string name="copy_access_foot_link">The TV doesn\'t say which allowed computer is behind a connection. If you don\'t recognise an address, remove all other access.</string>+ <string name="copy_access_foot_all">Android can\'t remove one computer on its own: this clears every computer, then you allow Tellyscope again.</string>+ <string name="copy_never_seen">Never seen</string>+ <string name="copy_last_seen_just_now">Last seen just now</string>+ <!-- %1$s is a time of day, like 23:00 -->+ <string name="copy_last_seen_today">Last seen today, %1$s</string>+ <string name="copy_last_seen_yesterday">Last seen yesterday</string>+ <plurals name="copy_last_seen_days_ago">+ <item quantity="one">Last seen %1$d day ago</item>+ <item quantity="other">Last seen %1$d days ago</item>+ </plurals>+ <string name="copy_last_seen_long_ago">Last seen over a month ago</string>++ <!-- Remove all other access -->+ <string name="copy_remove_title">Remove all other access</string>+ <string name="copy_confirm_title">Remove all other access?</string>+ <string name="copy_confirm_text">Every computer this TV has allowed loses access, your own computers too: they\'ll need allowing again.</string>+ <string name="copy_confirm_remote">Tellyscope reconnects straight away. Keep the TV remote handy: the TV asks you to allow this phone.</string>+ <string name="copy_confirm_button">Remove access</string>+ <string name="copy_cancel">Cancel</string>+ <string name="copy_revoking">Removing access…</string>+ <string name="copy_allow_title">Allow this phone on the TV</string>+ <!-- copy_allow_text_a, copy_allow_always (bold) and copy_allow_text_b make one sentence, in that order -->+ <string name="copy_allow_text_a">"Other access is removed. The TV now asks “Allow USB debugging?”. Tick "</string>+ <string name="copy_allow_always">Always allow from this computer</string>+ <string name="copy_allow_text_b">", then choose "</string>+ <string name="copy_allow_button">Allow</string>+ <string name="copy_fingerprint_label">The TV should show this fingerprint</string>+ <string name="copy_fingerprint_hint">If it shows a different one, choose Cancel on the TV.</string>+ <string name="copy_stop_waiting">Stop waiting</string>+ <string name="copy_refused">The TV didn\'t allow this phone. It may have timed out, or Cancel was chosen.</string>+ <string name="copy_ask_again">Ask the TV again</string>+ <string name="copy_checking">Checking the TV…</string>+ <string name="copy_done_title">Only this phone has access</string>+ <string name="copy_done_text">Tellyscope checked the TV again: this phone is the only allowed computer, and nothing else is connected.</string>+ <string name="copy_trust_warning">Only allow computers and apps you trust. Anything you allow can install apps, read files and control the TV.</string>+ <string name="copy_back_to">Back to %1$s</string>+ <string name="copy_still_title">Another computer is still connected</string>+ <!-- %1$s is copy_connection_from or a computer's name, %2$s the TV -->+ <string name="copy_still_text">Tellyscope still sees %1$s on %2$s. It may have connected again straight away. Turn it off or unplug it from the network, then try again.</string>+ <string name="copy_still_open_text">Tellyscope still sees %1$s on %2$s. Its access is gone, but the TV keeps a connection open until it ends. Restart the TV to end it.</string>+ <string name="copy_check_again">Check again</string>+ <string name="copy_restart_tv">Restart the TV</string>+ <string name="copy_restarting_to_check">Restarting the TV…</string>+ <!-- %1$s is an IP address -->+ <string name="copy_connection_from">a connection from %1$s</string>+ <string name="copy_unconfirmed_title">Revoked on the TV</string>+ <string name="copy_unconfirmed_text">Tellyscope can\'t check the list on this TV. Look under Developer options to confirm.</string>+ <string name="copy_done">Done</string>+ <string name="copy_manual_intro">This TV didn\'t take Tellyscope\'s request, so it\'s two steps on the TV. Afterwards only this phone can use ADB on it; your own computers will need allowing again.</string>+ <string name="copy_manual_step_1">Open Developer options on the TV</string>+ <!-- Menu path in Android TV's settings -->+ <string name="copy_manual_step_1_text">Tellyscope opens it for you. If nothing happens on the TV, go to Settings → Device Preferences → Developer options.</string>+ <string name="copy_open_on_tv">Open on TV</string>+ <string name="copy_manual_step_2">Choose “Revoke USB debugging authorisations”</string>+ <string name="copy_manual_step_2_text">Then come back here, and Tellyscope asks the TV to allow this phone again.</string>+ <string name="copy_manual_done">I\'ve revoked it</string>+ <string name="copy_dev_options_failed">Couldn\'t open Developer options on the TV. Go to Settings → Device Preferences → Developer options.</string>++ <!-- Connected devices -->+ <string name="copy_devices_title">Connected devices</string>+ <string name="copy_show_all">Show all (%1$d)</string>+ <string name="copy_show_less">Show less</string>+ <string name="copy_no_devices">Nothing plugged in or paired.</string>+ <string name="copy_group_input">Input</string>+ <string name="copy_group_storage">USB storage</string>+ <string name="copy_group_audio">Audio output</string>+ <!-- %1$s is a size, like 12 GB -->+ <string name="copy_peripheral_free">%1$s free</string>+ <!-- %1$s is the device's state, lower case, like paired -->+ <string name="copy_peripheral_bluetooth">Bluetooth · %1$s</string>++ <!-- vm -->++ <!-- Scan screen: a TV's code row and Add by IP -->+ <string name="vm_still_wants_code">The TV still wants a code. Check the number on screen and try again.</string>+ <string name="vm_not_an_ip">That doesn\'t look like an IP address. It should look like four numbers with dots, like the one in your TV\'s network settings.</string>+ <string name="vm_bad_port">The port after the colon should be a number from 1 to 65535, like 5555.</string>++ <!-- Snackbar when an action failed and the TV gave no reason -->+ <string name="vm_didnt_work">That didn\'t work.</string>+ <string name="vm_nothing_to_turn_on">Nothing to turn back on.</string>+ <plurals name="vm_turned_back_on">+ <item quantity="one">Turned %1$d app back on.</item>+ <item quantity="other">Turned %1$d apps back on.</item>+ </plurals>++ <!-- A reason shown mid-sentence after an app's name, so lower case -->+ <string name="vm_tv_refused">the TV refused</string>+ <!-- Reset TV couldn't read what it would change -->+ <string name="vm_tv_didnt_answer">The TV didn\'t answer.</string>+ <!-- A reason shown mid-sentence for each Reset step that failed, so lower case -->+ <string name="vm_tv_didnt_answer_reason">the TV didn\'t answer</string>++ <!-- Report a problem: the log's last line, %1$s is the TV's own words -->+ <string name="vm_report_tv_said">The TV said: %1$s</string>+ <!-- Report a problem: starts the user's details; %1$s app name, %2$s its version (may be empty) -->+ <string name="vm_report_tried_install">Tried to install %1$s %2$s</string>++ <!-- Snackbar action for another TV that logged out: opens its page -->+ <string name="vm_logged_out_view">View</string>++ <!-- data -->++ <!-- Why an app is protected. Lowercase: shown after "Protected: " and inside other sentences. -->+ <string name="data_protected_home_screen">this is your home screen</string>+ <string name="data_protected_system">the TV needs this to work</string>+ <string name="data_protected_settings">you need this to change TV settings</string>+ <string name="data_protected_play_services">most apps stop working without it</string>+ <string name="data_protected_keyboard">you\'d lose the on-screen keyboard</string>+ <string name="data_protected_tv_inputs_remote">your remote or HDMI inputs could stop working</string>+ <string name="data_protected_setup_wizard">the TV may get stuck on restart without it</string>+ <string name="data_protected_updates">the TV gets its updates through this</string>+ <string name="data_protected_unknown_home">this TV didn\'t say which app is its home screen, so Tellyscope won\'t change anything</string>+ <string name="data_protected_came_with_tv">it came with the TV, so it can only be disabled</string>+ <string name="data_protected_disabled_by_tv">the TV turned this off itself, so it can\'t be turned back on from here</string>++ <!-- Errors below are lowercase reasons: the app capitalises them when shown on their own. %1$s is an app name. -->+ <string name="data_failed_stop">the TV wouldn\'t stop %1$s</string>+ <string name="data_failed_disable">the TV wouldn\'t turn %1$s off</string>+ <string name="data_failed_enable">the TV wouldn\'t turn %1$s on</string>+ <string name="data_failed_open">the TV wouldn\'t open %1$s</string>+ <string name="data_failed_uninstall">the TV wouldn\'t uninstall %1$s</string>+ <string name="data_tv_refused">the TV refused</string>+ <!-- %1$s is the TV's address. -->+ <string name="data_offline">%1$s is offline</string>++ <string name="data_no_service">%1$s has no accessibility service</string>+ <string name="data_service_not_on">%1$s is Home now, but its accessibility service didn\'t turn on, so the TV\'s Home button may still open its own launcher</string>+ <string name="data_service_still_on">%1$s\'s accessibility service is still on. Turn it off in the TV\'s Settings → Accessibility</string>+ <string name="data_fire_needs_service">on Fire TV, Home can only open %1$s through its accessibility service, so nothing changed</string>+ <string name="data_fire_service_not_on">the TV didn\'t turn on %1$s\'s accessibility service, so nothing changed</string>+ <string name="data_fire_service_not_off">the TV didn\'t turn off %1$s\'s accessibility service, so nothing changed</string>+ <string name="data_service_not_off">switched back, but %1$s\'s accessibility service is still on. Turn it off in the TV\'s Settings → Accessibility</string>+ <string name="data_home_not_back">turned %1$s back on, but the TV kept the other home screen. Press Home on the remote to pick %1$s</string>+ <!-- %2$s is why: the old launcher didn't close or the new one didn't open, in the TV's words. -->+ <string name="data_not_shown">%1$s is Home now, but %2$s</string>+ <string name="data_no_home_to_switch_back">there\'s no home screen to switch back to</string>+ <!-- %1$s is a reason starting "switched back, but …". -->+ <string name="data_uninstall_after_service">%1$s. Nothing was uninstalled</string>+ <!-- %1$s is a lowercase reason. -->+ <string name="data_uninstall_home_not_back">Home didn\'t switch back: %1$s. Nothing was uninstalled</string>++ <!-- %1$s is a lowercase reason. -->+ <string name="data_restore_none">couldn\'t turn apps back on: %1$s</string>+ <!-- %2$s is a lowercase reason. -->+ <plurals name="data_restore_some">+ <item quantity="one">turned %1$d app back on, then stopped: %2$s</item>+ <item quantity="other">turned %1$d apps back on, then stopped: %2$s</item>+ </plurals>++ <string name="data_no_reset_to_undo">there\'s no reset to undo</string>+ <string name="data_reset_already_undone">that reset is already undone</string>+ <string name="data_reset_tv_kept_home">the TV kept %1$s as the home screen</string>+ <!-- An app name, then why that app's step failed. -->+ <string name="data_app_reason">%1$s: %2$s</string>+ <!-- %1$s is a lowercase reason. -->+ <string name="data_reset_undo_service_left">put back every change, but %1$s</string>+ <!-- %1$d of %2$d changes; %3$s is the first reason, capitalised. -->+ <plurals name="data_reset_undo_partial">+ <item quantity="one">put back %1$d of %2$d change. %3$s. Undo again tries the rest</item>+ <item quantity="other">put back %1$d of %2$d changes. %3$s. Undo again tries the rest</item>+ </plurals>++ <string name="data_tweak_refused">the TV didn\'t accept the change</string>+ <string name="data_dns_too_old">Private DNS needs Android 9 or newer, and this TV is older</string>+ <!-- %1$s is the Private DNS host. -->+ <string name="data_dns_unreachable">the TV couldn\'t look anything up through %1$s, so Private DNS was put back. The network may block encrypted DNS (port 853)</string>+ <string name="data_dns_stuck">the TV couldn\'t look anything up through %1$s, and putting the old Private DNS back failed. The TV may be offline until you undo it in History</string>++ <string name="data_lists_not_https">the address has to start with https://</string>+ <string name="data_lists_unreachable">couldn\'t reach that address. Check it and the phone\'s internet</string>+ <string name="data_lists_not_a_list">this source isn\'t a Tellyscope list</string>++ <!-- Listed in place of an app name for native daemons and system uids. -->+ <string name="data_app_names_system">Android system</string>++ <!-- History lines, saved with the entry in the language of the moment. -->+ <string name="data_history_service_off">Turned off %1$s\'s accessibility service</string>+ <string name="data_history_reset_undone">Put back what Reset TV changed</string>+ <plurals name="data_history_reset">+ <item quantity="one">Reset TV · %1$d change</item>+ <item quantity="other">Reset TV · %1$d changes</item>+ </plurals>+ <!-- Shown as "Cleared app caches". -->+ <string name="data_history_app_caches">app caches</string>+ <!-- %1$s is the Private DNS host. -->+ <string name="data_history_dns_host">Private DNS set to %1$s</string>+ <string name="data_history_dns_off">Private DNS turned off</string>+ <string name="data_history_dns_automatic">Private DNS set to Automatic</string>+ <string name="data_history_animations_normal">Animations at normal speed</string>+ <string name="data_history_animations_off">Animations turned off</string>+ <!-- %1$s is a speed like 0.5. -->+ <string name="data_history_animations_scale">Animations at %1$s×</string>++ <!-- screens_a -->++ <!-- DeviceTabs.kt -->+ <string name="tabs_overview">Overview</string>+ <string name="tabs_apps">Apps</string>+ <string name="tabs_files">Files</string>+ <string name="tabs_tweaks">Tweaks</string>+ <string name="tabs_remote">Remote</string>+ <string name="tabs_install_app">Install app</string>+ <string name="tabs_upload_files">Upload files</string>+ <!-- Fills "As of %1$s" on the storage card when the TV was never seen -->+ <string name="tabs_last_visit">the last visit</string>+ <string name="tabs_files_offline">Connect to the TV to see its files.</string>+ <!-- %1$s is a folder name, like Downloads -->+ <string name="tabs_folder_empty">Nothing in %1$s yet</string>+ <string name="tabs_folder_empty_line">Files you send land here.</string>+ <string name="tabs_tweaks_offline">Connect to the TV to change its settings.</string>+ <string name="tabs_more_options">More options</string>+ <string name="tabs_rename">Rename this TV</string>+ <string name="tabs_settings">Settings</string>+ <string name="tabs_about">About & licences</string>+ <string name="tabs_forget">Forget this TV</string>+ <string name="tabs_search_apps">Search apps</string>+ <string name="tabs_close_search">Close search</string>+ <string name="tabs_clear_search">Clear search</string>+ <!-- %1$s is the name of a debloat list, usually the TV model -->+ <string name="tabs_suggested_none">Nothing from the %1$s list is on this TV</string>+ <plurals name="tabs_suggested_all_off">+ <item quantity="one">The suggested app is off</item>+ <item quantity="other">All %1$d suggested apps are off</item>+ </plurals>+ <!-- %1$d apps off out of %2$d suggested; picked by %2$d -->+ <plurals name="tabs_suggested_some_off">+ <item quantity="one">%1$d of %2$d suggested apps are off</item>+ <item quantity="other">%1$d of %2$d suggested apps are off</item>+ </plurals>+ <string name="tabs_suggested_no_list">No list for this TV yet</string>+ <string name="tabs_suggested_unavailable">Couldn\'t load the device lists</string>+ <string name="tabs_suggested_offline">Connect to the TV to see its suggestions</string>+ <string name="tabs_suggested_loading">Looking up this TV\'s list…</string>+ <string name="tabs_see_changes">See changes</string>+ <!-- Bold, followed by tabs_came_back_on -->+ <string name="tabs_action_required">Action required:</string>+ <plurals name="tabs_came_back_on">+ <item quantity="one">%1$d app came back on</item>+ <item quantity="other">%1$d apps came back on</item>+ </plurals>+ <string name="tabs_note_unavailable">Check the phone\'s internet and open this TV again.</string>+ <string name="tabs_note_no_list">Tap Debloat to pick the apps to turn off by hand.</string>+ <!-- %1$s is a TV maker, like XGIMI -->+ <string name="tabs_note_by_maker">No list for this exact model, so these come from %1$s\'s other TVs.</string>+ <string name="tabs_note_gate">Debloat now opens Apps for one-off changes.</string>+ <string name="tabs_lists_credit">Lists adapted from cleanyourtv (MIT).</string>+ <!-- %1$s is the Android version, like 11 -->+ <string name="tabs_android_version">Android %1$s</string>+ <!-- %1$s is a month and year, like March 2026 -->+ <string name="tabs_updated">Updated %1$s</string>+ <string name="tabs_check_updates">Check for updates</string>++ <!-- ListsCard.kt: the Debloat screen and About -->+ <!-- Title of the group of the TV's own apps when no debloat list fits the TV -->+ <string name="lists_apps_on_tv">Apps on this TV</string>+ <string name="lists_which_tv">Which TV is this?</string>+ <string name="lists_debloat">Debloat</string>+ <string name="lists_back">Back</string>+ <string name="lists_use_this">Use this list</string>+ <plurals name="lists_disable_apps">+ <item quantity="one">Disable %1$d app</item>+ <item quantity="other">Disable %1$d apps</item>+ </plurals>+ <string name="lists_brand_or_model">Brand or model</string>+ <string name="lists_clear_search">Clear search</string>+ <!-- %1$s is what the user searched for -->+ <string name="lists_no_match">No list for “%1$s”. Pick the closest model.</string>+ <string name="lists_unavailable">Couldn\'t load that list. Check the phone\'s internet and try again.</string>+ <string name="lists_loading">Loading the list…</string>+ <string name="lists_this_tv">This TV</string>+ <string name="lists_match_none">No list for this TV or its maker yet</string>+ <!-- %1$s is a TV maker, like XGIMI -->+ <string name="lists_match_by_maker">No list for this model, so these come from %1$s\'s other models</string>+ <!-- %1$s is an Android version, like Android 11 -->+ <string name="lists_match_exact">This model\'s list · tested on %1$s</string>+ <string name="lists_match_other_android">This model\'s list, tested on %1$s, not this TV\'s Android</string>+ <string name="lists_match_no_android">This model\'s list, with no Android it was tested on</string>+ <!-- lists_intro_* are followed by lists_intro_undo in the same paragraph -->+ <string name="lists_intro_by_hand">Tick the apps to turn off. Apps the TV needs to run aren\'t shown.</string>+ <string name="lists_intro_ticked">These apps will be turned off. Untick any you use.</string>+ <string name="lists_intro_unticked">Nothing is ticked: tick only the apps you know you don\'t use.</string>+ <string name="lists_intro_undo">Nothing is deleted, and History can turn each one back on.</string>+ <!-- %1$s is where the user's own list comes from, like a GitHub repository -->+ <string name="lists_custom_source">This list comes from %1$s, not tellyscope-devices.</string>+ <string name="lists_all_needed">Every app left on is one the TV needs.</string>+ <string name="lists_all_off">Nothing on the list is still on here.</string>+ <string name="lists_optional">optional: tick it if you don\'t use it</string>+ <!-- Ticked apps in a group: "3 of 5" -->+ <string name="lists_group_count">%1$d of %2$d</string>+ <string name="lists_help_add_title">Not in the list? Help add this TV</string>+ <string name="lists_help_add_text">Send its model and stock apps to cleanyourtv, where Tellyscope’s lists come from. You see the text first.</string>+ <string name="lists_help_add_button">Help add this TV</string>+ <string name="lists_not_this_tv">Not this TV?</string>+ <plurals name="lists_disable_apps_confirm">+ <item quantity="one">Disable %1$d app?</item>+ <item quantity="other">Disable %1$d apps?</item>+ </plurals>+ <string name="lists_disable_text">Each one is hidden and stops running. Nothing is deleted; every one shows in History, where you can turn it back on.</string>+ <string name="lists_disable_yes">Yes, disable them</string>+ <string name="lists_cancel">Cancel</string>+ <string name="lists_about_title">About Tellyscope</string>+ <string name="lists_about_version">Version %1$s</string>+ <string name="lists_about_website">Website</string>+ <string name="lists_about_demo">Watch the demo on YouTube</string>+ <string name="lists_about_licence">Free software under the GNU GPL v3.</string>+ <!-- %1$s is the first 12 characters of a git commit -->+ <string name="lists_about_lists_commit">Device lists are adapted from cleanyourtv by Gathin (MIT licence), commit %1$s.</string>+ <string name="lists_about_lists_pending">Device lists are adapted from cleanyourtv by Gathin (MIT licence), once they have downloaded.</string>+ <string name="lists_about_libraries">Uses Kadb (Apache 2.0) and spake2-java (GPL v3). Full licence texts are in the NOTICE file.</string>+ <string name="lists_about_close">Close</string>++ <!-- AdvancedScreen.kt: Advanced monitor -->+ <string name="advanced_back">Back to the TV\'s page</string>+ <string name="advanced_this_tv">This TV</string>+ <string name="advanced_ip_address">IP address</string>+ <string name="advanced_port">Port</string>+ <string name="advanced_maker">Maker</string>+ <string name="advanced_network_name">Network name</string>+ <string name="advanced_loading">Loading stats…</string>+ <string name="advanced_cpu_by_app">CPU by app</string>+ <string name="advanced_ram_by_app">RAM by app</string>+ <string name="advanced_processes">Processes</string>+ <string name="advanced_network">Network</string>+ <string name="advanced_cpu">CPU</string>+ <string name="advanced_ram">RAM</string>+ <string name="advanced_app">App</string>+ <string name="advanced_temperature">Temperature</string>+ <!-- How long the TV has been on, like "2d 4h" -->+ <string name="advanced_on_for">On for</string>+ <string name="advanced_screen">Screen</string>+ <string name="advanced_screen_on">On</string>+ <string name="advanced_screen_off">Off</string>+ <string name="advanced_percent">%1$d%%</string>+ <string name="advanced_percent_whole">%1$.0f%%</string>+ <string name="advanced_percent_tenths">%1$.1f%%</string>+ <string name="advanced_celsius">%1$d°C</string>+ <!-- %1$s is how long ago, like "5 minutes ago" -->+ <string name="advanced_as_of">As of %1$s</string>+ <string name="advanced_memory">Memory</string>+ <string name="advanced_storage">Storage</string>+ <string name="advanced_percent_used">%1$d%% used</string>+ <!-- The bar that sums every app outside the top 6 -->+ <string name="advanced_other">Other</string>+ <string name="advanced_connection">Connection</string>+ <string name="advanced_wifi">Wi-Fi</string>+ <string name="advanced_ethernet">Ethernet</string>+ <string name="advanced_signal">Signal</string>+ <string name="advanced_signal_strong">Strong (%1$d dBm)</string>+ <string name="advanced_signal_good">Good (%1$d dBm)</string>+ <string name="advanced_signal_weak">Weak (%1$d dBm)</string>+ <string name="advanced_signal_very_weak">Very weak (%1$d dBm)</string>+ <string name="advanced_mac">MAC</string>+ <string name="advanced_link_speed">Link speed</string>+ <string name="advanced_mbps">%1$d Mbps</string>+ <string name="advanced_data_used">Data used</string>+ <string name="advanced_open_connections">Open connections</string>++ <!-- ReportScreen.kt: Report a problem, Help add this TV -->+ <string name="report_title_new_tv">Help add this TV</string>+ <string name="report_title_problem">Report a problem</string>+ <string name="report_subtitle_new_tv">Opens cleanyourtv’s “My TV” form on GitHub</string>+ <string name="report_subtitle_problem">Opens an issue on Tellyscope’s GitHub</string>+ <string name="report_close">Close</string>+ <!-- Followed by report_note_rest or report_note_nothing_sent -->+ <string name="report_note_own_account">You post it from your own GitHub account.</string>+ <string name="report_note_rest">What doesn’t fit the link can go in a comment after you post.</string>+ <string name="report_note_nothing_sent">Tellyscope sends nothing by itself.</string>+ <string name="report_open_github">Open GitHub</string>+ <string name="report_reading_tv">Reading the TV…</string>+ <string name="report_no_tv">No TV connected</string>+ <string name="report_tv_model">TV model</string>+ <string name="report_tv">TV</string>+ <string name="report_android_build">Android version and firmware build</string>+ <string name="report_how_far">How far did you get?</string>+ <string name="report_how_connect">How did you connect?</string>+ <string name="report_how_connect_help">Filled in from this connection; change it if it’s wrong.</string>+ <string name="report_what_happened">What happened?</string>+ <string name="report_details">Details (optional)</string>+ <string name="report_details_new_tv">Anything else?</string>+ <string name="report_details_problem">What were you doing?</string>+ <string name="report_what_gets_sent">What gets sent</string>+ <string name="report_connect_tv">Connect the TV to list its apps.</string>+ <string name="report_pick_stage">Pick how far you got to see the report.</string>+ <string name="report_pick_outcome">Pick what happened to see the report.</string>+ <string name="report_add_rest">Add the rest</string>+ <!-- %1$s is a GitHub repository name, like tellyscope -->+ <string name="report_add_rest_subtitle">As a comment on your newest issue on %1$s</string>+ <!-- %1$s is a GitHub repository, like owner/tellyscope -->+ <string name="report_add_rest_note">Opens your newest issue on %1$s. If it’s not the right one, pick yours from the list there.</string>+ <string name="report_copy_and_open">Copy and open your issue</string>+ <string name="report_add_rest_text">This is the comment. GitHub can’t fill in a comment from a link, so Tellyscope copies it and opens your issue: tap the comment box there and paste.</string>+ <string name="report_posted_title">Posted it? Add the rest as a comment</string>+ <plurals name="report_posted_apps_cut">+ <item quantity="one">%1$d apps didn’t fit in the link. Adding them helps cleanyourtv write the full list.</item>+ <item quantity="other">%1$d apps didn’t fit in the link. Adding them helps cleanyourtv write the full list.</item>+ </plurals>+ <string name="report_posted_part_cut">Part of the report didn’t fit in the link. Adding it helps us find the problem.</string>+ <string name="report_not_now">Not now</string>+ <string name="report_choose_one">Choose one</string>+ <string name="report_removed_first">Removed first: serial numbers, IP addresses, ADB keys and fingerprints.</string>+ <string name="report_cancel">Cancel</string>++ <!-- DeviceScreen.kt -->+ <!-- %1$s is how long ago, like "5 minutes ago", or tabs_last_visit -->+ <string name="device_as_of">As of %1$s</string>+ <string name="device_internal_storage">Internal storage</string>+ <!-- %1$s is like "12.3 of 32 GB" -->+ <string name="device_gb_used">%1$s used</string>+ <string name="device_cpu">CPU</string>+ <string name="device_ram">RAM</string>+ <!-- Short for temperature -->+ <string name="device_temp">Temp</string>+ <string name="device_network">Network</string>+ <string name="device_percent">%1$d%%</string>+ <string name="device_celsius">%1$d°C</string>+ <!-- %1$s is an app name -->+ <string name="device_disable_title">Disable %1$s?</string>+ <string name="device_cancel">Cancel</string>+ <plurals name="device_restore_title">+ <item quantity="one">Turn %1$d app back on?</item>+ <item quantity="other">Turn %1$d apps back on?</item>+ </plurals>+ <string name="device_restore_text">Turns back on every app Tellyscope disabled on this TV. Apps that were already off before Tellyscope\'s first change stay off.</string>+ <string name="device_restore_button">Turn back on</string>+ <string name="device_rename_title">Rename this TV</string>+ <string name="device_rename_text">Only this phone sees the name. Nothing on the TV changes.</string>+ <string name="device_save">Save</string>+ <!-- %1$s is the TV's name -->+ <string name="device_forget_title">Forget %1$s?</string>+ <string name="device_forget_text">Tellyscope stops reconnecting to it and removes it from this phone. Nothing on the TV changes. You can add it again from a scan.</string>+ <string name="device_forget">Forget</string>+ <string name="device_not_allowed_title">The TV didn\'t allow this phone</string>+ <string name="device_not_allowed_text">Its debugging access was turned off, reset, or denied. Tellyscope stopped asking so the TV isn\'t flooded with prompts.</string>+ <string name="device_connect_again">Connect again</string>+ <!-- "Always allow from this computer" is the TV's own wording -->+ <string name="device_not_allowed_hint">Then press Allow on the TV, and tick \"Always allow from this computer\".</string>+ <string name="device_offline">Offline</string>+ <!-- %1$s is how long ago, like "5 minutes ago", or device_a_while_ago -->+ <string name="device_offline_text">Last seen %1$s. It reconnects on its own when the TV is back on.</string>+ <string name="device_a_while_ago">a while ago</string>+ <string name="device_reconnect">Reconnect</string>+ <string name="device_nothing_here">Nothing here yet.</string>+ <!-- %1$s is what the user searched for -->+ <string name="device_nothing_matches">Nothing matches \"%1$s\".</string>+ <string name="device_app_disabled">Disabled</string>+ <string name="device_app_running">Running</string>+ <string name="device_app_not_running">Not running</string>+ <!-- %1$s is why the app can't be changed -->+ <string name="device_app_protected">Protected: %1$s</string>++ <!-- GuideCard.kt: turning on debugging. **…** marks the TV's own menu names; keep the stars. -->+ <string name="guide_brand_google_tv" translatable="false">Google TV</string>+ <string name="guide_brand_android_tv" translatable="false">Android TV</string>+ <string name="guide_brand_fire_tv" translatable="false">Fire TV</string>+ <string name="guide_brand_xiaomi" translatable="false">Xiaomi</string>+ <string name="guide_brand_xgimi" translatable="false">XGIMI</string>+ <!-- A brand chip: any TV not listed -->+ <string name="guide_brand_other">Other</string>+ <string name="guide_unlock_google_tv">On the TV: **Settings → System → About**. Press OK on **Android TV OS build** 7 times, until it says you\'re a developer.</string>+ <string name="guide_unlock_build">On the TV: **Settings → Device Preferences → About**. Press OK on **Build** 7 times.</string>+ <string name="guide_unlock_fire_tv">On the TV: **Settings → My Fire TV → About**. Press OK on the first row, your Fire TV\'s name, 7 times.</string>+ <string name="guide_unlock_other">On the TV, open **Settings**. Has **System**? It\'s Google TV: go to **System → About** and press OK on **Android TV OS build** 7 times. Has **Device Preferences**? It\'s Android TV: go to **Device Preferences → About** and press OK on **Build** 7 times.</string>+ <string name="guide_debug_title_wireless">Turn on Wireless debugging</string>+ <string name="guide_debug_done_wireless">Wireless debugging on</string>+ <string name="guide_debug_title_adb">Turn on ADB debugging</string>+ <string name="guide_debug_done_adb">ADB debugging on</string>+ <string name="guide_debug_google_tv">Back to **System → Developer options**. Turn on **Wireless debugging**. Older TVs call it **USB debugging**.</string>+ <string name="guide_debug_android_tv">Back to **Device Preferences → Developer options**. Turn on **Wireless debugging**. Older TVs have **USB debugging** and **Network debugging** instead: turn on both.</string>+ <string name="guide_debug_fire_tv">Back to **My Fire TV → Developer options**. Turn on **ADB debugging**.</string>+ <string name="guide_debug_xiaomi">Back to **Device Preferences → Developer options**. Turn on **Wireless debugging**. Older TVs call it **USB debugging**.</string>+ <string name="guide_debug_xgimi">Back to **Device Preferences → Developer options**. Turn on **Wireless debugging**. Older projectors have **USB debugging**, then **Network debugging** if it\'s listed: turn on both.</string>+ <string name="guide_debug_other">Back one level, open **Developer options**. Turn on **Wireless debugging**. Older TVs have **USB debugging**, and some **Network debugging** too: turn on what\'s there.</string>+ <string name="guide_pair_google_tv">**System → Developer options → Wireless debugging → Pair device with pairing code**</string>+ <string name="guide_pair_android_tv">**Device Preferences → Developer options → Wireless debugging → Pair device with pairing code**</string>+ <string name="guide_pair_other">**Developer options → Wireless debugging → Pair device with pairing code**</string>+ <string name="guide_pick_tv">Pick your TV</string>+ <string name="guide_unlock_title">Unlock developer options</string>+ <string name="guide_unlock_done">Developer options unlocked</string>+ <string name="guide_find_title">Find your TV</string>+ <string name="guide_done_next">Done, next</string>+ <string name="guide_back">Back</string>+ <string name="guide_done">Done</string>+ <string name="guide_tip_same_wifi">Keep the phone and the TV on the same Wi-Fi. Guest networks often keep devices apart.</string>+ <string name="guide_tip_debugging_off">Debugging switched itself off? Some TVs reset it after a restart. Turn it back on and this screen finds the TV again.</string>+ <string name="guide_tip_vega">No Developer options after 7 presses? Newer Fire TVs run Vega OS, which isn\'t Android, and Tellyscope can\'t reach them.</string>+ <string name="guide_tip_by_ip">Still nothing? Add the TV by its IP address, from the TV\'s network settings.</string>+ <string name="guide_help_title">Can\'t find your TV?</string>+ <string name="guide_add_by_ip">Add by IP address</string>+ <string name="guide_close">Close</string>++ <!-- AppsTabs.kt -->+ <string name="apps_tab_running">Running</string>+ <string name="apps_tab_installed">Installed</string>+ <string name="apps_tab_built_in">Built-in</string>+ <!-- Header over the apps the TV needs: "System (12)" -->+ <string name="apps_system_count">%1$s (%2$d)</string>+ <string name="apps_show_system">Show system apps</string>+ <string name="apps_hide_system">Hide system apps</string>++ <!-- Details.kt -->+ <string name="details_title">Details</string>+ <string name="details_show">Show details</string>+ <string name="details_hide">Hide details</string>++ <!-- DeviceIcons.kt: screen-reader names for the device icons -->+ <string name="kind_tv">TV</string>+ <string name="kind_projector">Projector</string>+ <string name="kind_fire_tv" translatable="false">Fire TV</string>+ <string name="kind_stick">Streaming device</string>++ <!-- TvHeader.kt: the last TV chip. A screen reader reads the icon then the label: "Add a" + "Device". -->+ <string name="header_add_device_icon">Add a</string>+ <string name="header_add_device_label">Device</string>++ <!-- screens_b -->++ <!-- RemoteScreen: key names are what TalkBack reads -->+ <string name="remote_mute">Mute or unmute</string>+ <string name="remote_volume_up">Volume up</string>+ <string name="remote_volume_down">Volume down</string>+ <string name="remote_back">Back</string>+ <string name="remote_home">Home</string>+ <string name="remote_menu">Menu</string>+ <string name="remote_up">Up</string>+ <string name="remote_down">Down</string>+ <string name="remote_left">Left</string>+ <string name="remote_right">Right</string>+ <string name="remote_ok">OK</string>+ <string name="remote_type_label">Type on the TV</string>+ <string name="remote_send">Send to the TV</string>+ <!-- Confirms restarting the TV -->+ <string name="remote_restart">Restart</string>+ <string name="remote_cancel">Cancel</string>+ <string name="remote_restarting">Restarting</string>+ <string name="remote_hide">Hide</string>+ <string name="remote_retry">Retry</string>+ <string name="remote_close">Close</string>+ <!-- TalkBack click label on the header line while a TV restarts -->+ <string name="remote_show_restart">Show the restart</string>+ <!-- TalkBack actions that reorder a remote button -->+ <string name="remote_move_up">Move up</string>+ <string name="remote_move_down">Move down</string>++ <!-- AccessUi -->+ <string name="access_show_less">Show less</string>+ <string name="access_show_more">Show more</string>+ <string name="access_back_to_tv">Back to the TV\'s page</string>+ <string name="access_checking">Checking…</string>++ <!-- SettingsScreen -->+ <!-- Sent through the share sheet; %1$s is the project's web address -->+ <string name="settings_share_text">I just found Tellyscope, an open-source app that cleans up your Android TV from your phone: turn off the bloat, install apps and send files, with no root and no PC. Free, no tracking. %1$s</string>+ <string name="settings_title">Settings</string>+ <string name="settings_back_to_tv">Back to the TV\'s page</string>+ <string name="settings_check_updates">Check for updates</string>+ <string name="settings_check_updates_alpha">Every 5 minutes on alpha builds, ask GitHub whether a newer Tellyscope is out. Nothing is downloaded.</string>+ <string name="settings_check_updates_release">Every 30 minutes, ask GitHub whether a newer Tellyscope is out. Nothing is downloaded.</string>+ <string name="settings_key_haptics">Vibrate on key press</string>+ <string name="settings_key_haptics_text">A short tick for each key on the Remote.</string>+ <string name="settings_report">Report a problem</string>+ <string name="settings_report_text">Opens an issue on Tellyscope’s GitHub. You see the text first.</string>+ <string name="settings_share_hint">Send someone the link to Tellyscope’s GitHub page.</string>+ <string name="settings_advanced">Advanced</string>+ <!-- Heading: how to change where the debloat lists come from -->+ <string name="settings_change">Change</string>+ <string name="settings_change_text">Paste the HTTPS raw folder that holds index.json, e.g. raw.githubusercontent.com/<you>/tellyscope-devices/main/</string>+ <string name="settings_own_lists_guide">How to use your own lists</string>+ <string name="settings_own_lists">Use your own debloat lists</string>+ <!-- Above the name of the source of the debloat lists -->+ <string name="settings_lists_from">Lists from</string>+ <string name="settings_open_cleanyourtv">Open cleanyourtv on GitHub</string>+ <string name="settings_source_title">Where the lists come from</string>+ <string name="settings_source_text">To use your own lists, fork tellyscope-devices, edit it, and paste the address of the folder that holds index.json, like https://raw.githubusercontent.com/you/tellyscope-devices/main/. Protected apps stay protected whatever a list says.</string>+ <string name="settings_use_lists">Use these lists</string>+ <string name="settings_reset">Reset to default</string>+ <string name="settings_cancel">Cancel</string>++ <!-- ConnectScreen -->+ <string name="connect_back">Back</string>+ <string name="connect_back_to_tvs">Back to TVs</string>+ <string name="connect_try_again">Try again</string>+ <string name="connect_cancel">Cancel</string>+ <string name="connect_pairing">Pairing…</string>+ <string name="connect_pair">Pair</string>+ <!-- On the Pair button while the code is incomplete -->+ <plurals name="connect_more_digits">+ <item quantity="one">%1$d more digit</item>+ <item quantity="other">%1$d more digits</item>+ </plurals>+ <!-- A TV with no network name -->+ <string name="connect_android_device">Android device</string>+ <string name="connect_code_title">Type the pairing code</string>+ <string name="connect_code_text">On the TV, open the pairing screen and type the 6 digits it shows.</string>+ <!-- Label above the TV's own error message -->+ <string name="connect_from_tv">From the TV</string>+ <string name="connect_no_answer">No answer from the TV</string>+ <string name="connect_not_accepted">The TV didn\'t accept the connection.</string>+ <string name="connect_check_awake">Is the TV on and awake?</string>+ <string name="connect_check_denied">Was the box on the TV closed, or Deny pressed? Try again and it asks once more.</string>+ <string name="connect_check_restart">Some TVs switch debugging off after a restart. Turn it back on.</string>+ <!-- One item of a bulleted list -->+ <string name="connect_bullet">• %1$s</string>+ <string name="connect_allow_title">Allow on your TV</string>+ <!-- **…** marks bold text; keep the marks around the TV's button names -->+ <string name="connect_allow_text_key">A box pops up on your TV. Check its key matches this phone\'s, tick **Always allow**, then select **Allow**.</string>+ <string name="connect_allow_text">A box pops up on your TV. Tick **Always allow**, then select **Allow**.</string>+ <string name="connect_phone_key">This phone\'s key</string>+ <!-- %1$d is seconds waited so far -->+ <string name="connect_waiting">Waiting for the TV… %1$d s</string>+ <string name="connect_connecting">Connecting</string>+ <string name="connect_reaching">Reaching the TV…</string>+ <!-- A drawing of the box Android shows on the TV: use the wording Android uses in this language -->+ <string name="connect_tv_allow_title">Allow USB debugging?</string>+ <string name="connect_tv_fingerprint">The computer\'s RSA key fingerprint is:</string>+ <string name="connect_tv_always">Always allow from this computer</string>+ <string name="connect_tv_cancel">Cancel</string>+ <string name="connect_tv_allow">Allow</string>+ <string name="connect_code_description">Pairing code</string>++ <!-- Transfers -->+ <string name="transfers_install_app">Install app</string>+ <string name="transfers_disabling">Disabling…</string>+ <string name="transfers_debloat">Debloat</string>+ <string name="transfers_send_file">Send file</string>+ <!-- Menu item: send a file to this folder on the TV; %1$s is the folder's name -->+ <string name="transfers_to_folder">To %1$s</string>+ <string name="transfers_tap_to_save">Tap a file to save a copy on your phone.</string>+ <string name="transfers_save">Save</string>+ <string name="transfers_reading">Reading the app</string>+ <!-- %1$s is the app's name -->+ <string name="transfers_install_failed">Couldn\'t install %1$s</string>+ <string name="transfers_cant_install">Can\'t install that</string>+ <string name="transfers_version">Version %1$s</string>+ <!-- How many files the app comes in -->+ <plurals name="transfers_parts">+ <item quantity="one">%1$d part</item>+ <item quantity="other">%1$d parts</item>+ </plurals>+ <string name="transfers_sending_percent">Sending to the TV · %1$d%%</string>+ <string name="transfers_installing">Installing on the TV…</string>+ <!-- %1$s is the TV's own message, untranslated -->+ <string name="transfers_tv_said">The TV said: %1$s</string>+ <string name="transfers_open_on_tv">Open on TV</string>+ <string name="transfers_ok">OK</string>+ <string name="transfers_cancel">Cancel</string>+ <string name="transfers_done">Done</string>+ <string name="transfers_report">Report a problem</string>+ <!-- %1$s is a folder on the TV -->+ <string name="transfers_sending_to">Sending to %1$s</string>+ <string name="transfers_saving">Saving to your phone</string>+ <!-- Bytes copied so far, of the file's size -->+ <string name="transfers_progress">%1$s of %2$s</string>+ <string name="transfers_starting">Starting…</string>++ <!-- ScanScreen -->+ <string name="scan_back">Back</string>+ <string name="scan_title">Add your TV</string>+ <string name="scan_no_lan">You\'re not on Wi-Fi, so only TVs that announce themselves show up. Join your TV\'s Wi-Fi.</string>+ <string name="scan_same_wifi">Keep your phone and TV on the same Wi-Fi.</string>+ <string name="scan_add_by_ip">Add by IP address</string>+ <string name="scan_cant_find">Can\'t find your TV?</string><string name="scan_rescan">Rescan</string><string name="scan_none_yet_in">No TV yet. Looking again in %1$d s</string>+ <!-- A TV with no network name -->+ <string name="scan_android_device">Android device</string>+ <string name="scan_connect">Connect</string>+ <string name="scan_try_again">Try again</string>+ <string name="scan_continue">Continue</string>+ <string name="scan_looking_first">Looking for your TV…</string>+ <string name="scan_looking_more">Looking for more TVs…</string>+ <string name="scan_none_yet">No TV yet. Tellyscope looks again in a moment.</string>+ <string name="scan_again">Scan again</string>+ <string name="scan_off_wifi_title">This phone isn\'t on Wi-Fi</string>+ <string name="scan_off_wifi_text">Join the same Wi-Fi as your TV. Tellyscope looks for it again as soon as you\'re on.</string>+ <string name="scan_open_wifi">Open Wi-Fi settings</string>+ <string name="scan_ip_hint">Find it on the TV under Settings → Network → your Wi-Fi.</string>+ <!-- %1$s is the phone's address range, in CIDR form -->+ <string name="scan_subnet">Your Wi-Fi: %1$s</string>+ <string name="scan_cancel">Cancel</string>++ <!-- screens_c -->++ <!-- Shared by the screens in this group: buttons and screen-reader labels. -->+ <string name="screen_done">Done</string>+ <string name="screen_cancel">Cancel</string>+ <string name="screen_try_again">Try again</string>+ <string name="screen_continue">Continue</string>+ <string name="screen_back">Back</string>+ <string name="screen_back_to_tv">Back to the TV\'s page</string>+ <!-- Screen-reader label for a step or app that hasn't started yet. -->+ <string name="screen_waiting">Waiting</string>++ <!-- A result row's reason, the TV's own words or ours, ended as a sentence. -->+ <string name="result_reason">%1$s.</string>+ <!-- The same, for one app: app name, then the reason. -->+ <string name="result_reason_app">%1$s: %2$s.</string>++ <!-- Another device asks to connect -->+ <string name="request_close">Close</string>++ <!-- Reset TV -->+ <string name="reset_read_failed">Couldn\'t read the TV</string>+ <string name="reset_reading">Reading the TV…</string>+ <string name="reset_hide_list">Hide the list</string>+ <string name="reset_show_list">Show the list</string>++ <!-- Install a home screen -->+ <string name="launcher_close">Close</string>+ <!-- The Play Store's Install button, shown in bold where it appears in copy_install_it_text: must match that word exactly. -->+ <string name="launcher_install_word">Install</string>+ <string name="launcher_ok">OK</string>++ <!-- History -->+ <string name="history_empty_title">Nothing changed yet</string>+ <string name="history_empty_text">Anything you stop, disable or turn on shows up here, with a way to undo it.</string>+ <string name="history_restoring">Turning apps back on…</string>+ <!-- Button; the number is how many apps are still off. -->+ <string name="history_restore_all">Restore everything (%1$d)</string>+ <string name="history_undone">Undone</string>++ <!-- Debloat run -->+ <string name="debloat_title">Debloat</string>+ <!-- Screen-reader label for an app the TV refused to turn off. -->+ <string name="debloat_failed">Didn\'t turn off</string>++ <!-- Logged out -->+ <string name="logged_out_back_to_tvs">Back to TVs</string>+ <string name="logged_out_connect_again">Connect again</string>+ <string name="logged_out_causes_title">Why this can happen</string>+ <!-- One cause in the list under logged_out_causes_title. -->+ <string name="logged_out_cause">• %1$s</string>++ <!-- Nearby devices permission (also shown on the welcome screen) -->+ <string name="permission_title">Find TVs on your Wi-Fi</string>+ <string name="permission_local_network_text">Android asks before an app talks to other devices on your Wi-Fi. Tellyscope only connects to the TVs you pick.</string>+ <string name="permission_denied">Without it, Tellyscope can\'t see any TV. In Settings, open Permissions → Nearby devices and choose Allow.</string>+ <string name="permission_open_settings">Open Settings</string>+ <string name="permission_ask_again">Ask again</string>++ <!-- Update dialog -->+ <!-- The argument is the version, e.g. 0.3.0. -->+ <string name="update_title">🎉 Tellyscope %1$s is out</string>+ <string name="update_no_notes">No release notes.</string>+ <!-- Last line when the release notes are cut short. -->+ <string name="update_more_notes">…and more on GitHub</string>+ <string name="update_get">Get it</string>+ <string name="update_skip">Skip this version</string>+ <string name="update_later">Later</string>++ <!-- Welcome -->+ <string name="welcome_skip">Skip</string>+ <string name="welcome_title">Welcome to Tellyscope</string>+ <string name="welcome_text">See what\'s running on your Android TV, and turn off the apps you don\'t need. All from your phone, over Wi-Fi.</string>+ <string name="welcome_step_1">Turn on debugging on your TV. The next screen shows how for your brand.</string>+ <string name="welcome_step_2">Tellyscope finds the TV on your Wi-Fi.</string>+ <string name="welcome_step_3">Type the code the TV shows, or choose Allow when it asks.</string></resources>diff --git a/app/src/test/java/app/tellyscope/AppsTabsTest.kt b/app/src/test/java/app/tellyscope/AppsTabsTest.ktindex 8b44099..042b419 100644--- a/app/src/test/java/app/tellyscope/AppsTabsTest.kt+++ b/app/src/test/java/app/tellyscope/AppsTabsTest.kt@@ -5,6 +5,7 @@ package app.tellyscopeimport app.tellyscope.data.AppInfoimport app.tellyscope.data.FoldBookimport app.tellyscope.data.Proc+import app.tellyscope.data.UiTextimport app.tellyscope.ui.AppsTabimport app.tellyscope.ui.splitAppsimport org.junit.Assert.assertEquals@@ -15,20 +16,21 @@ import org.junit.rules.TemporaryFolderclass AppsTabsTest {@get:Rule val tmp = TemporaryFolder()- private fun app(pkg: String, system: Boolean, locked: String? = null, home: String? = null) =+ private fun app(pkg: String, system: Boolean, locked: UiText? = null, home: String? = null) =AppInfo(pkg, pkg.substringAfterLast('.').replaceFirstChar { it.uppercase() }, null, system, true, locked, "1", homeInstead = home)- private val launcher = app("com.tv.launcher", system = true, locked = "this is your home screen")+ private val HOME_SCREEN = UiText(R.string.data_protected_home_screen)+ private val launcher = app("com.tv.launcher", system = true, locked = HOME_SCREEN)private val apps = listOf(app("org.mine.jellyfin", system = false),app("org.mine.netflix", system = false),- app("org.mine.projectivy", system = false, locked = "this is your home screen"),+ app("org.mine.projectivy", system = false, locked = HOME_SCREEN),app("com.maker.assistant", system = true),app("com.maker.ota", system = true),- app("com.android.systemui", system = true, locked = "the TV needs this to draw the screen"),- app("com.google.android.gms", system = true, locked = "most apps stop working without it"),+ app("com.android.systemui", system = true, locked = UiText(R.string.data_protected_system)),+ app("com.google.android.gms", system = true, locked = UiText(R.string.data_protected_play_services)),// A launcher that's protected by name but offered as the new home screen stays changeable.- app("org.other.home", system = false, locked = "launcher", home = launcher.packageName),+ app("org.other.home", system = false, locked = HOME_SCREEN, home = launcher.packageName),launcher,)private fun proc(pkg: String, ram: Int = 50) = Proc(1, pkg, pkg, 1.0, ram)@@ -50,7 +52,7 @@ class AppsTabsTest {@Test fun `running never puts a launcher the user installed under System, even a locked one`() {// No default home and the TV's own launcher off: a launcher the user installed stays protected.- val projectivy = app("com.spocky.projengmenu", system = false, locked = "this is your home screen").copy(removable = true)+ val projectivy = app("com.spocky.projengmenu", system = false, locked = HOME_SCREEN).copy(removable = true)val split = splitApps(listOf(projectivy, launcher), listOf(proc(projectivy.packageName), proc(launcher.packageName)), AppsTab.Running)assertEquals(listOf("projengmenu"), names(split.apps))assertEquals(listOf("launcher"), names(split.system))@@ -63,7 +65,7 @@ class AppsTabsTest {}@Test fun `a protected launcher offered in place of an app the TV doesn't have stays locked`() {- val gone = app("com.maker.home", system = true, locked = "launcher", home = "com.not.installed")+ val gone = app("com.maker.home", system = true, locked = HOME_SCREEN, home = "com.not.installed")val split = splitApps(apps + gone, procs, AppsTab.BuiltIn)assertEquals(listOf("assistant", "ota"), names(split.apps))assertEquals(listOf("gms", "home", "launcher", "systemui"), names(split.system))diff --git a/app/src/test/java/app/tellyscope/BusyGatingTest.kt b/app/src/test/java/app/tellyscope/BusyGatingTest.ktindex f39d7a2..ffec6e0 100644--- a/app/src/test/java/app/tellyscope/BusyGatingTest.kt+++ b/app/src/test/java/app/tellyscope/BusyGatingTest.kt@@ -38,20 +38,20 @@ class BusyGatingTest {@Test fun appButtonsWaitWhileTheTvIsBusy() {compose.setContent { AppRow(app, emptyList(), null, busy = false, actions = DeviceActions(), locked = true) }compose.onNodeWithText("Example").performClick()- compose.onNodeWithText(Copy.button(Action.Disable)).assertIsNotEnabled()- compose.onNodeWithText(Copy.button(Action.Uninstall)).assertIsNotEnabled()+ compose.onNodeWithText(Copy.button(Action.Disable).text()).assertIsNotEnabled()+ compose.onNodeWithText(Copy.button(Action.Uninstall).text()).assertIsNotEnabled()}@Test fun confirmWaitsWhileTheTvIsBusy() {// Proposed before a restore started: the explanation stays, its button waits.compose.setContent { AppRow(app, emptyList(), pkg to Action.Disable, busy = false, actions = DeviceActions(), locked = true) }- compose.onNodeWithText(Copy.confirm(Action.Disable)).assertIsNotEnabled()+ compose.onNodeWithText(Copy.confirm(Action.Disable).text()).assertIsNotEnabled()}@Test fun undoAndRestoreWaitWhileTheTvIsBusy() {val history = listOf(HistoryEntry(1, "tv", 0L, Action.Disable, pkg, "Example", Action.Enable, null))compose.setContent { HistoryList(history, 0L, onUndo = {}, busy = true) }- compose.onNodeWithText(Copy.undo(Action.Enable)).assertIsNotEnabled()+ compose.onNodeWithText(Copy.undo(Action.Enable).text()).assertIsNotEnabled()compose.onNodeWithText("Restore everything (1)").assertIsNotEnabled()}@@ -59,13 +59,13 @@ class BusyGatingTest {val history = listOf(HistoryEntry(1, "tv", 0L, Action.Disable, pkg, "Example", Action.Enable, null))compose.setContent { HistoryList(history, 0L, onUndo = {}, restoring = true) }compose.onNodeWithText("Turning apps back on…").assertIsNotEnabled()- compose.onNodeWithText(Copy.undo(Action.Enable)).assertIsNotEnabled()+ compose.onNodeWithText(Copy.undo(Action.Enable).text()).assertIsNotEnabled()}@Test fun idleUndoStillWorks() {val history = listOf(HistoryEntry(1, "tv", 0L, Action.Disable, pkg, "Example", Action.Enable, null))compose.setContent { HistoryList(history, 0L, onUndo = {}) }- compose.onNodeWithText(Copy.undo(Action.Enable)).assertIsEnabled()+ compose.onNodeWithText(Copy.undo(Action.Enable).text()).assertIsEnabled()}private val lists = Suggestions.Ready(diff --git a/app/src/test/java/app/tellyscope/CopyTest.kt b/app/src/test/java/app/tellyscope/CopyTest.ktindex 475c058..6bdf0d4 100644--- a/app/src/test/java/app/tellyscope/CopyTest.kt+++ b/app/src/test/java/app/tellyscope/CopyTest.kt@@ -8,15 +8,15 @@ import org.junit.Testclass CopyTest {@Test fun upForSpellsOutTheLargestUnits() {- assertEquals("3 days, 4 hours", Copy.upFor(3 * 86_400L + 4 * 3_600 + 59))- assertEquals("1 day", Copy.upFor(86_400L + 120))- assertEquals("1 hour", Copy.upFor(3_600L + 300))- assertEquals("12 minutes", Copy.upFor(12 * 60L))+ assertEquals("3 days, 4 hours", Copy.upFor(3 * 86_400L + 4 * 3_600 + 59).text())+ assertEquals("1 day", Copy.upFor(86_400L + 120).text())+ assertEquals("1 hour", Copy.upFor(3_600L + 300).text())+ assertEquals("12 minutes", Copy.upFor(12 * 60L).text())}@Test fun speedUsesTheSameUnitsAsSizes() {- assertEquals("2.3 MB/s", Copy.speed(2_400_000))- assertEquals("12 KB/s", Copy.speed(12_500))- assertEquals("300 bytes/s", Copy.speed(300))+ assertEquals("2.3 MB/s", Copy.speed(2_400_000).text())+ assertEquals("12 KB/s", Copy.speed(12_500).text())+ assertEquals("300 bytes/s", Copy.speed(300).text())}}diff --git a/app/src/test/java/app/tellyscope/DebloatGateTest.kt b/app/src/test/java/app/tellyscope/DebloatGateTest.ktindex 39926ed..6191b91 100644--- a/app/src/test/java/app/tellyscope/DebloatGateTest.kt+++ b/app/src/test/java/app/tellyscope/DebloatGateTest.kt@@ -27,18 +27,18 @@ class DebloatGateTest {@Test fun withoutAnAddedLauncherAHomeScreenLeads() {gate(launcher = true)- compose.onNodeWithText(Copy.GATE_LAUNCHER).assertExists()- compose.onNodeWithText(Copy.CHOOSE_HOME).performClick()- compose.onNodeWithText(Copy.GO_TO_APPS).performClick()- compose.onNodeWithText(Copy.DONT_SHOW_AGAIN).performClick()+ compose.onNodeWithText(Copy.GATE_LAUNCHER.text()).assertExists()+ compose.onNodeWithText(Copy.CHOOSE_HOME.text()).performClick()+ compose.onNodeWithText(Copy.GO_TO_APPS.text()).performClick()+ compose.onNodeWithText(Copy.DONT_SHOW_AGAIN.text()).performClick()assertEquals(listOf("choose", "apps", "never"), taps)}@Test fun withALauncherSetAppsLeads() {gate(launcher = false)- compose.onNodeWithText(Copy.GATE_APPS).assertExists()- compose.onNodeWithText(Copy.CHOOSE_HOME).assertDoesNotExist()- compose.onNodeWithText(Copy.DONT_SHOW_AGAIN).performClick()+ compose.onNodeWithText(Copy.GATE_APPS.text()).assertExists()+ compose.onNodeWithText(Copy.CHOOSE_HOME.text()).assertDoesNotExist()+ compose.onNodeWithText(Copy.DONT_SHOW_AGAIN.text()).performClick()assertEquals(listOf("never"), taps)}}diff --git a/app/src/test/java/app/tellyscope/DebloatRunTest.kt b/app/src/test/java/app/tellyscope/DebloatRunTest.ktindex eb47fa4..6b113c6 100644--- a/app/src/test/java/app/tellyscope/DebloatRunTest.kt+++ b/app/src/test/java/app/tellyscope/DebloatRunTest.kt@@ -86,7 +86,7 @@ class DebloatRunTest {val r = run!!assertTrue(r.ran)assertEquals(3, r.at)- assertEquals(mapOf(SPORTS.packageName to "the TV refused it"), r.failed)+ assertEquals(mapOf(SPORTS.packageName to "the TV refused it"), r.failed.mapValues { it.value.text() })assertNull(vm.state.value.device.busy)// The result replaces the old snackbar.assertNull(vm.notice.value)diff --git a/app/src/test/java/app/tellyscope/DebloatStateTest.kt b/app/src/test/java/app/tellyscope/DebloatStateTest.ktindex d8a2175..076debd 100644--- a/app/src/test/java/app/tellyscope/DebloatStateTest.kt+++ b/app/src/test/java/app/tellyscope/DebloatStateTest.kt@@ -9,6 +9,7 @@ import app.tellyscope.data.HistoryEntryimport app.tellyscope.data.ListGroupimport app.tellyscope.data.ListPackageimport app.tellyscope.data.Suggestions+import app.tellyscope.data.UiTextimport app.tellyscope.data.suggestimport app.tellyscope.ui.DeviceUiimport app.tellyscope.ui.debloatState@@ -23,7 +24,7 @@ class DebloatStateTest {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 app(pkg: String, enabled: Boolean, protected: UiText? = 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)@@ -56,7 +57,7 @@ class DebloatStateTest {}@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"))))+ val d = debloatState(ui(listOf(app("com.acme.keep", true), app("com.acme.a", true, protected = UiText(R.string.data_protected_system)))))assertEquals(0, d.total)assertFalse(d.todo)}diff --git a/app/src/test/java/app/tellyscope/DeviceListsTest.kt b/app/src/test/java/app/tellyscope/DeviceListsTest.ktindex 28ff814..6c50227 100644--- a/app/src/test/java/app/tellyscope/DeviceListsTest.kt+++ b/app/src/test/java/app/tellyscope/DeviceListsTest.kt@@ -11,6 +11,7 @@ import app.tellyscope.data.ListGroupimport app.tellyscope.data.ListIndeximport app.tellyscope.data.ListMatchimport app.tellyscope.data.ListPackage+import app.tellyscope.data.UiTextimport app.tellyscope.data.matchesimport app.tellyscope.data.mergeimport app.tellyscope.data.SourceResult@@ -60,7 +61,7 @@ class DeviceListsTest {{"id": "other", "name": "Other TV", "match": null, "sdk": null, "file": "devices/other.json", "sha256": "${"0".repeat(64)}"}]}""".trimIndent().toByteArray()- private fun app(pkg: String, enabled: Boolean = true, protectedReason: String? = null) =+ private fun app(pkg: String, enabled: Boolean = true, protectedReason: UiText? = null) =AppInfo(pkg, pkg.substringAfterLast('.'), null, true, enabled, protectedReason, "")private fun served(vararg files: Pair<String, ByteArray>): suspend (String) -> ByteArray {@@ -248,7 +249,7 @@ class DeviceListsTest {assertTrue(suggest(list, listOf(app("com.acme.hdmi")), 30).isEmpty())// Nor one the app already protects.val builtIn = list.copy(keep = emptySet())- assertTrue(suggest(builtIn, listOf(app("com.acme.hdmi", protectedReason = "your remote or HDMI inputs could stop working")), 30).isEmpty())+ assertTrue(suggest(builtIn, listOf(app("com.acme.hdmi", protectedReason = UiText(R.string.data_protected_tv_inputs_remote))), 30).isEmpty())}private fun sha256(b: ByteArray) = MessageDigest.getInstance("SHA-256").digest(b).joinToString("") { "%02x".format(it) }diff --git a/app/src/test/java/app/tellyscope/DnsRollbackTest.kt b/app/src/test/java/app/tellyscope/DnsRollbackTest.ktindex 59aa593..70125b3 100644--- a/app/src/test/java/app/tellyscope/DnsRollbackTest.kt+++ b/app/src/test/java/app/tellyscope/DnsRollbackTest.kt@@ -10,6 +10,7 @@ import app.tellyscope.adb.Tweakimport app.tellyscope.adb.Tweaksimport app.tellyscope.data.Actionimport app.tellyscope.data.HistoryBook+import app.tellyscope.data.UiTextExceptionimport app.tellyscope.data.applyTweakimport java.io.Fileimport java.io.IOException@@ -47,11 +48,11 @@ class DnsRollbackTest {private suspend fun run(tv: NoDnsTv, book: HistoryBook): String = try {applyTweak(Tweaks(tv), Tweak.PRIVATE_DNS, dns, strictDns = true) { label, previous ->- book.record("tv", 0, Action.Change, Tweak.PRIVATE_DNS.name, label, Action.Change, previous = previous)+ book.record("tv", 0, Action.Change, Tweak.PRIVATE_DNS.name, label.text(), Action.Change, previous = previous)}error("should have thrown")} catch (e: IllegalStateException) {- e.message.orEmpty()+ (e as UiTextException).text.text()}@Test fun aProviderThatDoesntResolveIsPutBackAndNotRecorded() = runTest {diff --git a/app/src/test/java/app/tellyscope/FireOsTest.kt b/app/src/test/java/app/tellyscope/FireOsTest.ktindex 6cef90f..3197f63 100644--- a/app/src/test/java/app/tellyscope/FireOsTest.kt+++ b/app/src/test/java/app/tellyscope/FireOsTest.kt@@ -4,6 +4,7 @@ package app.tellyscopeimport android.net.Uriimport androidx.lifecycle.viewModelScope+import app.tellyscope.Rimport app.tellyscope.adb.ApkInfoimport app.tellyscope.adb.InstallResultimport app.tellyscope.adb.Progress@@ -24,6 +25,7 @@ import app.tellyscope.data.ScanHitimport app.tellyscope.data.ScanKindimport app.tellyscope.data.Snapshotimport app.tellyscope.data.Suggestions+import app.tellyscope.data.UiTextimport app.tellyscope.data.isFireOsimport app.tellyscope.data.isProjectivyimport app.tellyscope.data.latestTag@@ -70,9 +72,9 @@ private val amazon = tv("Amazon", "AFTKRT")private val insignia = tv("Insignia", "NS-43F301NA22")private val androidTv = tv("Google", "Chromecast")-private val fireHome = AppInfo(FIRE_TV_LAUNCHER, "Fire TV Home", null, true, true, "this is your home screen", "1.0", home = true)+private val fireHome = AppInfo(FIRE_TV_LAUNCHER, "Fire TV Home", null, true, true, UiText(R.string.data_protected_home_screen), "1.0", home = true)private val store = AppInfo(PLAY_STORE, "Google Play Store", null, true, true, null, "1.0")-private val tvHome = AppInfo("com.google.android.tvlauncher", "Google TV Home", null, true, true, "this is your home screen", "1.0", home = true)+private val tvHome = AppInfo("com.google.android.tvlauncher", "Google TV Home", null, true, true, UiText(R.string.data_protected_home_screen), "1.0", home = true)private const val TAG = "4.72"private const val PAGE = "https://github.com/spocky/miproja1/releases/tag/$TAG"diff --git a/app/src/test/java/app/tellyscope/HealthTest.kt b/app/src/test/java/app/tellyscope/HealthTest.ktindex 3c7887a..37e060c 100644--- a/app/src/test/java/app/tellyscope/HealthTest.kt+++ b/app/src/test/java/app/tellyscope/HealthTest.kt@@ -3,6 +3,7 @@package app.tellyscopeimport app.tellyscope.data.Snapshot+import app.tellyscope.data.UiTextimport app.tellyscope.ui.Copyimport org.junit.Assert.assertEqualsimport org.junit.Test@@ -15,10 +16,10 @@ class HealthTest {uptimeSeconds = 60, screenOn = true, procs = emptyList(),)- @Test fun fine() = assertEquals(Copy.Health(true, "Running fine"), Copy.health(snap(), listOf("YouTube")))+ @Test fun fine() = assertEquals(Copy.Health(true, UiText(R.string.copy_health_fine)), Copy.health(snap(), listOf("YouTube")))@Test fun storageBeforeMemory() {- assertEquals("Storage almost full", Copy.health(snap(ram = 0.95, storage = 0.95), emptyList()).text)+ assertEquals("Storage almost full", Copy.health(snap(ram = 0.95, storage = 0.95), emptyList()).text.text())}@Test fun thresholdIsNinetyPercent() {@@ -30,9 +31,9 @@ class HealthTest {@Test fun namesTheHeaviestOnlyWhenKnown() {assertEquals("Memory almost full: YouTube and Netflix use the most",- Copy.health(snap(ram = 0.95), listOf("YouTube", "Netflix", "Kodi")).text,+ Copy.health(snap(ram = 0.95), listOf("YouTube", "Netflix", "Kodi")).text.text(),)- assertEquals("Memory almost full", Copy.health(snap(ram = 0.95), emptyList()).text)+ assertEquals("Memory almost full", Copy.health(snap(ram = 0.95), emptyList()).text.text())}@Test fun missingStatsAreNotProblems() {diff --git a/app/src/test/java/app/tellyscope/HistoryBookTest.kt b/app/src/test/java/app/tellyscope/HistoryBookTest.ktindex 6d2daba..1cb1da0 100644--- a/app/src/test/java/app/tellyscope/HistoryBookTest.kt+++ b/app/src/test/java/app/tellyscope/HistoryBookTest.kt@@ -7,6 +7,7 @@ import app.tellyscope.data.FakeDeviceSourceimport app.tellyscope.data.HistoryBookimport app.tellyscope.data.HistoryEntryimport app.tellyscope.data.ResetRecord+import app.tellyscope.data.UiTextExceptionimport app.tellyscope.data.firstHomeServiceimport app.tellyscope.data.historyKeyimport app.tellyscope.data.restoreEach@@ -250,7 +251,7 @@ class HistoryBookTest {HistoryEntry(calls.toLong(), tv, 0, Action.Enable, pkg, pkg, Action.Disable, null)}}.exceptionOrNull()- assertEquals("turned 2 apps back on, then stopped: the TV refused", e?.message)+ assertEquals("turned 2 apps back on, then stopped: the TV refused", (e as UiTextException).text.text())}@Test fun aDroppedConnectionStillSaysHowFarItGot() = runTest {@@ -260,13 +261,13 @@ class HistoryBookTest {HistoryEntry(1, tv, 0, Action.Enable, pkg, pkg, Action.Disable, null)}}.exceptionOrNull()- assertEquals("turned 1 app back on, then stopped: connection reset", e?.message)+ assertEquals("turned 1 app back on, then stopped: connection reset", (e as UiTextException).text.text())}@Test fun aResetTurnsOnWhatTellyscopeLeftOffAndItsUndoPutsItBack() {val book = HistoryBook()book.record("tv", 0L, Action.Disable, "com.xgimi.ota", "XGIMI Updates", undo = Action.Enable)- val reset = book.record("tv", 1L, Action.Reset, "reset", ResetRecord.label(2), undo = Action.Reset,+ val reset = book.record("tv", 1L, Action.Reset, "reset", ResetRecord.label(2).text(), undo = Action.Reset,previous = mapOf(ResetRecord.ON to "com.xgimi.ota,com.google.android.videos"))assertEquals("Reset TV · 2 changes", reset.label)assertEquals(emptyList<String>(), HistoryBook.leftDisabled(book.entries("tv")))@@ -277,9 +278,9 @@ class HistoryBookTest {@Test fun amendRelabelsAPartlyUndoneReset() {val book = HistoryBook()- val reset = book.record("tv", 0L, Action.Reset, "reset", ResetRecord.label(3), undo = Action.Reset,+ val reset = book.record("tv", 0L, Action.Reset, "reset", ResetRecord.label(3).text(), undo = Action.Reset,previous = mapOf(ResetRecord.ON to "a.b,c.d", ResetRecord.BACK to "e.f"))- book.amend(reset.id, mapOf(ResetRecord.ON to "c.d", ResetRecord.BACK to null), ResetRecord.label(1))+ book.amend(reset.id, mapOf(ResetRecord.ON to "c.d", ResetRecord.BACK to null), ResetRecord.label(1).text())val left = book.entries("tv").single()assertEquals("Reset TV · 1 change", left.label)assertEquals(1, ResetRecord.changes(left.previous))diff --git a/app/src/test/java/app/tellyscope/HomeServiceTest.kt b/app/src/test/java/app/tellyscope/HomeServiceTest.ktindex 29b1804..c5b9144 100644--- a/app/src/test/java/app/tellyscope/HomeServiceTest.kt+++ b/app/src/test/java/app/tellyscope/HomeServiceTest.kt@@ -12,6 +12,7 @@ import androidx.compose.ui.test.onNodeWithTextimport androidx.compose.ui.test.performClickimport app.tellyscope.data.Actionimport app.tellyscope.data.AppInfo+import app.tellyscope.data.UiTextimport app.tellyscope.ui.AppRowimport app.tellyscope.ui.Copyimport app.tellyscope.ui.DeviceActions@@ -42,7 +43,7 @@ class HomeServiceTest {private val pkg = "com.spocky.projengmenu"private val stockPkg = "com.google.android.tvlauncher"private val stock = AppInfo(- stockPkg, "Google TV Home", null, true, true, "this is your home screen", "1.0",+ stockPkg, "Google TV Home", null, true, true, UiText(R.string.data_protected_home_screen), "1.0",home = true, answersHome = true, builtInLauncher = true,)private val projectivy = AppInfo(@@ -53,7 +54,7 @@ class HomeServiceTest {/** Projectivy on Home, the stock launcher turned off by the switch to it. */private val onHome = projectivy.copy(- homeInstead = null, home = true, homeBack = "Google TV Home", protectedReason = "this is your home screen",+ homeInstead = null, home = true, homeBack = "Google TV Home", protectedReason = UiText(R.string.data_protected_home_screen),)private val stockOff = stock.copy(enabled = false, home = false, answersHome = false, protectedReason = null)@@ -65,49 +66,49 @@ class HomeServiceTest {@Test fun theSwitchAsksAboutTheServiceSeparately() {val answers = mutableListOf<Boolean>()card(stock, projectivy, pending = pkg to Action.Home, actions = DeviceActions(confirmHome = { answers += it }))- inDialog(Copy.makeHomeTitle("Projectivy Launcher")).assertExists()- inDialog(Copy.MAKE_HOME).performClick()- compose.onNodeWithText(Copy.serviceTitle("Projectivy Launcher")).assertExists()- compose.onNodeWithText(Copy.SWITCH_WITHOUT).performClick()+ inDialog(Copy.makeHomeTitle("Projectivy Launcher").text()).assertExists()+ inDialog(Copy.MAKE_HOME.text()).performClick()+ compose.onNodeWithText(Copy.serviceTitle("Projectivy Launcher").text()).assertExists()+ compose.onNodeWithText(Copy.SWITCH_WITHOUT.text()).performClick()assertEquals(listOf(false), answers)}@Test fun turnItOnSwitchesWithTheService() {val answers = mutableListOf<Boolean>()card(stock, projectivy, pending = pkg to Action.Home, actions = DeviceActions(confirmHome = { answers += it }))- inDialog(Copy.MAKE_HOME).performClick()- compose.onNodeWithText(Copy.TURN_IT_ON).performClick()+ inDialog(Copy.MAKE_HOME.text()).performClick()+ compose.onNodeWithText(Copy.TURN_IT_ON.text()).performClick()assertEquals(listOf(true), answers)}@Test fun aLauncherWithoutAServiceSwitchesStraightAway() {var confirmed = falsecard(stock, projectivy.copy(homeService = false), pending = pkg to Action.Home, actions = DeviceActions(confirm = { confirmed = true }))- inDialog(Copy.explainReplace("Projectivy Launcher", "Google TV Home", stockPkg, service = false)).assertExists()- inDialog(Copy.MAKE_HOME).performClick()- compose.onNodeWithText(Copy.serviceTitle("Projectivy Launcher")).assertDoesNotExist()+ inDialog(Copy.explainReplace("Projectivy Launcher", "Google TV Home", stockPkg, service = false).text()).assertExists()+ inDialog(Copy.MAKE_HOME.text()).performClick()+ compose.onNodeWithText(Copy.serviceTitle("Projectivy Launcher").text()).assertDoesNotExist()assertTrue(confirmed)}@Test fun theStockHomeIsCurrentAndAnAddedLauncherOffersMakeHomeAndUninstall() {val proposed = mutableListOf<Pair<String, Action>>()card(stock, projectivy, actions = DeviceActions(propose = { p, a -> proposed += p to a }))- compose.onNodeWithText(Copy.opensOnHome("Google TV Home")).assertExists()- compose.onNodeWithText(Copy.CURRENT).assertExists()- compose.onNodeWithText(Copy.KEEPS_HOME).assertExists()- compose.onNodeWithText(Copy.MAKE_HOME).performClick()- compose.onNodeWithText(Copy.button(Action.Uninstall)).performClick()+ compose.onNodeWithText(Copy.opensOnHome("Google TV Home").text()).assertExists()+ compose.onNodeWithText(Copy.CURRENT.text()).assertExists()+ compose.onNodeWithText(Copy.KEEPS_HOME.text()).assertExists()+ compose.onNodeWithText(Copy.MAKE_HOME.text()).performClick()+ compose.onNodeWithText(Copy.button(Action.Uninstall).text()).performClick()assertEquals(listOf(pkg to Action.Home, pkg to Action.Uninstall), proposed)// A launcher was added, so the card no longer offers to get one.- compose.onNodeWithText(Copy.GET_LAUNCHER_TEXT).assertDoesNotExist()+ compose.onNodeWithText(Copy.GET_LAUNCHER_TEXT.text()).assertDoesNotExist()}@Test fun withNothingAddedTheCardOffersAnotherLauncher() {var installs = 0val store = AppInfo("com.android.vending", "Google Play Store", null, true, true, null, "1.0")card(stock, store, actions = DeviceActions(installLauncher = { installs++ }))- compose.onNodeWithText(Copy.GET_LAUNCHER_TEXT).assertExists()- compose.onNode(hasText(Copy.GET_LAUNCHER) and androidx.compose.ui.test.hasClickAction()).performClick()+ compose.onNodeWithText(Copy.GET_LAUNCHER_TEXT.text()).assertExists()+ compose.onNode(hasText(Copy.GET_LAUNCHER.text()) and androidx.compose.ui.test.hasClickAction()).performClick()assertEquals(1, installs)}@@ -115,9 +116,9 @@ class HomeServiceTest {var confirmed = falseval first = projectivy.copy(homeInstead = null, homeFirst = true, homeService = false)card(first, pending = pkg to Action.Home, actions = DeviceActions(confirm = { confirmed = true }))- compose.onNodeWithText(Copy.NO_DEFAULT).assertExists()- inDialog(Copy.explainFirstHome("Projectivy Launcher", pkg)).assertExists()- inDialog(Copy.MAKE_HOME).performClick()+ compose.onNodeWithText(Copy.NO_DEFAULT.text()).assertExists()+ inDialog(Copy.explainFirstHome("Projectivy Launcher", pkg).text()).assertExists()+ inDialog(Copy.MAKE_HOME.text()).performClick()assertTrue(confirmed)}@@ -131,19 +132,19 @@ class HomeServiceTest {@Test fun fromAnAddedLauncherTheTvsOwnGoesBackAndTurnsBackOn() {val proposed = mutableListOf<Pair<String, Action>>()card(onHome, stockOff, actions = DeviceActions(propose = { p, a -> proposed += p to a }))- compose.onNodeWithText(Copy.builtIn(off = true)).assertExists()- compose.onNodeWithText(Copy.MAKE_HOME).performClick()+ compose.onNodeWithText(Copy.builtIn(off = true).text()).assertExists()+ compose.onNodeWithText(Copy.MAKE_HOME.text()).performClick()assertEquals(listOf(stockPkg to Action.HomeBack), proposed)}@Test fun makingTheTvsOwnHomeSaysTheAddedOnesServiceGoesOff() {var confirmed = falsecard(onHome, stockOff, pending = stockPkg to Action.HomeBack, actions = DeviceActions(confirm = { confirmed = true }))- val text = Copy.explainLeave("Google TV Home", off = true, "Projectivy Launcher", currentService = true, service = false)+ val text = Copy.explainLeave("Google TV Home", off = true, "Projectivy Launcher", currentService = true, service = false).text()inDialog(text).assertExists()assertTrue("turns off Projectivy Launcher's accessibility service" in text)assertTrue("turns Google TV Home back on" in text)- inDialog(Copy.MAKE_HOME).performClick()+ inDialog(Copy.MAKE_HOME.text()).performClick()assertTrue(confirmed)}@@ -151,7 +152,7 @@ class HomeServiceTest {val f = flauncher.copy(homeInstead = pkg)assertEquals(Action.Home, homeMove(f, onHome))card(onHome, f, stockOff, pending = f.packageName to Action.Home)- val text = Copy.explainLeave("FLauncher", off = false, "Projectivy Launcher", currentService = true, service = false)+ val text = Copy.explainLeave("FLauncher", off = false, "Projectivy Launcher", currentService = true, service = false).text()inDialog(text).assertExists()assertTrue("Projectivy Launcher stays installed and on" in text)assertFalse("turns off FLauncher" in text)@@ -163,40 +164,40 @@ class HomeServiceTest {card(stock, projectivy.copy(enabled = false), pending = pkg to Action.Home, actions = DeviceActions(cancel = { cancels++ }))compose.waitForIdle()assertEquals(1, cancels)- inDialog(Copy.MAKE_HOME).assertDoesNotExist()+ inDialog(Copy.MAKE_HOME.text()).assertDoesNotExist()}@Test fun theHomeRowSaysTheServiceIsOffAndOffersTurnOn() {var on: String? = nullcard(onHome.copy(homeServiceOff = true), stockOff, actions = DeviceActions(homeServiceOn = { on = it }))- compose.onNodeWithText(Copy.SERVICE_OFF).assertExists()- compose.onNodeWithText(Copy.TURN_ON).performClick()+ compose.onNodeWithText(Copy.SERVICE_OFF.text()).assertExists()+ compose.onNodeWithText(Copy.TURN_ON.text()).performClick()// Not now leaves it off; Turn it on asks the TV.- compose.onNodeWithText(Copy.NOT_NOW).performClick()+ compose.onNodeWithText(Copy.NOT_NOW.text()).performClick()assertNull(on)- compose.onNodeWithText(Copy.TURN_ON).performClick()- compose.onNodeWithText(Copy.TURN_IT_ON).performClick()+ compose.onNodeWithText(Copy.TURN_ON.text()).performClick()+ compose.onNodeWithText(Copy.TURN_IT_ON.text()).performClick()assertEquals(pkg, on)}@Test fun uninstallOnTheHomeOneListsTheSteps() {card(onHome, stockOff, pending = pkg to Action.Uninstall)- inDialog(Copy.uninstallHome("Projectivy Launcher", "Google TV Home", service = true)).assertExists()+ inDialog(Copy.uninstallHome("Projectivy Launcher", "Google TV Home", service = true).text()).assertExists()}@Test fun theHomeUninstallConfirmSaysWhatHappensFirst() {compose.setContent { UninstallDialog(onHome, onUninstall = {}, onDismiss = {}) }- compose.onNodeWithText(Copy.uninstallHome("Projectivy Launcher", "Google TV Home", service = true)).assertExists()- assertTrue("Turns off Projectivy Launcher's accessibility service" in Copy.uninstallHome("Projectivy Launcher", "Google TV Home", service = true))- assertFalse("accessibility" in Copy.uninstallHome("FLauncher", "Google TV Home", service = false))+ compose.onNodeWithText(Copy.uninstallHome("Projectivy Launcher", "Google TV Home", service = true).text()).assertExists()+ assertTrue("Turns off Projectivy Launcher's accessibility service" in Copy.uninstallHome("Projectivy Launcher", "Google TV Home", service = true).text())+ assertFalse("accessibility" in Copy.uninstallHome("FLauncher", "Google TV Home", service = false).text())}@Test fun anAppsRowForALauncherLinksToTheCardInsteadOfSwitching() {var opened = 0compose.setContent { AppRow(projectivy, emptyList(), null, busy = false, actions = DeviceActions(), toHomeScreen = { opened++ }) }compose.onNodeWithText("Projectivy Launcher").performClick()- compose.onNodeWithText(Copy.MAKE_HOME).assertDoesNotExist()- compose.onNodeWithText(Copy.HOME_SETTINGS).performClick()+ compose.onNodeWithText(Copy.MAKE_HOME.text()).assertDoesNotExist()+ compose.onNodeWithText(Copy.HOME_SETTINGS.text()).performClick()assertEquals(1, opened)}@@ -204,16 +205,16 @@ class HomeServiceTest {var proposed: Pair<String, Action>? = nullcompose.setContent { AppRow(onHome, emptyList(), null, busy = false, actions = DeviceActions(propose = { p, a -> proposed = p to a })) }compose.onNodeWithText("Projectivy Launcher").performClick()- compose.onNodeWithText(Copy.HOME_SETTINGS).assertExists()- compose.onNodeWithText(Copy.button(Action.Uninstall)).performClick()+ compose.onNodeWithText(Copy.HOME_SETTINGS.text()).assertExists()+ compose.onNodeWithText(Copy.button(Action.Uninstall).text()).performClick()assertEquals(pkg to Action.Uninstall, proposed)}@Test fun aLauncherOnHomeTheTvCameWithOffersNoUninstall() {compose.setContent { AppRow(stock, emptyList(), null, busy = false, actions = DeviceActions()) }compose.onNodeWithText("Google TV Home").performClick()- compose.onNodeWithText(Copy.HOME_SETTINGS).assertExists()- compose.onNodeWithText(Copy.button(Action.Uninstall)).assertDoesNotExist()+ compose.onNodeWithText(Copy.HOME_SETTINGS.text()).assertExists()+ compose.onNodeWithText(Copy.button(Action.Uninstall).text()).assertDoesNotExist()}@Test fun theCardsGotItAndTurnOn() {@@ -221,12 +222,12 @@ class HomeServiceTest {var on = falseval off = onHome.copy(homeServiceOff = true, homeServiceNote = true)compose.setContent { ServiceOffCard(off, onTurnOn = { on = true }, onDismiss = { dismissed = true }) }- compose.onNodeWithText(Copy.serviceOffTitle("Google TV Home")).assertExists()- compose.onNodeWithText(Copy.TURN_ON).performClick()+ compose.onNodeWithText(Copy.serviceOffTitle("Google TV Home").text()).assertExists()+ compose.onNodeWithText(Copy.TURN_ON.text()).performClick()assertFalse(on)- compose.onNodeWithText(Copy.TURN_IT_ON).performClick()+ compose.onNodeWithText(Copy.TURN_IT_ON.text()).performClick()assertTrue(on)- compose.onNodeWithText(Copy.GOT_IT).performClick()+ compose.onNodeWithText(Copy.GOT_IT.text()).performClick()assertTrue(dismissed)}}diff --git a/app/src/test/java/app/tellyscope/HomeSwitchTest.kt b/app/src/test/java/app/tellyscope/HomeSwitchTest.ktindex c170c2c..9ca0875 100644--- a/app/src/test/java/app/tellyscope/HomeSwitchTest.kt+++ b/app/src/test/java/app/tellyscope/HomeSwitchTest.kt@@ -13,6 +13,8 @@ import app.tellyscope.data.ActionFailedimport app.tellyscope.data.HistoryBookimport app.tellyscope.data.HistoryEntryimport app.tellyscope.data.ResetRecord+import app.tellyscope.data.UiText+import app.tellyscope.data.UiTextExceptionimport app.tellyscope.data.fireHomeBackimport app.tellyscope.data.fireServiceHolderimport app.tellyscope.data.fireServiceHome@@ -85,7 +87,7 @@ class HomeSwitchTest {private val book = HistoryBook()private suspend fun switch(tv: LauncherTv, pkg: String, withService: Boolean = true): HistoryEntry =- switchHome(Actions(tv), pkg, withService, setOf(PROJECTIVY), { it }, { it.name }) { from, undo, previous ->+ switchHome(Actions(tv), pkg, withService, setOf(PROJECTIVY), { it }, { UiText.Raw(it.name) }) { from, undo, previous ->book.record("tv", 0, Action.Home, from, pkg, undo, previous = previous)}@@ -150,7 +152,7 @@ class HomeSwitchTest {val tv = LauncherTv(TV_HOME).apply { opens = false }val e = runCatching { switch(tv, FLAUNCHER) }.exceptionOrNull()assertTrue(e?.message.orEmpty(), e is ActionFailed)- assertEquals("$FLAUNCHER is Home now, but it didn't open, so press Home on the remote to go there", e!!.message)+ assertEquals("$FLAUNCHER is Home now, but it didn't open, so press Home on the remote to go there", (e as UiTextException).text.text())assertEquals("Error: Activity not started", (e as ActionFailed).details)assertEquals(FLAUNCHER, tv.home)assertEquals(TV_HOME, book.entries("tv").single().packageName)diff --git a/app/src/test/java/app/tellyscope/LauncherFlowTest.kt b/app/src/test/java/app/tellyscope/LauncherFlowTest.ktindex 8f040ba..ff16afd 100644--- a/app/src/test/java/app/tellyscope/LauncherFlowTest.kt+++ b/app/src/test/java/app/tellyscope/LauncherFlowTest.kt@@ -18,6 +18,7 @@ import app.tellyscope.data.ScanKindimport app.tellyscope.data.Snapshotimport app.tellyscope.data.StoreStateimport app.tellyscope.data.Suggestions+import app.tellyscope.data.UiTextimport app.tellyscope.ui.Copyimport app.tellyscope.ui.LauncherActionsimport app.tellyscope.ui.LauncherCard@@ -58,7 +59,7 @@ private const val PROJECTIVY = "com.spocky.projengmenu"private const val FLAUNCHER = "me.efesser.flauncher"private val store = AppInfo(PLAY_STORE, "Google Play Store", null, true, true, null, "1.0")-private val stock = AppInfo(TV_HOME, "Google TV Home", null, true, true, "this is your home screen", "1.0", home = true)+private val stock = AppInfo(TV_HOME, "Google TV Home", null, true, true, UiText(R.string.data_protected_home_screen), "1.0", home = true)/** One online TV whose Play Store answers from a script. */private class StoreTv : DeviceSource by FakeDeviceSource(FakeDeviceSource.Scenario.Empty, clock = { 0L }) {@@ -77,7 +78,7 @@ private class StoreTv : DeviceSource by FakeDeviceSource(FakeDeviceSource.Scenaroverride suspend fun apps(deviceId: String) = listOf(store, stock) +when {- onHome -> listOf(AppInfo(PROJECTIVY, "Projectivy Launcher", null, false, true, "this is your home screen", "1.0", home = true, listedLauncher = true))+ onHome -> listOf(AppInfo(PROJECTIVY, "Projectivy Launcher", null, false, true, UiText(R.string.data_protected_home_screen), "1.0", home = true, listedLauncher = true))installed -> listOf(AppInfo(PROJECTIVY, "Projectivy Launcher", null, false, true, null, "1.0", homeInstead = TV_HOME, homeService = true))else -> emptyList()}@@ -265,7 +266,7 @@ class LauncherScreenTest {@Test fun anAddedLauncherOnHomeWithTheStockOneOffGetsNoCardButKeepsTheTweaksRow() {// Stock launcher disabled by hand or by Debloat: Projectivy is Home with no homeBack.val off = stock.copy(enabled = false, home = false)- val projectivy = AppInfo(PROJECTIVY, "Projectivy Launcher", null, false, true, "this is your home screen", "1.0", home = true, listedLauncher = true)+ val projectivy = AppInfo(PROJECTIVY, "Projectivy Launcher", null, false, true, UiText(R.string.data_protected_home_screen), "1.0", home = true, listedLauncher = true)assertFalse(offerLauncher(listOf(store, off, projectivy), hidden = false))assertFalse(offerChoose(listOf(store, off, projectivy)))// Any user-installed launcher counts, listed or not.@@ -279,7 +280,7 @@ class LauncherScreenTest {@Test fun anAddedLauncherThatIsNotHomeStillHidesTheCard() {// Installing a second launcher clears the default: nothing is Home, and both are on.- val noDefault = stock.copy(home = false, protectedReason = "this is your home screen")+ val noDefault = stock.copy(home = false, protectedReason = UiText(R.string.data_protected_home_screen))val projectivy = AppInfo(PROJECTIVY, "Projectivy Launcher", null, false, true, null, "1.0", removable = true, listedLauncher = true, homeInstead = TV_HOME, answersHome = true)val flauncher = AppInfo("me.efesser.flauncher", "FLauncher", null, false, true, null, "1.0", removable = true, listedLauncher = true, homeInstead = TV_HOME, answersHome = true)assertFalse(offerChoose(listOf(store, noDefault, projectivy, flauncher)))@@ -299,8 +300,8 @@ class LauncherScreenTest {var notNow = falsevar chose = falsecompose.setContent { LauncherCard("Google TV Home", onNotNow = { notNow = true }, onChoose = { chose = true }) }- compose.onNodeWithText(Copy.NOT_NOW).performClick()- compose.onNodeWithText(Copy.CHOOSE_ONE).performClick()+ compose.onNodeWithText(Copy.NOT_NOW.text()).performClick()+ compose.onNodeWithText(Copy.CHOOSE_ONE.text()).performClick()assertTrue(notNow && chose)}@@ -308,7 +309,7 @@ class LauncherScreenTest {val installs = mutableListOf<String>()compose.setContent { LauncherScreen(tv, LauncherFlow(), listOf(store, stock), LauncherActions(install = { installs += it })) }compose.onNodeWithText("FLauncher").performScrollTo().performClick() // under the bottom bar on a small screen- compose.onNodeWithText(Copy.GET_FROM_STORE).performClick()+ compose.onNodeWithText(Copy.GET_FROM_STORE.text()).performClick()assertEquals(listOf(FLAUNCHER), installs)}@@ -318,20 +319,20 @@ class LauncherScreenTest {compose.setContent {LauncherScreen(tv, LauncherFlow(pkg = PROJECTIVY), listOf(store, stock), LauncherActions(install = { installs += it }, fireCheck = { downloads++ }), direct = true)}- compose.onNodeWithText(Copy.STORE_RECOMMENDED).assertExists()- compose.onNodeWithText(Copy.DOWNLOAD_DIRECTLY).performClick()- compose.onNodeWithText(Copy.GET_FROM_STORE).performClick()+ compose.onNodeWithText(Copy.STORE_RECOMMENDED.text()).assertExists()+ compose.onNodeWithText(Copy.DOWNLOAD_DIRECTLY.text()).performClick()+ compose.onNodeWithText(Copy.GET_FROM_STORE.text()).performClick()assertEquals(1, downloads)assertEquals(listOf(PROJECTIVY), installs)compose.onNodeWithText("FLauncher").performScrollTo().performClick()- compose.onNodeWithText(Copy.DOWNLOAD_DIRECTLY).assertDoesNotExist()- compose.onNodeWithText(Copy.GET_FROM_STORE).assertExists()+ compose.onNodeWithText(Copy.DOWNLOAD_DIRECTLY.text()).assertDoesNotExist()+ compose.onNodeWithText(Copy.GET_FROM_STORE.text()).assertExists()}@Test fun withoutADownloadOnlyTheStoreIsOffered() {compose.setContent { LauncherScreen(tv, LauncherFlow(pkg = PROJECTIVY), listOf(store, stock), LauncherActions()) }- compose.onNodeWithText(Copy.DOWNLOAD_DIRECTLY).assertDoesNotExist()- compose.onNodeWithText(Copy.STORE_RECOMMENDED).assertDoesNotExist()+ compose.onNodeWithText(Copy.DOWNLOAD_DIRECTLY.text()).assertDoesNotExist()+ compose.onNodeWithText(Copy.STORE_RECOMMENDED.text()).assertDoesNotExist()}@Test fun theStoreDidntOpenOffersAnotherOrARetry() {@@ -340,9 +341,9 @@ class LauncherScreenTest {compose.setContent {LauncherScreen(tv, LauncherFlow(LauncherFlow.Step.NoStore, PROJECTIVY), listOf(store, stock), LauncherActions(install = { installs += it }, chooseAnother = { picks += it }))}- compose.onNodeWithText(Copy.NO_STORE).assertExists()- compose.onNodeWithText(Copy.TRY_AGAIN).performClick()- compose.onNodeWithText(Copy.CHOOSE_ANOTHER).performClick()+ compose.onNodeWithText(Copy.NO_STORE.text()).assertExists()+ compose.onNodeWithText(Copy.TRY_AGAIN.text()).performClick()+ compose.onNodeWithText(Copy.CHOOSE_ANOTHER.text()).performClick()assertEquals(listOf(PROJECTIVY), installs)assertEquals(listOf(PROJECTIVY), picks)}@@ -354,10 +355,10 @@ class LauncherScreenTest {compose.setContent {LauncherScreen(tv, LauncherFlow(pkg = FLAUNCHER), listOf(store, stock, flauncher), LauncherActions(makeHome = { p, s -> homes += p to s }, open = { opens += it }))}- compose.onNodeWithText(Copy.INSTALLED).assertExists()- compose.onNodeWithText(Copy.GET_FROM_STORE).assertDoesNotExist()- compose.onNodeWithText(Copy.OPEN).performClick()- compose.onNodeWithText(Copy.MAKE_HOME).performClick()+ compose.onNodeWithText(Copy.INSTALLED.text()).assertExists()+ compose.onNodeWithText(Copy.GET_FROM_STORE.text()).assertDoesNotExist()+ compose.onNodeWithText(Copy.OPEN.text()).performClick()+ compose.onNodeWithText(Copy.MAKE_HOME.text()).performClick()assertEquals(listOf(FLAUNCHER), opens)assertEquals(listOf(FLAUNCHER to false), homes)}@@ -365,22 +366,22 @@ class LauncherScreenTest {@Test fun theLauncherOnHomeOffersOnlyOpen() {val flauncher = AppInfo(FLAUNCHER, "FLauncher", null, false, true, null, "1.0", removable = true, answersHome = true, home = true, homeBack = "Google TV Home")compose.setContent { LauncherScreen(tv, LauncherFlow(pkg = FLAUNCHER), listOf(store, stock.copy(home = false), flauncher), LauncherActions()) }- compose.onNodeWithText(Copy.HOME_NOW).assertExists()- compose.onNodeWithText(Copy.OPEN).assertExists()- compose.onNodeWithText(Copy.MAKE_HOME).assertDoesNotExist()+ compose.onNodeWithText(Copy.HOME_NOW.text()).assertExists()+ compose.onNodeWithText(Copy.OPEN.text()).assertExists()+ compose.onNodeWithText(Copy.MAKE_HOME.text()).assertDoesNotExist()}@Test fun aLauncherNotRecommendedIsListedOnThisTv() {val wolf = AppInfo("com.wolf.firelauncher", "Wolf Launcher", null, false, true, null, "1.0", removable = true, answersHome = true, homeInstead = TV_HOME)compose.setContent { LauncherScreen(tv, LauncherFlow(), listOf(store, stock, wolf), LauncherActions()) }- compose.onNodeWithText(Copy.ON_THIS_TV).assertExists()+ compose.onNodeWithText(Copy.ON_THIS_TV.text()).assertExists()compose.onNodeWithText("Wolf Launcher").performClick()- compose.onNodeWithText(Copy.MAKE_HOME).assertExists()+ compose.onNodeWithText(Copy.MAKE_HOME.text()).assertExists()}@Test fun noOtherLauncherNoOnThisTv() {compose.setContent { LauncherScreen(tv, LauncherFlow(), listOf(store, stock), LauncherActions()) }- compose.onNodeWithText(Copy.ON_THIS_TV).assertDoesNotExist()+ compose.onNodeWithText(Copy.ON_THIS_TV.text()).assertDoesNotExist()}@Test fun yesOnAServiceLauncherAsksAboutTheService() {@@ -389,10 +390,10 @@ class LauncherScreenTest {compose.setContent {LauncherScreen(tv, LauncherFlow(LauncherFlow.Step.Installed, PROJECTIVY), listOf(store, stock, projectivy), LauncherActions(switch = { switches += it }))}- compose.onNodeWithText(Copy.MAKE_IT_HOME).assertExists()- compose.onNodeWithText(Copy.confirm(app.tellyscope.data.Action.Home)).performClick()- compose.onNodeWithText(Copy.serviceTitle("Projectivy Launcher")).assertExists()- compose.onNodeWithText(Copy.TURN_IT_ON).performClick()+ compose.onNodeWithText(Copy.MAKE_IT_HOME.text()).assertExists()+ compose.onNodeWithText(Copy.confirm(app.tellyscope.data.Action.Home).text()).performClick()+ compose.onNodeWithText(Copy.serviceTitle("Projectivy Launcher").text()).assertExists()+ compose.onNodeWithText(Copy.TURN_IT_ON.text()).performClick()assertEquals(listOf(true), switches)}}diff --git a/app/src/test/java/app/tellyscope/LoggedOutTest.kt b/app/src/test/java/app/tellyscope/LoggedOutTest.ktindex 11ce48e..082697b 100644--- a/app/src/test/java/app/tellyscope/LoggedOutTest.kt+++ b/app/src/test/java/app/tellyscope/LoggedOutTest.kt@@ -60,7 +60,7 @@ class LoggedOutTest {@Test fun anotherTvLoggingOutSaysSoAndViewOpensIt() {watch(selected = "kitchen")logOut("projector")- compose.onNodeWithText(Copy.loggedOutOf("Projector")).assertExists()+ compose.onNodeWithText(Copy.loggedOutOf("Projector").text()).assertExists()compose.onNodeWithText("View").performClick()compose.mainClock.advanceTimeBy(1_000)assertEquals("projector", viewed)@@ -69,14 +69,14 @@ class LoggedOutTest {@Test fun theTvOnScreenGetsThePageNotASnackbar() {watch(selected = "projector")logOut("projector")- compose.onNodeWithText(Copy.loggedOutOf("Projector")).assertDoesNotExist()+ compose.onNodeWithText(Copy.loggedOutOf("Projector").text()).assertDoesNotExist()}@Test fun alreadyLoggedOutAtLaunchGetsNoSnackbar() {devices.value = listOf(tv("projector", "Projector", loggedOutAt = 1L), tv("kitchen", "Kitchen"))watch(selected = "kitchen")compose.mainClock.advanceTimeBy(1_000)- compose.onNodeWithText(Copy.loggedOutOf("Projector")).assertDoesNotExist()+ compose.onNodeWithText(Copy.loggedOutOf("Projector").text()).assertDoesNotExist()}@Test fun connectAgainLeavesThePage() {@@ -90,11 +90,11 @@ class LoggedOutTest {@Test fun timeLineSaysWhen() {val hour = 3_600_000L- assertEquals("Logged out just now", Copy.loggedOutAt(0L, 60_000L))- assertEquals("Logged out yesterday", Copy.loggedOutAt(0L, 30 * hour))- assertEquals("Logged out 3 days ago", Copy.loggedOutAt(0L, 80 * hour))+ assertEquals("Logged out just now", Copy.loggedOutAt(0L, 60_000L).text())+ assertEquals("Logged out yesterday", Copy.loggedOutAt(0L, 30 * hour).text())+ assertEquals("Logged out 3 days ago", Copy.loggedOutAt(0L, 80 * hour).text())// A day is a calendar day: 23:00 is "yesterday" at 09:00 the next morning, ten hours on.val lateEvening = LocalDate.of(2026, 10, 25).atTime(23, 0).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()- assertEquals("Logged out yesterday", Copy.loggedOutAt(lateEvening, lateEvening + 10 * hour))+ assertEquals("Logged out yesterday", Copy.loggedOutAt(lateEvening, lateEvening + 10 * hour).text())}}diff --git a/app/src/test/java/app/tellyscope/ReportFlowTest.kt b/app/src/test/java/app/tellyscope/ReportFlowTest.ktindex c58b84e..d9a8b1a 100644--- a/app/src/test/java/app/tellyscope/ReportFlowTest.kt+++ b/app/src/test/java/app/tellyscope/ReportFlowTest.kt@@ -92,7 +92,7 @@ class ReportFlowTest {vm.openReport(ReportKind.Problem, "Tried to install Kodi", said = "INSTALL_FAILED_UPDATE_INCOMPATIBLE")val r = vm.state.value.report!!assertEquals("Tried to install Kodi", r.details)- assertEquals(listOf("00:00:00 " + Copy.cantOpen("Kodi"), "The TV said: INSTALL_FAILED_UPDATE_INCOMPATIBLE"), r.log!!.lines().map { it.replaceFirst(Regex("^\\d\\d:\\d\\d:\\d\\d"), "00:00:00") })+ assertEquals(listOf("00:00:00 " + Copy.cantOpen("Kodi").text(), "The TV said: INSTALL_FAILED_UPDATE_INCOMPATIBLE"), r.log!!.text().lines().map { it.replaceFirst(Regex("^\\d\\d:\\d\\d:\\d\\d"), "00:00:00") })}@Test fun withNoTvOnlineItSaysItCouldNotConnect() = with(test) {diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.ktindex 97c56b7..3fc76b0 100644--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt@@ -66,6 +66,7 @@ import app.tellyscope.data.Suggestedimport app.tellyscope.data.SuggestedGroupimport app.tellyscope.data.Procimport app.tellyscope.data.Suggestions+import app.tellyscope.data.UiTextimport app.tellyscope.ui.AboutDialogimport app.tellyscope.ui.Removalimport app.tellyscope.ui.ConnectedDevicesCard@@ -441,15 +442,15 @@ class ScreenshotTest {@Test fun md3_apps_builtin_dark() = appsTab("70_md3_apps_builtin", true, "Built-in")@Test fun md3_apps_offline() {shot("71_md3_apps_offline") { DeviceTabsScreen(offlineMd3(), DeviceActions(), startTab = TvTab.Apps) }- compose.onNodeWithText(Copy.RUNNING_OFFLINE).assertExists()+ compose.onNodeWithText(Copy.RUNNING_OFFLINE.text()).assertExists()}@Test fun md3_apps_offline_dark() { shot("71_md3_apps_offline", dark = true) { DeviceTabsScreen(offlineMd3(), DeviceActions(), startTab = TvTab.Apps) } }// Just opened: the list is still on its way, so Apps says so rather than "Nothing here yet."private fun appsLoading() = md3State().let { it.copy(device = it.device.copy(apps = emptyList(), appsLoading = true)) }@Test fun md3_apps_loading() {shot("78_md3_apps_loading") { DeviceTabsScreen(appsLoading(), DeviceActions(), startTab = TvTab.Apps) }- compose.onNodeWithText(Copy.READING_APPS).assertExists()- compose.onNodeWithText(Copy.TV_OFFLINE).assertDoesNotExist()+ compose.onNodeWithText(Copy.READING_APPS.text()).assertExists()+ compose.onNodeWithText(Copy.TV_OFFLINE.text()).assertDoesNotExist()}@Test fun md3_apps_loading_dark() { shot("78_md3_apps_loading", dark = true) { DeviceTabsScreen(appsLoading(), DeviceActions(), startTab = TvTab.Apps) } }// Folded, the System header stays with its count and the protected apps go.@@ -466,8 +467,8 @@ class ScreenshotTest {compose.mainClock.advanceTimeBy(1_000)compose.onNodeWithText("Built-in").performClick()compose.mainClock.advanceTimeBy(1_000)- compose.onNode(hasScrollAction()).performScrollToNode(hasText(Copy.SYSTEM_WHY))- compose.onNodeWithText(Copy.SYSTEM_WHY).performClick()+ compose.onNode(hasScrollAction()).performScrollToNode(hasText(Copy.SYSTEM_WHY.text()))+ compose.onNodeWithText(Copy.SYSTEM_WHY.text()).performClick()compose.mainClock.advanceTimeBy(1_000)assertEquals(AppsTab.BuiltIn to true, folded)}@@ -602,17 +603,17 @@ class ScreenshotTest {compose.onNodeWithContentDescription("More options").performClick()compose.mainClock.advanceTimeBy(1_000)// Every group is there: this TV's items, the app's, then Forget. Rename, Forget and About open dialogs.- for (i in listOf("Rename this TV", Copy.HISTORY, Copy.ADVANCED_MONITOR, "Settings", Copy.SHARE, "About & licences", Copy.RESET_TV, "Forget this TV")) compose.onNodeWithText(i).assertHasClickAction()+ for (i in listOf("Rename this TV", Copy.HISTORY.text(), Copy.ADVANCED_MONITOR.text(), "Settings", Copy.SHARE.text(), "About & licences", Copy.RESET_TV.text(), "Forget this TV")) compose.onNodeWithText(i).assertHasClickAction()compose.onNodeWithText(item).performClick()compose.mainClock.advanceTimeBy(1_000)return calls}- @Test fun tabs_menuAdvancedOpensAdvanced() = assertEquals(listOf("advanced"), pickFromMenu(Copy.ADVANCED_MONITOR))- @Test fun tabs_menuHistoryOpensHistory() = assertEquals(listOf("history"), pickFromMenu(Copy.HISTORY))+ @Test fun tabs_menuAdvancedOpensAdvanced() = assertEquals(listOf("advanced"), pickFromMenu(Copy.ADVANCED_MONITOR.text()))+ @Test fun tabs_menuHistoryOpensHistory() = assertEquals(listOf("history"), pickFromMenu(Copy.HISTORY.text()))@Test fun tabs_menuSettingsOpensSettings() = assertEquals(listOf("settings"), pickFromMenu("Settings"))@Test fun tabs_menuShareOpensShareSheet() {- assertEquals(emptyList<String>(), pickFromMenu(Copy.SHARE))+ assertEquals(emptyList<String>(), pickFromMenu(Copy.SHARE.text()))assertSharedTellyscope()}@@ -623,11 +624,11 @@ class ScreenshotTest {@Suppress("DEPRECATION") val send = chooser.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)!!assertEquals(Intent.ACTION_SEND, send.action)assertEquals("text/plain", send.type)- assertEquals(SHARE_TEXT, send.getStringExtra(Intent.EXTRA_TEXT))- assertTrue(SHARE_TEXT.endsWith(RELEASES.removeSuffix("/releases")))+ assertEquals(SHARE_TEXT.text(), send.getStringExtra(Intent.EXTRA_TEXT))+ assertTrue(SHARE_TEXT.text().endsWith(RELEASES.removeSuffix("/releases")))}- @Test fun tabs_menuResetOpensReset() = assertEquals(listOf("reset"), pickFromMenu(Copy.RESET_TV))+ @Test fun tabs_menuResetOpensReset() = assertEquals(listOf("reset"), pickFromMenu(Copy.RESET_TV.text()))private fun settings(opened: MutableList<String> = mutableListOf()) = @Composable {val links = object : UriHandler { override fun openUri(uri: String) { opened += uri } }@@ -656,7 +657,7 @@ class ScreenshotTest {@Test fun settings_shareOpensShareSheet() {compose.setContent { TellyscopeTheme(dark = false, dynamic = false) { settings()() } }- compose.onNodeWithText(Copy.SHARE).performClick()+ compose.onNodeWithText(Copy.SHARE.text()).performClick()assertSharedTellyscope()}@@ -679,7 +680,7 @@ class ScreenshotTest {val other = TvAccess(listOf(app.tellyscope.data.AccessClient("192.0.2.47", 1, app.tellyscope.data.AccessClient.Who.Other)), emptyList())val open = { compose.onNodeWithContentDescription("More options").performClick(); compose.mainClock.advanceTimeBy(1_000); Unit }shot("45_tabs_app_menu_warning", dark, screen = true, before = open) { DeviceTabsScreen(tabsState().let { it.copy(device = it.device.copy(access = other)) }, DeviceActions()) }- compose.onNodeWithText(Copy.othersConnected(1)).assertExists()+ compose.onNodeWithText(Copy.othersConnected(1).text()).assertExists()}@Test fun tabs_appMenuWarning() = appMenuWarning(false)@Test fun tabs_appMenuWarning_dark() = appMenuWarning(true)@@ -722,43 +723,43 @@ class ScreenshotTest {)private fun reset(name: String, dark: Boolean, ui: ResetUi, before: () -> Unit = {}) =shot(name, dark, before = before) { ResetScreen(deviceState { copy(reset = ui) }, ResetActions()) }- private val sportsFailed = listOf(ResetFailure(ResetPart.TurnOn, resetPlan.turnOn[4], "the TV didn't answer in time"))+ private val sportsFailed = listOf(ResetFailure(ResetPart.TurnOn, resetPlan.turnOn[4], UiText.Raw("the TV didn't answer in time")))@Test fun reset_found() {reset("a1_reset_found", false, ResetUi(plan = resetPlan))- compose.onNodeWithText(Copy.resetFound(18)).assertExists()- compose.onNodeWithText(Copy.RESET_BUTTON).assertHasClickAction()+ compose.onNodeWithText(Copy.resetFound(18).text()).assertExists()+ compose.onNodeWithText(Copy.RESET_BUTTON.text()).assertHasClickAction()}@Test fun reset_found_dark() = reset("a1_reset_found", true, ResetUi(plan = resetPlan))@Test fun reset_listOpened() {- reset("a2_reset_list", false, ResetUi(plan = resetPlan)) { compose.onNodeWithText(Copy.turnOnApps(14)).performClick(); compose.mainClock.advanceTimeBy(1_000) }+ reset("a2_reset_list", false, ResetUi(plan = resetPlan)) { compose.onNodeWithText(Copy.turnOnApps(14).text()).performClick(); compose.mainClock.advanceTimeBy(1_000) }// Seven of fourteen, then the rest behind Show all.compose.onNodeWithText("com.netflix.ninja").assertExists()compose.onNodeWithText("com.xgimi.ota").assertDoesNotExist()- compose.onNodeWithText(Copy.showAll(14)).assertExists()+ compose.onNodeWithText(Copy.showAll(14).text()).assertExists()}- @Test fun reset_listOpened_dark() = reset("a2_reset_list", true, ResetUi(plan = resetPlan)) { compose.onNodeWithText(Copy.turnOnApps(14)).performClick(); compose.mainClock.advanceTimeBy(1_000) }+ @Test fun reset_listOpened_dark() = reset("a2_reset_list", true, ResetUi(plan = resetPlan)) { compose.onNodeWithText(Copy.turnOnApps(14).text()).performClick(); compose.mainClock.advanceTimeBy(1_000) }@Test fun reset_nothing() {reset("a3_reset_nothing", false, ResetUi(plan = ResetPlan(shippedOff = 4, ownHome = "Google TV Home")))- compose.onNodeWithText(Copy.NOTHING_TO_RESET).assertExists()- compose.onNodeWithText(Copy.RESET_BUTTON).assertDoesNotExist()+ compose.onNodeWithText(Copy.NOTHING_TO_RESET.text()).assertExists()+ compose.onNodeWithText(Copy.RESET_BUTTON.text()).assertDoesNotExist()}@Test fun reset_nothing_dark() = reset("a3_reset_nothing", true, ResetUi(plan = ResetPlan(shippedOff = 4, ownHome = "Google TV Home")))private val running = ResetUi(plan = resetPlan, running = resetPlan, progress = ResetProgress(ResetPart.TurnOn, 6, 14))@Test fun reset_running() {reset("a4_reset_running", false, running)- compose.onNodeWithText(Copy.RESETTING).assertIsNotEnabled()+ compose.onNodeWithText(Copy.RESETTING.text()).assertIsNotEnabled()}@Test fun reset_running_dark() = reset("a4_reset_running", true, running)@Test fun reset_done() {reset("a5_reset_done", false, ResetUi(plan = resetPlan, ran = true))- compose.onNodeWithText(Copy.RESET_DONE).assertExists()+ compose.onNodeWithText(Copy.RESET_DONE.text()).assertExists()}@Test fun reset_done_dark() = reset("a5_reset_done", true, ResetUi(plan = resetPlan, ran = true))@Test fun reset_partlyDone() {reset("a6_reset_partly", false, ResetUi(plan = resetPlan, ran = true, failed = sportsFailed))- compose.onNodeWithText(Copy.turnedOn(13, 14)).assertExists()- compose.onNodeWithText(Copy.tryAgain("Sports")).assertHasClickAction()+ compose.onNodeWithText(Copy.turnedOn(13, 14).text()).assertExists()+ compose.onNodeWithText(Copy.tryAgain("Sports").text()).assertHasClickAction()}@Test fun reset_partlyDone_dark() = reset("a6_reset_partly", true, ResetUi(plan = resetPlan, ran = true, failed = sportsFailed))@@ -986,7 +987,7 @@ class ScreenshotTest {}@Test fun device_tweaksDns() = shot("16_device_tweaks_dns", screen = true, before = {- compose.onNodeWithText(Copy.DNS_TITLE).performClick()+ compose.onNodeWithText(Copy.DNS_TITLE.text()).performClick()Unit}) {Surface { Column(Modifier.padding(16.dp)) { TweaksBlock(DeviceUi(tweaks = TvTweaks(null, null)), DeviceActions()) } }@@ -995,7 +996,7 @@ class ScreenshotTest {@Config(qualifiers = "w411dp-h2600dp-xxhdpi")@Test fun device_tweaksInHistory() {val history = listOf(- HistoryEntry(3, xgimi.ip, now - 20_000, Action.ClearCaches, "", TvSettings.CACHES, null, null),+ HistoryEntry(3, xgimi.ip, now - 20_000, Action.ClearCaches, "", TvSettings.CACHES.text(), null, null),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")),)@@ -1107,20 +1108,20 @@ class ScreenshotTest {@Test fun screenOffSaysWhatATapDoes() {var off by mutableStateOf(false)compose.setContent { TellyscopeTheme(dynamic = false) { RemoteScreen(if (off) screenOffState() else remoteState(), RemoteActions()) } }- compose.onNodeWithContentDescription(Copy.MORE).performClick()- compose.onNodeWithText(Copy.SCREEN_OFF).assertExists()- compose.onNodeWithText(Copy.SCREEN_ON).assertDoesNotExist()+ compose.onNodeWithContentDescription(Copy.MORE.text()).performClick()+ compose.onNodeWithText(Copy.SCREEN_OFF.text()).assertExists()+ compose.onNodeWithText(Copy.SCREEN_ON.text()).assertDoesNotExist()off = true- compose.onNodeWithText(Copy.SCREEN_ON).assertExists()- compose.onNodeWithText(Copy.SCREEN_OFF_WAKE, substring = true).assertExists()+ compose.onNodeWithText(Copy.SCREEN_ON.text()).assertExists()+ compose.onNodeWithText(Copy.SCREEN_OFF_WAKE.text(), substring = true).assertExists()}@Test fun android14HasNoScreenOff() {val s = remoteState().let { st -> st.copy(devices = st.devices.map { if (it.id == st.selectedId) it.copy(android = "14") else it }) }compose.setContent { TellyscopeTheme(dynamic = false) { RemoteScreen(s, RemoteActions()) } }- compose.onNodeWithContentDescription(Copy.MORE).performClick()- compose.onNodeWithText(Copy.SCREEN_OFF).assertDoesNotExist()- compose.onNodeWithText(Copy.REMOTE_RESTART).assertExists()+ compose.onNodeWithContentDescription(Copy.MORE.text()).performClick()+ compose.onNodeWithText(Copy.SCREEN_OFF.text()).assertDoesNotExist()+ compose.onNodeWithText(Copy.REMOTE_RESTART.text()).assertExists()}/** The Remote never scrolls: on a short phone the D-pad shrinks and the buttons stay on screen, three of them. */@@ -1168,7 +1169,7 @@ class ScreenshotTest {val three = docked + Docked("org.jellyfin.androidtv", "Jellyfin")shot("12_remote_dock_full", screen = true) { RemoteScreen(remoteState(apps = three), RemoteActions()) }// A full row has no Remote buttons pill.- compose.onNodeWithText(Copy.REMOTE_BUTTONS).assertDoesNotExist()+ compose.onNodeWithText(Copy.REMOTE_BUTTONS.text()).assertDoesNotExist()}/**@@ -1205,14 +1206,14 @@ class ScreenshotTest {before = { compose.onNodeWithContentDescription("Netflix").performSemanticsAction(SemanticsActions.OnLongClick) },) { RemoteScreen(remoteState(), RemoteActions()) }- @Test fun remote_menu() = shot("12_remote_menu", screen = true, before = { compose.onNodeWithContentDescription(Copy.MORE).performClick() }) {+ @Test fun remote_menu() = shot("12_remote_menu", screen = true, before = { compose.onNodeWithContentDescription(Copy.MORE.text()).performClick() }) {RemoteScreen(remoteState(), RemoteActions())}@Test fun theEmptyPillOpensThePicker() {compose.setContent { TellyscopeTheme(dynamic = false) { RemoteScreen(remoteState(apps = emptyList()), RemoteActions()) } }- compose.onNodeWithText(Copy.REMOTE_BUTTONS).performClick()- compose.onNodeWithText(Copy.buttonsHint(3)).assertExists()+ compose.onNodeWithText(Copy.REMOTE_BUTTONS.text()).performClick()+ compose.onNodeWithText(Copy.buttonsHint(3).text()).assertExists()}@Test fun remote_restarting() = shot("13_remote_restarting", screen = true) {@@ -1359,7 +1360,7 @@ class ScreenshotTest {private val reportApp = AppFacts("0.8.0", "Pixel 8, Android 16")private fun reportUi(kind: ReportKind, details: String = "", log: String? = null) = runBlocking {- ReportUi(kind, reportApp, Reports.Connection.WIRELESS_DEBUGGING, tv = fake.facts(xgimi.ip), details = details, log = log)+ ReportUi(kind, reportApp, Reports.Connection.WIRELESS_DEBUGGING, tv = fake.facts(xgimi.ip), details = details, log = log?.let(UiText::Raw))}/** Opens the form's dropdown that still says "Choose one" and picks [option]. */@@ -1554,11 +1555,11 @@ class ScreenshotTest {@Test fun readme_tweaks() {val tweaks = TvTweaks(dnsHost = TvSettings.ADGUARD, animationScale = null)shot("29_readme_tweaks") { DeviceTabsScreen(deviceState { copy(tweaks = tweaks, apps = listOf(stockHome, playStore) + apps) }, DeviceActions(), startTab = TvTab.Tweaks) }- compose.onNodeWithText(Copy.GET_LAUNCHER_TEXT).assertExists()+ compose.onNodeWithText(Copy.GET_LAUNCHER_TEXT.text()).assertExists()}private val stockHome = AppInfo(- "com.google.android.tvlauncher", "Google TV Home", 0xFF1A73E8, true, true, "this is your home screen", "1.0.4",+ "com.google.android.tvlauncher", "Google TV Home", 0xFF1A73E8, true, true, UiText(R.string.data_protected_home_screen), "1.0.4",home = true, answersHome = true, builtInLauncher = true,)private val playStore = AppInfo("com.android.vending", "Google Play Store", 0xFF01875F, true, true, null, "40.1")@@ -1566,7 +1567,7 @@ class ScreenshotTest {/** Projectivy, installed by the user, as a launcher: [home] it's on Home, the stock launcher off; else it offers to replace it. */private fun projectivy(a: AppInfo, home: Boolean) = a.copy(- protectedReason = "this is your home screen".takeIf { home }, system = false, removable = true, answersHome = true, homeService = true,+ protectedReason = UiText(R.string.data_protected_home_screen).takeIf { home }, system = false, removable = true, answersHome = true, homeService = true,home = home, homeInstead = stockHome.packageName.takeUnless { home }, homeBack = stockHome.label.takeIf { home },)@@ -1579,12 +1580,12 @@ class ScreenshotTest {// Make Home on Projectivy: the confirm says the TV's own launcher is the only one turned off.@Test fun readme_home() {shot("30_readme_home", screen = true) { DeviceTabsScreen(homeState(home = false, pending = "com.spocky.projengmenu" to Action.Home), DeviceActions(), startTab = TvTab.Tweaks) }- compose.onNodeWithText(Copy.makeHomeTitle("Projectivy Launcher")).assertExists()+ compose.onNodeWithText(Copy.makeHomeTitle("Projectivy Launcher").text()).assertExists()}private fun homeCard(dark: Boolean) {shot("78_tweaks_home_card", dark) { DeviceTabsScreen(homeState(home = true), DeviceActions(), startTab = TvTab.Tweaks) }- compose.onNodeWithText(Copy.builtIn(off = true)).assertExists()+ compose.onNodeWithText(Copy.builtIn(off = true).text()).assertExists()}@Test fun tweaks_homeCard() = homeCard(false)@Test fun tweaks_homeCard_dark() = homeCard(true)@@ -1593,7 +1594,7 @@ class ScreenshotTest {@Test fun tweaks_homeCardNoDefault() {val state = homeState(home = false).let { s -> s.copy(device = s.device.copy(apps = s.device.apps.map { if (it.packageName == stockHome.packageName) it.copy(home = false) else it })) }shot("78_tweaks_home_card_no_default") { DeviceTabsScreen(state, DeviceActions(), startTab = TvTab.Tweaks) }- compose.onNodeWithText(Copy.NO_DEFAULT).assertExists()+ compose.onNodeWithText(Copy.NO_DEFAULT.text()).assertExists()}// Back to Google TV Home from Projectivy: turned back on, and Projectivy's service goes off with Home.@@ -1601,7 +1602,7 @@ class ScreenshotTest {shot("78_tweaks_home_back", dark, screen = true) {DeviceTabsScreen(homeState(home = true, pending = stockHome.packageName to Action.HomeBack), DeviceActions(), startTab = TvTab.Tweaks)}- compose.onNodeWithText(Copy.explainLeave("Google TV Home", off = true, "Projectivy Launcher", currentService = true, service = false)).assertExists()+ compose.onNodeWithText(Copy.explainLeave("Google TV Home", off = true, "Projectivy Launcher", currentService = true, service = false).text()).assertExists()}@Test fun tweaks_homeBack() = homeBack(false)@Test fun tweaks_homeBack_dark() = homeBack(true)@@ -1614,11 +1615,11 @@ class ScreenshotTest {compose.onNode(hasScrollAction()).performScrollToNode(hasText("Projectivy Launcher"))compose.onNodeWithText("Projectivy Launcher").performClick()compose.mainClock.advanceTimeBy(1_000)- compose.onNode(hasScrollAction()).performScrollToNode(hasText(Copy.HOME_SETTINGS))- compose.onNodeWithText(Copy.HOME_SETTINGS).performClick()+ compose.onNode(hasScrollAction()).performScrollToNode(hasText(Copy.HOME_SETTINGS.text()))+ compose.onNodeWithText(Copy.HOME_SETTINGS.text()).performClick()compose.mainClock.advanceTimeBy(1_000)// The Tweaks tab, on the card.- compose.onNodeWithText(Copy.opensOnHome("Projectivy Launcher")).assertExists()+ compose.onNodeWithText(Copy.opensOnHome("Projectivy Launcher").text()).assertExists()}// A keep from the TV's list only warns; a hard lock still offers nothing.@@ -1647,10 +1648,10 @@ class ScreenshotTest {val state = deviceState {copy(apps = apps.map { if (it.packageName == "com.xgimi.assistant") it.copy(listKeep = true) else it }, pending = "com.xgimi.assistant" to Action.Disable)}- shot("79_apps_keep_warning", before = { compose.onNode(hasScrollAction()).performScrollToNode(hasText(Copy.confirm(Action.Disable))); Unit }) {+ shot("79_apps_keep_warning", before = { compose.onNode(hasScrollAction()).performScrollToNode(hasText(Copy.confirm(Action.Disable).text())); Unit }) {DeviceTabsScreen(state, DeviceActions(), startTab = TvTab.Apps)}- compose.onNodeWithText(Copy.KEEP_WARNING, substring = true).assertExists()+ compose.onNodeWithText(Copy.KEEP_WARNING.text(), substring = true).assertExists()}@Test fun readme_send() = shot("25_readme_send", screen = true) {diff --git a/app/src/test/java/app/tellyscope/SnackbarsTest.kt b/app/src/test/java/app/tellyscope/SnackbarsTest.ktindex eb576f2..febfade 100644--- a/app/src/test/java/app/tellyscope/SnackbarsTest.kt+++ b/app/src/test/java/app/tellyscope/SnackbarsTest.kt@@ -10,6 +10,7 @@ import androidx.compose.ui.test.onNodeWithTextimport androidx.compose.ui.test.performClickimport app.tellyscope.data.Actionimport app.tellyscope.data.HistoryEntry+import app.tellyscope.data.UiTextimport app.tellyscope.ui.Copyimport app.tellyscope.ui.Doneimport kotlinx.coroutines.flow.MutableStateFlow@@ -26,7 +27,7 @@ class SnackbarsTest {@get:Rule val compose = createComposeRule()private val done = MutableStateFlow<Done?>(null)- private val notice = MutableStateFlow<String?>(null)+ private val notice = MutableStateFlow<UiText?>(null)private var undone: Done? = nullprivate fun show() {@@ -42,7 +43,7 @@ class SnackbarsTest {@Test fun noticeStaysOnScreen() {show()- notice.value = "Turned 2 apps back on."+ notice.value = UiText.plural(R.plurals.vm_turned_back_on, 2)compose.mainClock.advanceTimeBy(1_000)compose.onNodeWithText("Turned 2 apps back on.").assertExists()// Shown once: it was taken off the queue as it went up.@@ -54,8 +55,8 @@ class SnackbarsTest {val entry = HistoryEntry(7, "tv-a", 0L, Action.Disable, "com.example", "Example", Action.Enable, null)done.value = Done("tv-a", entry)compose.mainClock.advanceTimeBy(1_000)- compose.onNodeWithText(Copy.done(Action.Disable, "Example")).assertExists()- compose.onNodeWithText(Copy.undo(Action.Enable)).performClick()+ compose.onNodeWithText(Copy.done(Action.Disable, "Example").text()).assertExists()+ compose.onNodeWithText(Copy.undo(Action.Enable).text()).performClick()compose.mainClock.advanceTimeBy(1_000)assertEquals(Done("tv-a", entry), undone)}diff --git a/app/src/test/java/app/tellyscope/Strings.kt b/app/src/test/java/app/tellyscope/Strings.ktnew file mode 100644index 0000000..252f9cb--- /dev/null+++ b/app/src/test/java/app/tellyscope/Strings.kt@@ -0,0 +1,88 @@+// SPDX-License-Identifier: GPL-3.0-only++package app.tellyscope++import app.tellyscope.data.UiText+import java.io.File+import java.util.Locale+import javax.xml.parsers.DocumentBuilderFactory+import org.w3c.dom.Element++/**+ * The English text of `res/values/strings.xml` for plain JVM tests, so they can assert on what a+ * screen shows without Robolectric. [StringsTest] checks it reads every string the way Android does.+ */+object Strings {+ private val doc by lazy {+ DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(File("src/main/res/values/strings.xml")).documentElement+ }++ val strings: Map<String, String> by lazy {+ doc.elements("string").associate { it.getAttribute("name") to unescape(it.textContent) }+ }++ /** English plurals: `one` and `other`. */+ val plurals: Map<String, Map<String, String>> by lazy {+ doc.elements("plurals").associate { p ->+ p.getAttribute("name") to p.elements("item").associate { it.getAttribute("quantity") to unescape(it.textContent) }+ }+ }++ private val stringNames by lazy { R.string::class.java.fields.associate { it.getInt(null) to it.name } }+ private val pluralNames by lazy { R.plurals::class.java.fields.associate { it.getInt(null) to it.name } }++ fun string(id: Int, vararg args: Any): String {+ val raw = strings.getValue(stringNames.getValue(id))+ return if (args.isEmpty()) raw else raw.format(Locale.US, *args)+ }++ fun plural(id: Int, count: Int, vararg args: Any): String {+ val forms = plurals.getValue(pluralNames.getValue(id))+ return forms.getValue(if (count == 1 && "one" in forms) "one" else "other").format(Locale.US, *args)+ }++ /** Android's reading of a resource's text: collapsed whitespace outside "quotes", backslash escapes. */+ fun unescape(s: String): String {+ val out = StringBuilder()+ var quoted = false+ var space = false+ var i = 0+ while (i < s.length) {+ val c = s[i]+ when {+ c == '\\' && i + 1 < s.length -> {+ if (space) out.append(' ').also { space = false }+ i+++ when (val e = s[i]) {+ 'n' -> out.append('\n')+ 't' -> out.append('\t')+ 'u' -> out.append(s.substring(i + 1, i + 5).toInt(16).toChar()).also { i += 4 }+ else -> out.append(e)+ }+ }+ c == '"' -> quoted = !quoted+ !quoted && c.isWhitespace() -> space = out.isNotEmpty()+ else -> {+ if (space) out.append(' ').also { space = false }+ out.append(c)+ }+ }+ i+++ }+ return out.toString()+ }++ private fun Element.elements(tag: String): List<Element> {+ val nodes = getElementsByTagName(tag)+ return (0 until nodes.length).map { nodes.item(it) as Element }+ }+}++/** What [this] reads as in English. */+fun UiText.text(): String = when (this) {+ is UiText.Raw -> text+ is UiText.Res -> Strings.string(id, *args.map { if (it is UiText) it.text() else it }.toTypedArray())+ is UiText.Plural -> Strings.plural(id, count, *args.map { if (it is UiText) it.text() else it }.toTypedArray())+ is UiText.Join -> parts.joinToString(separator) { it.text() }+ is UiText.Capitalized -> text.text().replaceFirstChar(Char::uppercase)+}diff --git a/app/src/test/java/app/tellyscope/StringsTest.kt b/app/src/test/java/app/tellyscope/StringsTest.ktnew file mode 100644index 0000000..2308e7d--- /dev/null+++ b/app/src/test/java/app/tellyscope/StringsTest.kt@@ -0,0 +1,34 @@+// SPDX-License-Identifier: GPL-3.0-only++package app.tellyscope++import org.junit.Assert.assertEquals+import org.junit.Test+import org.junit.runner.RunWith+import org.robolectric.RobolectricTestRunner+import org.robolectric.RuntimeEnvironment+import org.robolectric.annotation.Config++/** [Strings], which the plain JVM tests read, agrees with Android on every string and plural. */+@RunWith(RobolectricTestRunner::class)+@Config(sdk = [35])+class StringsTest {+ private val res = RuntimeEnvironment.getApplication().resources++ @Test fun everyStringReadsAsAndroidReadsIt() {+ for (f in R.string::class.java.fields) {+ val name = f.name+ if (name !in Strings.strings) continue // from a library+ assertEquals(name, res.getText(f.getInt(null)).toString(), Strings.strings[name])+ }+ }++ @Test fun everyPluralReadsAsAndroidReadsIt() {+ for (f in R.plurals::class.java.fields) {+ val forms = Strings.plurals[f.name] ?: continue+ for ((quantity, n) in listOf("one" to 1, "other" to 2)) {+ forms[quantity]?.let { assertEquals("${f.name} $quantity", res.getQuantityText(f.getInt(null), n).toString(), it) }+ }+ }+ }+}diff --git a/app/src/test/java/app/tellyscope/TvAccessTest.kt b/app/src/test/java/app/tellyscope/TvAccessTest.ktindex 3d7de8b..a9abae3 100644--- a/app/src/test/java/app/tellyscope/TvAccessTest.kt+++ b/app/src/test/java/app/tellyscope/TvAccessTest.kt@@ -80,7 +80,7 @@ class TvAccessTest {val still = outcome(access(AdbClient(phone, 1), AdbClient(other, 2)))assertEquals(Removal.Step.StillConnected, still.step)assertEquals(Copy.connectionFrom(other), still.still)- assertEquals("alex@laptop", outcome(access(AdbClient(phone, 1), keys = listOf(phoneKey, laptop))).still)+ assertEquals("alex@laptop", outcome(access(AdbClient(phone, 1), keys = listOf(phoneKey, laptop))).still?.text())assertEquals(Removal.Step.Unconfirmed, outcome(null).step)assertEquals(Removal.Step.Unconfirmed, outcome(access(AdbClient(phone, 1), keys = null)).step)}diff --git a/app/src/test/java/app/tellyscope/UninstallHomeTest.kt b/app/src/test/java/app/tellyscope/UninstallHomeTest.ktindex a73b6a5..e4aa52b 100644--- a/app/src/test/java/app/tellyscope/UninstallHomeTest.kt+++ b/app/src/test/java/app/tellyscope/UninstallHomeTest.kt@@ -5,6 +5,8 @@ package app.tellyscopeimport app.tellyscope.data.Actionimport app.tellyscope.data.HistoryBookimport app.tellyscope.data.HistoryEntry+import app.tellyscope.data.UiText+import app.tellyscope.data.UiTextExceptionimport app.tellyscope.data.uninstallAfterHomeBackimport kotlinx.coroutines.test.runTestimport org.junit.Assert.assertEquals@@ -44,14 +46,14 @@ class UninstallHomeTest {@Test fun aSwitchThatFailsUninstallsNothingAndSaysSo() = runTest {val e = runCatching { uninstallAfterHomeBack({ throw IllegalStateException("the TV kept the home screen it has") }, ::uninstall) { dropped += it } }.exceptionOrNull()- assertEquals("Home didn't switch back: the TV kept the home screen it has. Nothing was uninstalled", e?.message)+ assertEquals("Home didn't switch back: the TV kept the home screen it has. Nothing was uninstalled", (e as UiTextException).text.text())assertTrue(steps.isEmpty() && dropped.isEmpty())}@Test fun aServiceStillOnUninstallsNothing() = runTest {val why = "switched back, but Projectivy Launcher's accessibility service is still on. Turn it off in the TV's Settings → Accessibility"- val e = runCatching { uninstallAfterHomeBack({ throw IllegalStateException(why) }, ::uninstall) { dropped += it } }.exceptionOrNull()- assertEquals("$why. Nothing was uninstalled", e?.message)+ val e = runCatching { uninstallAfterHomeBack({ throw UiTextException(UiText(R.string.data_service_not_off, "Projectivy Launcher")) }, ::uninstall) { dropped += it } }.exceptionOrNull()+ assertEquals("$why. Nothing was uninstalled", (e as UiTextException).text.text())assertTrue(steps.isEmpty() && dropped.isEmpty())}}diff --git a/app/src/test/java/app/tellyscope/UpdateCheckTest.kt b/app/src/test/java/app/tellyscope/UpdateCheckTest.ktindex bd5c272..3a6cfb9 100644--- a/app/src/test/java/app/tellyscope/UpdateCheckTest.kt+++ b/app/src/test/java/app/tellyscope/UpdateCheckTest.kt@@ -27,6 +27,8 @@ import java.io.IOExceptionclass UpdateCheckTest {@get:Rule val tmp = TemporaryFolder()+ private val MORE = Strings.string(R.string.update_more_notes)+private val minute = 60 * 1000Lprivate val hour = 60 * minuteprivate val day = 24 * hour@@ -172,7 +174,7 @@ class UpdateCheckTest {""".trimIndent()@Test fun `prod notes keep the changelog lines, plain, capped at twelve`() {- val lines = dialogNotes(prodBody).lines()+ val lines = dialogNotes(prodBody, MORE).lines()assertEquals(13, lines.size)assertEquals("- **New:** A new app icon: a telescope with a TV screen for a lens.", lines.first())assertEquals("…and more on GitHub", lines.last())@@ -182,18 +184,18 @@ class UpdateCheckTest {@Test fun `alpha notes are just the alpha line`() {assertEquals("Alpha build v0.2.0-alpha.1 from abdb1a8 on dev. Untested and may break; it installs as a separate app, app.tellyscope.alpha.",- dialogNotes(alphaBody),+ dialogNotes(alphaBody, MORE),)}@Test fun `short notes are not cut`() {- assertEquals("- **Fixed:** one thing.", dialogNotes("- **Fixed:** one thing. [#9](../../pull/9)\n\n### Commits since v1\n\n- x (abc)"))+ assertEquals("- **Fixed:** one thing.", dialogNotes("- **Fixed:** one thing. [#9](../../pull/9)\n\n### Commits since v1\n\n- x (abc)", MORE))}@Test fun `New is bold with the stars gone`() {- val first = boldSpans(dialogNotes(prodBody)).let { it.subSequence(0, it.text.indexOf('\n')) }+ val first = boldSpans(dialogNotes(prodBody, MORE)).let { it.subSequence(0, it.text.indexOf('\n')) }assertEquals("- New: A new app icon: a telescope with a TV screen for a lens.", first.text)- assertFalse('*' in boldSpans(dialogNotes(prodBody)).text)+ assertFalse('*' in boldSpans(dialogNotes(prodBody, MORE)).text)val bold = first.spanStyles.single()assertEquals(FontWeight.Bold, bold.item.fontWeight)assertEquals("New:", first.text.substring(bold.start, bold.end))