1.0 RC2: remote and screen-reader fixes found walking Settings, Create your own and every layout

On the emulator (Android TV 14, Silo test server, fictional media):
- Settings: one OK no longer also opens the first thing in the section; sections in
  the list open on OK or Right, not on landing, so a vanished button can't hand the
  remote to the list and switch section (Family, Create your own).
- Create your own: the remote waits inside the flow between steps; after Add or
  Skip it moves to the next row; Left and Right leave its text boxes (Suggest).
- Screen reader: every switch is read with its setting's or channel's name; the
  top bar's profile button says who's watching.
- Teletext layout: Back on its front page closes Orbit (it looped with the guide).
- Restore drill passed: backup to a test phone, change, restore, Undo offered.
- Version 1.0.0-rc2, build 44.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 16:02:09 +00:00
co-authored by Claude Opus 5.5
parent 9e75c9816f
commit 871bbbdd7a
5 changed files with 78 additions and 24 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ plugins {
id("org.jetbrains.kotlin.plugin.compose")
}
/** The release's build number: versionCode is this x 10 plus the edition's channel. */
val ORBIT_BUILD = 43
val ORBIT_BUILD = 44
android {
namespace = "tv.orbit.classic"
compileSdk = 36
@@ -11,7 +11,7 @@ android {
applicationId = "tv.orbit.classic"
minSdk = 26
targetSdk = 36
versionName = "1.0.0-rc1"
versionName = "1.0.0-rc2"
}
// Two editions of the same app (Paul, 10 November 2026): the household build, which updates itself between rooms, and the
// Play build, which only Google Play updates. Both are tv.orbit.classic, so a TV can move between them keeping its data.
@@ -8,6 +8,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.focusable
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
@@ -110,10 +111,15 @@ internal fun CreateChannelFlow(maker: ChannelMaker, editing: CustomChannel?, onD
var note by remember { mutableStateOf<String?>(null) }
LaunchedEffect(editing) { if (editing != null && chosenAtFirst.isEmpty()) chosen = maker.showsOf(editing.number) }
val first = remember { FocusRequester() }
LaunchedEffect(step) { runCatching { first.requestFocus() } }
BackHandler { if (step == CreateStep.Start || (editing != null && step == CreateStep.Name)) onDone(null) else step = CreateStep.entries[step.ordinal - 1] }
// Moving between steps, the remote waits on a holder inside the flow (1.0 RC2, emulator: in Settings, the focused card
// vanishing let Android hand the remote to the Settings list, which opened Watching and closed the flow).
val holder = remember { FocusRequester() }
fun go(to: CreateStep) { runCatching { holder.requestFocus() }; step = to }
LaunchedEffect(step) { repeat(20) { if (runCatching { first.requestFocus() }.getOrDefault(false)) return@LaunchedEffect; kotlinx.coroutines.delay(50) } }
BackHandler { if (step == CreateStep.Start || (editing != null && step == CreateStep.Name)) onDone(null) else go(CreateStep.entries[step.ordinal - 1]) }
if (number == null) { LaunchedEffect(Unit) { onDone("Every number from 701 to 799 is taken.") }; return }
Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Box(Modifier.size(1.dp).focusRequester(holder).focusable())
Row(verticalAlignment = Alignment.CenterVertically) {
Text(if (editing != null) "Edit ${editing.name}" else step.title, Modifier.weight(1f), color = Ink, fontFamily = Anton, fontSize = 24.sp)
if (step != CreateStep.Start) Text("Step ${step.ordinal} of 4", color = Muted, fontSize = 13.sp)
@@ -122,13 +128,13 @@ internal fun CreateChannelFlow(maker: ChannelMaker, editing: CustomChannel?, onD
when (step) {
CreateStep.Start -> Row(horizontalArrangement = Arrangement.spacedBy(14.dp)) {
ChoiceCard("On this TV", listOf("Name it and pick its number", "Add shows, or let the Director's Chair suggest them",
"Choose how it plays", "Choose when it's on"), Modifier.weight(1f).focusRequester(first)) { step = CreateStep.Name }
"Choose how it plays", "Choose when it's on"), Modifier.weight(1f).focusRequester(first)) { go(CreateStep.Name) }
if (phone) PhoneCard(Modifier.weight(1f)) else Spacer(Modifier.weight(1f))
}
CreateStep.Name -> {
Text("Your channel goes in Yours, as $number.", color = Muted, fontSize = 13.sp)
OrbitField(name, { if (it.length <= 40) name = it }, "Name, like 90s Sci-Fi", Modifier.fillMaxWidth().focusRequester(first))
OrbitButton("Next: shows and films", Modifier.width(220.dp), enabled = name.isNotBlank()) { step = CreateStep.Shows }
OrbitButton("Next: shows and films", Modifier.width(220.dp), enabled = name.isNotBlank()) { go(CreateStep.Shows) }
}
CreateStep.Shows -> Row(Modifier.weight(1f), horizontalArrangement = Arrangement.spacedBy(14.dp)) {
Column(Modifier.weight(1.7f), verticalArrangement = Arrangement.spacedBy(6.dp)) {
@@ -141,26 +147,40 @@ internal fun CreateChannelFlow(maker: ChannelMaker, editing: CustomChannel?, onD
}
}
Text("THE CHAIR SUGGESTS", color = Muted, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
// Adding or skipping takes the row away, so the remote moves to the next row's Add (or the box above when it
// was the last), waiting on the flow's holder meanwhile, never left to land in the Settings list (1.0 RC2).
val visible = offered.filter { o -> chosen.none { it.id == o.id } && o.id !in skipped }
val addFocus = remember { HashMap<String, FocusRequester>() }
var refocus by remember { mutableStateOf<String?>(null) }
fun leaving(id: String) {
val at = visible.indexOfFirst { it.id == id }
refocus = (visible.getOrNull(at + 1) ?: visible.getOrNull(at - 1))?.id ?: ""
runCatching { holder.requestFocus() }
}
LaunchedEffect(refocus) {
val target = refocus ?: return@LaunchedEffect
repeat(20) { if (runCatching { (if (target.isEmpty()) first else addFocus[target] ?: first).requestFocus() }.getOrDefault(false)) { refocus = null; return@LaunchedEffect }; kotlinx.coroutines.delay(50) }
}
LazyColumn(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(5.dp)) {
items(offered.filter { o -> chosen.none { it.id == o.id } && o.id !in skipped }, key = { it.id }) { s ->
items(visible, key = { it.id }) { s ->
Row(Modifier.fillMaxWidth().background(Panel, RoundedCornerShape(8.dp)).padding(horizontal = 10.dp, vertical = 6.dp), verticalAlignment = Alignment.CenterVertically) {
Column(Modifier.weight(1f)) {
Text(s.title, color = Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(listOfNotNull(if (s.type == "Movie") "Film" else "Series", s.year?.toString()).joinToString(" · "), color = Muted, fontSize = 11.sp)
}
Text(s.reason, Modifier.weight(1f).padding(horizontal = 8.dp), color = Ink, fontSize = 12.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
OrbitButton("Add") { chosen = chosen + s.copy(reason = "Chosen for your channel") }
OrbitButton("Add", Modifier.focusRequester(addFocus.getOrPut(s.id) { FocusRequester() })) { leaving(s.id); chosen = chosen + s.copy(reason = "Chosen for your channel") }
Spacer(Modifier.width(6.dp))
OrbitButton("Skip") { skipped = skipped + s.id }
OrbitButton("Skip") { leaving(s.id); skipped = skipped + s.id }
}
}
}
OrbitButton("Next: how it plays", Modifier.width(240.dp), enabled = chosen.isNotEmpty()) { step = CreateStep.Style }
OrbitButton("Next: how it plays", Modifier.width(240.dp), enabled = chosen.isNotEmpty()) { go(CreateStep.Style) }
}
Column(Modifier.weight(1f).fillMaxHeight().background(Deep, RoundedCornerShape(10.dp)).padding(12.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text("IN YOUR CHANNEL", color = Muted, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
if (chosen.isEmpty()) Text("Nothing yet: add shows or films on the left.", color = Muted, fontSize = 12.sp)
chosen.forEach { c -> Text("· ${c.title}", Modifier.clickable { chosen = chosen - c }, color = Ink, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) }
chosen.forEach { c -> Text("· ${c.title}", Modifier.clickable { runCatching { holder.requestFocus() }; chosen = chosen - c; scope.launch { kotlinx.coroutines.delay(100); runCatching { first.requestFocus() } } }, color = Ink, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) }
Spacer(Modifier.weight(1f))
Text("Add and skip both teach the Chair what this channel is for. OK on a title here takes it out.", color = Muted, fontSize = 11.sp)
}
@@ -172,7 +192,7 @@ internal fun CreateChannelFlow(maker: ChannelMaker, editing: CustomChannel?, onD
ChoiceCard(s.title, listOf(s.line), Modifier.weight(1f).then(if (i == 0) Modifier.focusRequester(first) else Modifier), selected = style == s) { style = s }
}
}
OrbitButton("Next: when it's on", Modifier.width(240.dp)) { step = CreateStep.Hours }
OrbitButton("Next: when it's on", Modifier.width(240.dp)) { go(CreateStep.Hours) }
}
CreateStep.Hours -> {
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
@@ -224,7 +244,7 @@ internal fun OrbitField(value: String, onChange: (String) -> Unit, hint: String,
val focus = androidx.compose.ui.platform.LocalFocusManager.current
Box(modifier.onFocusChanged { focused = it.isFocused }.background(Panel, RoundedCornerShape(8.dp)).border(2.dp, if (focused) Yellow else Blue, RoundedCornerShape(8.dp)).padding(10.dp)) {
if (value.isEmpty()) Text(hint, color = Muted, fontSize = 15.sp)
BasicTextField(value, { onChange(it.replace("\n", "")) }, Modifier.fillMaxWidth().onPreviewKeyEvent { event -> textFieldKeys(event.nativeKeyEvent, keyboard, focus) }, singleLine = true, textStyle = TextStyle(color = Ink, fontSize = 15.sp),
BasicTextField(value, { onChange(it.replace("\n", "")) }, Modifier.fillMaxWidth().onPreviewKeyEvent { event -> textFieldKeys(event.nativeKeyEvent, keyboard, focus, sideways = true) }, singleLine = true, textStyle = TextStyle(color = Ink, fontSize = 15.sp),
cursorBrush = SolidColor(Yellow), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done))
}
}
@@ -119,6 +119,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
/** Another part of Orbit by its name in the top bar ("TV Guide", "Catch Up", "Drive-In", "Connect Emby"), for the layouts' Home. */
onSection: (String) -> Unit = {}) {
val appContext = androidx.compose.ui.platform.LocalContext.current.applicationContext
val hostActivity = androidx.compose.ui.platform.LocalContext.current as? android.app.Activity
// Everything below belongs to the server signed in to ([ServerWorkspace]): another server's sign-in, catalogue and
// schedules are never open at the same time, and work begun for one keeps writing only to its own.
val workspace = Workspaces.current(appContext)
@@ -868,7 +869,9 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
when {
mainHome && OrbitLayouts.current == OrbitLayout.Teletext -> OrbiFaxScreen({ shows, pause -> orbiFaxData(availableChannels, scheduledChannels.mapValues { it.value.plan }, driveInPlan,
{ session?.let { scheduleStore.loadArrivals(it.accountId).first }.orEmpty() }, orbiFaxRecords(OrbitSettings(appContext)), Profiles.current, System.currentTimeMillis(), shows = shows, pause = pause) },
onClose = onGuide)
// As Teletext's home, Back at the front page closes Orbit as every other home does (1.0 RC2: it went to the guide,
// whose Back came straight back here, so Orbit could never be left with Back).
onClose = { hostActivity?.finish() })
mainHome && OrbitLayouts.current != OrbitLayout.Original -> LayoutHomeScreen(OrbitLayouts.current, LayoutHome(liveSession,
availableChannels.filter { !lockedOut(it.number) && !profileHides(it.number) }, liveChannel,
picture = { m -> Box(m) { GuidePicture(liveSession, liveChannel, live = !watchingChannel, handoff = liveHandoff, onUnplayable = ::rememberUnplayable) } },
@@ -1114,7 +1117,12 @@ private fun SignInForm(modifier: Modifier, serverText: String, onServer: (String
*/
internal fun textFieldKeys(e: KeyEvent, keyboard: androidx.compose.ui.platform.SoftwareKeyboardController?, focus: androidx.compose.ui.focus.FocusManager,
/** The box below, when it's Android's own (the password): moving by direction doesn't reach into one. */
below: FocusRequester? = null): Boolean = when (e.keyCode) {
below: FocusRequester? = null,
/** Left and Right move to the box or button beside it too (1.0 RC2: Create your own's search box sits beside Suggest, which
* the remote couldn't reach). The keyboard on screen has its own arrows for moving within the words. */
sideways: Boolean = false): Boolean = when (e.keyCode) {
KeyEvent.KEYCODE_DPAD_RIGHT, KeyEvent.KEYCODE_DPAD_LEFT -> if (!sideways) false else {
if (e.action == KeyEvent.ACTION_DOWN) focus.moveFocus(if (e.keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) androidx.compose.ui.focus.FocusDirection.Right else androidx.compose.ui.focus.FocusDirection.Left); true }
KeyEvent.KEYCODE_DPAD_CENTER -> { if (e.action == KeyEvent.ACTION_UP) keyboard?.show(); true }
KeyEvent.KEYCODE_DPAD_DOWN -> { if (e.action == KeyEvent.ACTION_DOWN) { if (below == null || !runCatching { below.requestFocus() }.getOrDefault(false)) focus.moveFocus(androidx.compose.ui.focus.FocusDirection.Down) }; true }
KeyEvent.KEYCODE_DPAD_UP -> { if (e.action == KeyEvent.ACTION_DOWN) focus.moveFocus(androidx.compose.ui.focus.FocusDirection.Up); true }
@@ -15,6 +15,8 @@ import androidx.compose.foundation.layout.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.foundation.focusGroup
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusProperties
@@ -258,7 +260,9 @@ private fun OrbitApp() {
Spacer(Modifier.weight(1f))
TopBarClock()
// Who's watching, as a little picture: OK goes back to Who's watching? to switch.
if (realChannelAvailable && profile != null) HomeCard(Modifier.size(38.dp, 32.dp).focusProperties { if (section == "Drive-In") down = driveInFocus }, onClick = { WatchCheck.askFromInside() }) { focused ->
if (realChannelAvailable && profile != null) HomeCard(Modifier.size(38.dp, 32.dp).focusProperties { if (section == "Drive-In") down = driveInFocus }
// Read out by a screen reader (1.0 RC2: it had no words).
.semantics { contentDescription = "Who's watching: ${profile.name}" }, onClick = { WatchCheck.askFromInside() }) { focused ->
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { ProfileAvatar(profile.picture, 28.dp, ringed = false) }
}
if (realChannelAvailable && !Profiles.kids) HomeCard(Modifier.size(38.dp, 32.dp).focusProperties { if (section == "Drive-In") down = driveInFocus }, onClick = { section = "Connect Emby" }) { focused ->
@@ -7,6 +7,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.semantics.role
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
@@ -183,14 +184,18 @@ internal fun channelBlock(number: Int) = when (number / 100) {
internal val RailCorner = RoundedCornerShape(6.dp)
/** Moving onto a section shows it straight away, and right steps across into it. */
/**
* A section in the list. OK or Right opens it (1.0 RC2): it no longer opens just by being landed on, because whenever the
* focused thing in a section vanished (a card opening a page), Android handed the remote to this list, and landing on a
* section opened it, closing whatever was open (found on the emulator in Family and Create your own).
*/
@Composable
private fun RailItem(section: SettingsSection, selected: Boolean, modifier: Modifier, onRight: () -> Unit, onSelect: () -> Unit) {
var focused by remember { mutableStateOf(false) }
Row(modifier.fillMaxWidth().height(58.dp).onPreviewKeyEvent { event ->
// Straight to the section's first switch. Left alone, right could land on the top bar instead.
if (event.key == Key.DirectionRight) { if (event.type == KeyEventType.KeyDown) onRight(); true } else false
}.onFocusChanged { focused = it.isFocused; if (it.isFocused) onSelect() }.clip(RailCorner)
// Into the section, at its first switch. Left alone, right could land on the top bar instead.
if (event.key == Key.DirectionRight) { if (event.type == KeyEventType.KeyDown) { if (!selected) onSelect(); onRight() }; true } else false
}.onFocusChanged { focused = it.isFocused }.clip(RailCorner)
.background(if (focused) Yellow else if (selected) Blue else Panel).clickable(onClick = onSelect).padding(horizontal = 10.dp),
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Image(cachedPainter(section.icon), null, Modifier.size(26.dp), colorFilter = ColorFilter.tint(if (focused) OnAccent else Ink))
@@ -201,9 +206,18 @@ private fun RailItem(section: SettingsSection, selected: Boolean, modifier: Modi
}
}
/**
* The words a switch is read out with by a screen reader (1.0 RC2: switches were announced as just "On" or "Off", with no
* name). A setting's line and a channel's row provide their title; [OnOff] uses it as its label.
*/
internal val LocalSwitchLabel = androidx.compose.runtime.compositionLocalOf<String?> { null }
/** One thing you can do, and in plain words what it's for. */
@Composable
internal fun SettingLine(title: String, detail: String, button: @Composable () -> Unit) {
internal fun SettingLine(title: String, detail: String, button: @Composable () -> Unit) = CompositionLocalProvider(LocalSwitchLabel provides title) { SettingLineBody(title, detail, button) }
@Composable
private fun SettingLineBody(title: String, detail: String, button: @Composable () -> Unit) {
Row(Modifier.fillMaxWidth().clip(RailCorner).background(Panel).padding(horizontal = 12.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Column(Modifier.weight(1f)) {
Text(title, color = Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
@@ -222,6 +236,7 @@ internal fun SettingLine(title: String, detail: String, button: @Composable () -
@Composable
internal fun OnOff(on: Boolean, modifier: Modifier = Modifier, enabled: Boolean = true, onClick: () -> Unit) {
var focused by remember { mutableStateOf(false) }
val label = LocalSwitchLabel.current
val target = if (on) themed(Color(0xFF6EDCAA)) { Mint } else themed(Color(0xFF283C64)) { Blue }
val calm = Motion.reduce
val track by androidx.compose.animation.animateColorAsState(target,
@@ -234,7 +249,7 @@ internal fun OnOff(on: Boolean, modifier: Modifier = Modifier, enabled: Boolean
Text(if (on) "On" else "Off", color = (if (on) Ink else Muted).copy(alpha = if (enabled) 1f else .5f), fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
Box(modifier.onFocusChanged { focused = it.isFocused }.size(50.dp, 28.dp).border(if (focused) 3.dp else 0.dp, if (focused) Yellow else Color.Transparent, RoundedCornerShape(14.dp))
.padding(3.dp).clip(RoundedCornerShape(11.dp)).background(track.copy(alpha = if (enabled) 1f else .5f)).clickable(enabled = enabled, onClick = onClick)
.semantics { stateDescription = if (on) "On" else "Off" }, contentAlignment = Alignment.CenterStart) {
.semantics { stateDescription = if (on) "On" else "Off"; role = androidx.compose.ui.semantics.Role.Switch; label?.let { contentDescription = it } }, contentAlignment = Alignment.CenterStart) {
// 44 dp inside, 3 dp either side, a 16 dp thumb: 22 dp of travel.
Box(Modifier.offset(x = 22.dp * along).padding(horizontal = 3.dp).size(16.dp).clip(androidx.compose.foundation.shape.CircleShape).background(Color.White))
}
@@ -280,7 +295,9 @@ private fun ChannelsDetail(busy: Boolean, message: String?, isOn: (Int) -> Boole
Text(brand?.displayName ?: programming.name, Modifier.weight(1f), color = Ink, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
if (programming.suggestionRules.isNotEmpty()) OrbitButton("Titles", enabled = !busy, onClick = { onSuggestions(programming) })
CustomChannels.of(programming.number)?.let { yours -> OrbitButton("Edit", enabled = !busy, onClick = { onEdit(yours) }) }
OnOff(on, Modifier.then(if (programming == all.first()) Modifier.focusRequester(firstSwitch) else Modifier), enabled = !busy, onClick = { onSwitch(programming, !on) })
CompositionLocalProvider(LocalSwitchLabel provides "${programming.number} ${brand?.displayName ?: programming.name}") {
OnOff(on, Modifier.then(if (programming == all.first()) Modifier.focusRequester(firstSwitch) else Modifier), enabled = !busy, onClick = { onSwitch(programming, !on) })
}
}
}
}
@@ -551,6 +568,9 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio
// Into a section: onto its first item once it's drawn, else its name in the list.
LaunchedEffect(home) {
if (home) return@LaunchedEffect
// After the OK that opened the section has been let go (1.0 RC2, emulator: the same press also opened Create your own,
// the first item it landed on).
kotlinx.coroutines.delay(250)
repeat(30) { if (runCatching { firstSwitch.requestFocus() }.getOrDefault(false)) return@LaunchedEffect; kotlinx.coroutines.delay(50) }
runCatching { firstFocus.requestFocus() }
}
@@ -567,7 +587,9 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio
SettingsSection.entries.forEach { item ->
RailItem(item, item == section, if (item == section) Modifier.focusRequester(firstFocus) else Modifier, onRight = {
// The channel list may have been scrolled, taking its first switch off the screen.
scope.launch { if (item == SettingsSection.Channels) channelList.scrollToItem(0); runCatching { firstSwitch.requestFocus() } }
// A section just opened draws a moment later, so its first switch is tried for a little while.
scope.launch { if (item == SettingsSection.Channels) runCatching { channelList.scrollToItem(0) }
repeat(20) { if (runCatching { firstSwitch.requestFocus() }.getOrDefault(false)) return@launch; kotlinx.coroutines.delay(50) } }
}) { onSection(item) }
}
}