Settings for everyone: six plain choices, Watching styles, Comfort and accessibility
From Paul's approved design (design/settings) and his three refinements: - Settings opens on Watching, Channels, Family, Other TVs and phones, Help and account, and Back to TV; Back from a section returns there. - Watching: everyday choices first; between programmes as Full TV feel, A little or Just the programmes, each explained, Custom once a switch is set by hand; every switch under Choose each one, grouped. - Comfort and accessibility: reduce motion, soft sounds, quiet nights, Wind Down. - Other TVs and phones as one list; backups and the technical bits in Help and account. - Switches say On or Off; long pages scroll to their foot on Down at the last item. - Old section names in on-screen text updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -230,6 +230,6 @@ internal fun LockDetail(firstSwitch: FocusRequester, modifier: Modifier) {
|
||||
else { step = LockStep.NewPin; note = "Those didn't match. Choose it again." }
|
||||
}, onCancel = { step = LockStep.None }) }
|
||||
}
|
||||
Text("Forgotten the PIN? Signing out in Settings › Account clears it, along with this box's schedules.", color = Muted, fontSize = 11.sp)
|
||||
Text("Forgotten the PIN? Signing out in Settings › Help and account clears it, along with this box's schedules.", color = Muted, fontSize = 11.sp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -999,7 +999,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
else -> "${idea.theme} dismissed: it won't be proposed again unless its films change." }
|
||||
} }) }, isOn = { scheduledChannels.containsKey(it) }, onSwitch = { programming, on -> setSmartSchedule(programming, on) }, onSuggestions = { openSuggestions(it) },
|
||||
onSignOut = { job?.cancel(); closeSession(signOut = true) }, onRemoveServer = { job?.cancel(); closeSession(remove = true) },
|
||||
maker = channelMaker,
|
||||
maker = channelMaker, onBackToTv = { onSection("Home") },
|
||||
windingDown = windingDown, onWindDown = { on ->
|
||||
val tots = scheduledChannels[TOTS_NUMBER]
|
||||
val active = session
|
||||
|
||||
@@ -175,7 +175,7 @@ private fun LookStep(onNext: () -> Unit) {
|
||||
LaunchedEffect(Unit) { first.requestFocus() }
|
||||
Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.CenterVertically)) {
|
||||
Text("Choose your look", color = Ink, fontFamily = Anton, fontSize = 32.sp)
|
||||
Text(if (Onboarding.tour) "Try one: it goes back to yours when the tour ends." else "It changes straight away. You can change it any time in Settings › On screen.", color = Muted, fontSize = 15.sp)
|
||||
Text(if (Onboarding.tour) "Try one: it goes back to yours when the tour ends." else "It changes straight away. You can change it any time in Settings › Watching.", color = Muted, fontSize = 15.sp)
|
||||
LookPicker(first, cardWidth = 160.dp)
|
||||
OrbitButton("Next", Modifier.padding(top = 6.dp).width(200.dp), centred = true, onClick = onNext)
|
||||
}
|
||||
@@ -411,7 +411,7 @@ private fun AllSetStep(onStart: () -> Unit) {
|
||||
Text(if (count > 0) "$count channels are planning their first week. The Drive-In opens on Friday." else "Your channels are ready.", color = Muted, fontSize = 16.sp)
|
||||
// Orbit Companion (Paul, 6 November 2026): mentioned once more at the end, and where to find it later.
|
||||
Text(if (PhoneLink.phones.isNotEmpty()) "Your phone is connected: open it any time as a remote for this TV."
|
||||
else "Use your phone as a remote too: Settings › Rooms and phones › Connect a phone, any time.", color = Muted, fontSize = 14.sp)
|
||||
else "Use your phone as a remote too: Settings › Other TVs and phones › Connect a phone, any time.", color = Muted, fontSize = 14.sp)
|
||||
OrbitButton("Start watching", Modifier.width(240.dp).focusRequester(go), centred = true, onClick = onStart)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ internal fun PhoneBackupOverlay() {
|
||||
}
|
||||
s.notes.forEach { Text(it, color = Yellow, fontSize = 13.sp) }
|
||||
Text("Restoring replaces what's on this TV now with the backup's. Your sign-in, the Adult PIN, joined phones, room links and this TV's sound and player settings stay as they are. " +
|
||||
"This TV's data is kept aside first: Settings › Rooms and phones › Undo the restore puts it back. Orbit restarts to finish.", color = Muted, fontSize = 12.sp)
|
||||
"This TV's data is kept aside first: Settings › Help and account › Undo the restore puts it back. Orbit restarts to finish.", color = Muted, fontSize = 12.sp)
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
OrbitButton(if (PhoneBackups.busy) "Keeping this TV's data aside…" else "Restore and restart", Modifier.focusRequester(first)) {
|
||||
if (PhoneBackups.busy) return@OrbitButton
|
||||
@@ -298,8 +298,8 @@ internal fun PhoneBackupOverlay() {
|
||||
is PhoneBackups.Done -> {
|
||||
val o = s.outcome; val undo = o.optString("kind") == "undo"
|
||||
Text(if (o.optBoolean("ok")) (if (undo) "Undone" else "Restored") else "That didn't finish", color = Ink, fontFamily = Anton, fontSize = 26.sp)
|
||||
Text(if (o.optBoolean("ok")) (if (undo) "This TV's data is back as it was. To go back to the backup's, use Settings › Rooms and phones again."
|
||||
else "The backup from ${PhoneBackups.day(o.optLong("made"))} is in place. What was here before is kept aside: Settings › Rooms and phones › Undo the restore.")
|
||||
Text(if (o.optBoolean("ok")) (if (undo) "This TV's data is back as it was. To go back to the backup's, use Settings › Help and account again."
|
||||
else "The backup from ${PhoneBackups.day(o.optLong("made"))} is in place. What was here before is kept aside: Settings › Help and account › Undo the restore.")
|
||||
else (o.optString("message") + if (o.optBoolean("putBack")) " This TV's data was put back as it was." else " Some of this TV's data may not have been put back."),
|
||||
color = if (o.optBoolean("ok")) Mint else Yellow, fontSize = 15.sp)
|
||||
OrbitButton("OK", Modifier.width(160.dp).focusRequester(first), centred = true) { PhoneBackups.screen = null }
|
||||
|
||||
@@ -12,7 +12,7 @@ background:#ffde59;color:#071632;font-size:18px;font-weight:700}.note{color:#ffd
|
||||
private const val REJOIN = """<script>(function(){try{var t=localStorage.getItem('orbit.phone');if(!t||sessionStorage.getItem('orbit.rejoin'))return;sessionStorage.setItem('orbit.rejoin','1');
|
||||
fetch('/rejoin',{method:'POST',headers:{'X-Orbit':'1','Content-Type':'text/plain'},body:t}).then(function(r){if(r.ok)location.reload();else localStorage.removeItem('orbit.phone');});}catch(e){}})();</script>"""
|
||||
fun join(note: String?) = """<!doctype html><html><head><title>Orbit</title>$STYLE</head><body><main><h1>Orbit</h1>
|
||||
<p>Enter the code shown on the TV in Settings › Rooms and phones › Connect a phone.</p>${note?.let { "<p class='note'>${esc(it)}</p>" }.orEmpty()}
|
||||
<p>Enter the code shown on the TV in Settings › Other TVs and phones › Connect a phone.</p>${note?.let { "<p class='note'>${esc(it)}</p>" }.orEmpty()}
|
||||
<form method="post" action="/join"><input name="code" inputmode="numeric" maxlength="4" autocomplete="one-time-code" autofocus><button>Join</button></form></main>$REJOIN</body></html>"""
|
||||
fun pin(k: String?, code: String?, wrong: Boolean) = """<!doctype html><html><head><title>Orbit</title>$STYLE</head><body><main><h1>Adult PIN</h1>
|
||||
<p>The code worked. Joining a phone is for adults, so now enter your <b>Adult PIN</b>: the four digits that unlock After Dark on the TV.</p>
|
||||
|
||||
@@ -63,7 +63,7 @@ internal object RoomCrypto {
|
||||
internal enum class RoomPart(val title: String, val line: String) {
|
||||
Channels("Channels and your own channels", "Which channels are on, the channels you've made, and the titles chosen for them"),
|
||||
Family("Profiles, Kids and the Adult PIN", "Everyone's profile, what Orbit has learnt for each, and their Continue watching. The PIN comes across scrambled, never as its digits"),
|
||||
Look("Look and On screen settings", "The look, subtitles, the cast, motion and the rest"),
|
||||
Look("Look and Watching settings", "The look, subtitles, the cast, motion and the rest"),
|
||||
Director("Director's Chair decisions", "What you placed, dropped and taught it"),
|
||||
Arcade("Arcade bests", "High scores and games won")
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ internal fun JoinRoomFlow(onJoined: () -> Unit, onBack: () -> Unit,
|
||||
OrbitButton("Next", Modifier.width(200.dp), centred = true) { phase = JoinPhase.Name }
|
||||
}
|
||||
JoinPhase.Name -> {
|
||||
Text("It shows in Settings › Rooms and phones.", color = Muted, fontSize = 14.sp)
|
||||
Text("It shows in Settings › Other TVs and phones.", color = Muted, fontSize = 14.sp)
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
listOf("Bedroom", "Kids' room", "Kitchen", "Den").forEachIndexed { i, n ->
|
||||
OrbitButton(n, Modifier.width(150.dp).then(if (i == 0) Modifier.focusRequester(first) else Modifier), selected = name == n, centred = true) { name = n }
|
||||
|
||||
@@ -162,11 +162,12 @@ internal class OrbitSettings(context: Context) {
|
||||
* other rooms, with Multiroom) have their own section.
|
||||
*/
|
||||
internal enum class SettingsSection(val label: String, val line: String, val icon: Int) {
|
||||
Channels("Channels", "Turn on, make your own, suggestions", R.drawable.orbit_icon_all),
|
||||
OnScreen("On screen", "Look, subtitles, the cast, motion", R.drawable.orbit_icon_entertainment),
|
||||
Family("Family", "Profiles, PIN, Kids, Wind Down", R.drawable.orbit_icon_family),
|
||||
Rooms("Rooms and phones", "Other TVs and paired phones", R.drawable.orbit_icon_rooms),
|
||||
Account("Account", "Server, sign-in, version", R.drawable.orbit_icon_account),
|
||||
// Settings for everyone (Paul, 12 November 2026, design/settings): plain names, and what each is for in a line.
|
||||
OnScreen("Watching", "Subtitles, sound and how Orbit looks", R.drawable.orbit_icon_entertainment),
|
||||
Channels("Channels", "Which channels are on, and your own", R.drawable.orbit_icon_all),
|
||||
Family("Family", "Who's watching, the PIN, and kids", R.drawable.orbit_icon_family),
|
||||
Rooms("Other TVs and phones", "Your other TVs, and your phone as a remote", R.drawable.orbit_icon_rooms),
|
||||
Account("Help and account", "Your server, signing out, and help", R.drawable.orbit_icon_account),
|
||||
}
|
||||
|
||||
/** The heading a channel number sits under, matching the blocks in the guide. */
|
||||
@@ -180,7 +181,7 @@ internal fun channelBlock(number: Int) = when (number / 100) {
|
||||
else -> "Other"
|
||||
}
|
||||
|
||||
private val RailCorner = RoundedCornerShape(6.dp)
|
||||
internal val RailCorner = RoundedCornerShape(6.dp)
|
||||
|
||||
/** Moving onto a section shows it straight away, and right steps across into it. */
|
||||
@Composable
|
||||
@@ -202,7 +203,7 @@ private fun RailItem(section: SettingsSection, selected: Boolean, modifier: Modi
|
||||
|
||||
/** One thing you can do, and in plain words what it's for. */
|
||||
@Composable
|
||||
private fun SettingLine(title: String, detail: String, button: @Composable () -> Unit) {
|
||||
internal fun SettingLine(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)
|
||||
@@ -227,13 +228,17 @@ internal fun OnOff(on: Boolean, modifier: Modifier = Modifier, enabled: Boolean
|
||||
androidx.compose.animation.core.tween(if (calm) Motion.CALM else SWITCH_MS, easing = Motion.Ease), label = "switch track")
|
||||
val along by androidx.compose.animation.core.animateFloatAsState(if (on) 1f else 0f,
|
||||
if (calm) androidx.compose.animation.core.snap() else androidx.compose.animation.core.tween(SWITCH_MS, easing = Motion.Ease), label = "switch thumb")
|
||||
// Smaller than before (Paul, 12 November 2026: the switches looked big on the TV), with the same yellow focus ring.
|
||||
// Smaller than before (Paul, 12 November 2026: the switches looked big on the TV), with the same yellow focus ring, and
|
||||
// the word On or Off beside it, so the state never rests on colour alone (design/settings).
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
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) {
|
||||
// 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))
|
||||
}
|
||||
}
|
||||
}
|
||||
/** How long the switch takes to slide, as in the EffectCraft design. */
|
||||
internal const val SWITCH_MS = 160
|
||||
@@ -283,96 +288,6 @@ private fun ChannelsDetail(busy: Boolean, message: String?, isOn: (Int) -> Boole
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ViewingDetail(firstSwitch: FocusRequester, modifier: Modifier, top: @Composable () -> Unit = {}) {
|
||||
val context = LocalContext.current
|
||||
val settings = remember { OrbitSettings(context) }
|
||||
var channelLogo by remember { mutableStateOf(settings.channelLogo) }
|
||||
var idents by remember { mutableStateOf(settings.idents) }
|
||||
var identSound by remember { mutableStateOf(settings.identSound) }
|
||||
var identSoundQuiet by remember { mutableStateOf(settings.identSoundQuiet) }
|
||||
var identSoundNightQuiet by remember { mutableStateOf(settings.identSoundNightQuiet) }
|
||||
var upNext by remember { mutableStateOf(settings.upNext) }
|
||||
var driveInIntro by remember { mutableStateOf(settings.driveInIntro) }
|
||||
var reduceMotion by remember { mutableStateOf(settings.reduceMotion) }
|
||||
var squeezeBack by remember { mutableStateOf(settings.squeezeBack) }
|
||||
var castOn by remember { mutableStateOf(settings.castOn) }
|
||||
var cameos by remember { mutableStateOf(settings.characterCameos) }
|
||||
var miniShorts by remember { mutableStateOf(settings.miniShorts) }
|
||||
var specialIdents by remember { mutableStateOf(settings.specialIdents) }
|
||||
var blockIdentSound by remember { mutableStateOf(settings.blockIdentSound) }
|
||||
Column(modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
top()
|
||||
Heading("Watching")
|
||||
// Off, On or Automatic (0.129): each says what it does; the choice applies from the next programme.
|
||||
SettingLine("Subtitles: ${Subtitles.mode.title}", Subtitles.mode.line + " Press right while watching to change them for one programme.") {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
SubtitleMode.entries.forEach { m -> OrbitButton(m.title, selected = Subtitles.mode == m, onClick = { Subtitles.set(settings, m) }) }
|
||||
}
|
||||
}
|
||||
SettingLine("Channel logo", "Show the channel's small logo in the corner during programmes.") {
|
||||
OnOff(channelLogo, Modifier, onClick = { channelLogo = !channelLogo; settings.channelLogo = channelLogo })
|
||||
}
|
||||
Heading("Orbit between programmes")
|
||||
SettingLine("Idents", "Play each channel's ident between programmes. When off, Tots shows a still picture instead.") {
|
||||
OnOff(idents, Modifier, onClick = { idents = !idents; settings.idents = idents })
|
||||
}
|
||||
SettingLine("Ident sound", "Each channel's ident plays its own short sound, at most every 20 minutes a channel; Tots plays its jingle.") {
|
||||
OnOff(identSound, Modifier, onClick = { identSound = !identSound; settings.identSound = identSound })
|
||||
}
|
||||
SettingLine("Quiet ident sound", "Play the ident sounds softly, well under the programmes. Reduce motion shows idents as a still card, with no sound.") {
|
||||
OnOff(identSoundQuiet, Modifier, enabled = identSound, onClick = { identSoundQuiet = !identSoundQuiet; settings.identSoundQuiet = identSoundQuiet })
|
||||
}
|
||||
SettingLine("Quieter late at night", "From 11pm to 7am, ident sounds play softly on their own, so nobody's woken.") {
|
||||
OnOff(identSoundNightQuiet, Modifier, enabled = identSound && !identSoundQuiet, onClick = { identSoundNightQuiet = !identSoundNightQuiet; settings.identSoundNightQuiet = identSoundNightQuiet })
|
||||
}
|
||||
SettingLine("Coming up next", "Near the end of a programme, a small card in the corner says what's on next.") {
|
||||
OnOff(upNext, Modifier, onClick = { upNext = !upNext; settings.upNext = upNext })
|
||||
}
|
||||
SettingLine("Special idents", "Give named blocks and events their own ident as they begin, such as Riot Laughs or PPV Sunday. Off uses each channel's usual ident.") {
|
||||
OnOff(specialIdents, Modifier, onClick = { specialIdents = !specialIdents; settings.specialIdents = specialIdents })
|
||||
}
|
||||
SettingLine("Special ident sound", "Play the short sound with each special ident. Off keeps them silent.") {
|
||||
OnOff(blockIdentSound, Modifier, onClick = { blockIdentSound = !blockIdentSound; settings.blockIdentSound = blockIdentSound })
|
||||
}
|
||||
// Credits for the sounds Paul chose (8 November 2026): royalty-free effects, named with thanks (design/channels/sound/samples).
|
||||
Text("Sound credits: VHS, Horror, After Dark, Vortex, Heroes, Riot, Paradox and Ring X use royalty-free effects from Pixabay by " +
|
||||
"freesound_community, jusatti890, tomas_herudek, audiopapkin, vishiv and other Pixabay creators, mastered for Orbit. Thank you.",
|
||||
Modifier.fillMaxWidth().clip(RailCorner).background(Panel).padding(horizontal = 12.dp, vertical = 8.dp), color = Muted, fontSize = 12.sp)
|
||||
SettingLine("Squeeze-back", "Over a programme's last minute, the credits shrink into a corner and what's next on the channel fills the screen beside them.") {
|
||||
OnOff(squeezeBack, Modifier, onClick = { squeezeBack = !squeezeBack; settings.squeezeBack = squeezeBack })
|
||||
}
|
||||
SettingLine("The cast", "Show Ollie, Zip, Blaze, Drift and Luna in the squeeze-back and promos.") {
|
||||
OnOff(castOn, Modifier, onClick = { castOn = !castOn; settings.castOn = castOn })
|
||||
}
|
||||
// Character Shorts (Paul, 6 November 2026): both follow The cast, which turns everything off.
|
||||
SettingLine("Character cameos", if (castOn) "Now and then the cast pop up between programmes on Riot, ToonZ in the evening and Nite Owl. Never over a programme or a film." else "Turn on The cast first.") {
|
||||
OnOff(cameos, Modifier, enabled = castOn, onClick = { cameos = !cameos; settings.characterCameos = cameos })
|
||||
}
|
||||
SettingLine("See The Chase", "The first cameo, over a plain frame: Luna's ending and Drift's in turn. It closes by itself.") {
|
||||
OrbitButton("Show one", onClick = { CameoPreview.next() })
|
||||
}
|
||||
SettingLine("Mini shorts", if (castOn) "Rarer still: a short cartoon with the cast in a gap the schedule already has. Coming in a later update." else "Turn on The cast first.") {
|
||||
OnOff(miniShorts, Modifier, enabled = castOn, onClick = { miniShorts = !miniShorts; settings.miniShorts = miniShorts })
|
||||
}
|
||||
var promoNote by remember { mutableStateOf<String?>(null) }
|
||||
SettingLine("Promos", promoNote ?: "Now and then a promo for tonight's highlights plays in place of a channel's ident. See one now; it closes by itself.") {
|
||||
OrbitButton("Show one", onClick = {
|
||||
val item = PromoBoard.previewItem(System.currentTimeMillis())
|
||||
if (item == null) promoNote = "Nothing coming up to promote yet. Try again in a few minutes." else { promoNote = null; PromoBoard.preview = item }
|
||||
})
|
||||
}
|
||||
SettingLine("Drive-In curtains", "Play the curtain intro, with its fanfare, as you go into a screening. Back skips it.") {
|
||||
OnOff(driveInIntro, Modifier, onClick = { driveInIntro = !driveInIntro; settings.driveInIntro = driveInIntro })
|
||||
}
|
||||
Heading("Comfort")
|
||||
SettingLine("Reduce motion", "Leave out moving presentation, such as the Drive-In's curtains.") {
|
||||
OnOff(reduceMotion, Modifier, onClick = { reduceMotion = !reduceMotion; settings.reduceMotion = reduceMotion; Motion.reduce = reduceMotion })
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Family: who's watching and what Kids can see, then bedtime. */
|
||||
@Composable
|
||||
private fun FamilyDetail(totsOn: Boolean, windingDown: Boolean, onWindDown: (Boolean) -> Unit, firstSwitch: FocusRequester, modifier: Modifier) {
|
||||
@@ -407,15 +322,6 @@ private fun RoomsDetail(firstSwitch: FocusRequester, modifier: Modifier,
|
||||
var naming by remember { mutableStateOf(false) }
|
||||
var connecting by remember { mutableStateOf(false) }
|
||||
var bringing by remember { mutableStateOf(false) }
|
||||
// Back up Orbit to my phone: the data kept aside by the last restore, which Undo puts back (with the Adult PIN if set).
|
||||
val undoable = remember(PhoneBackups.screen) { runCatching { PhoneBackups.restorer(context, Workspaces.current(context).scheduleDir).undoable() }.getOrNull() }
|
||||
var undoing by remember { mutableStateOf(false) }
|
||||
var undoPin by remember { mutableStateOf(false) }
|
||||
var undoProblem by remember { mutableStateOf<String?>(null) }
|
||||
val undoScope = rememberCoroutineScope()
|
||||
if (undoPin) { PinEntry("Enter the Adult PIN to undo the restore", undoProblem, onDone = { pin ->
|
||||
if (AfterDarkLock.check(context, pin)) { undoPin = false; undoScope.launch { (context as? android.app.Activity)?.let { PhoneBackups.undo(it) } } } else undoProblem = AfterDarkLock.refusal(context, "That PIN didn't match.")
|
||||
}, onCancel = { undoPin = false }); return }
|
||||
var brought by remember { mutableStateOf<String?>(null) }
|
||||
// The button that opened a page here gets the remote back when it closes (0.129).
|
||||
val addButton = remember { FocusRequester() }; val connectButton = remember { FocusRequester() }
|
||||
@@ -451,38 +357,56 @@ private fun RoomsDetail(firstSwitch: FocusRequester, modifier: Modifier,
|
||||
}
|
||||
return
|
||||
}
|
||||
Column(modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Heading("This room")
|
||||
SettingLine(Rooms.name, "What other TVs see when they join this one.") {
|
||||
// Other TVs and phones (Paul, 12 November 2026, design/settings): this TV, the other TVs, the phones, then two buttons.
|
||||
Column(modifier.footScroll(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Heading("This TV")
|
||||
SettingLine(Rooms.name, "This TV's name, as your other TVs and phones see it.") {
|
||||
OrbitButton("Rename", Modifier.focusRequester(firstSwitch), onClick = { naming = !naming })
|
||||
}
|
||||
if (naming) Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
listOf("Living Room", "Lounge", "Bedroom", "Kids' room", "Kitchen", "Den").forEach { n -> OrbitButton(n, selected = n == Rooms.name, onClick = { Rooms.rename(context, n); naming = false }) }
|
||||
}
|
||||
Heading("Other rooms")
|
||||
SettingLine("Bring in from another room", brought ?: "Everyone's profiles, what Orbit has learnt for each, and their Continue watching, merged in from a TV that's already set up. Channels and schedules here stay as they are.") {
|
||||
OrbitButton("Bring in", onClick = { park(); bringing = true })
|
||||
}
|
||||
SettingLine("Add a room", "Set up Orbit on another TV in your home by copying this one: channels, profiles, look and more. Your password never travels.") {
|
||||
OrbitButton("Add a room", Modifier.focusRequester(addButton), onClick = { park(); returnTo = addButton; adding = true })
|
||||
}
|
||||
// Rooms sync (7 November 2026): each paired room, when it last synced, and a switch to stop.
|
||||
Heading("Your other TVs")
|
||||
// Rooms sync (7 November 2026): each paired TV, how up to date it is, and a switch to stop.
|
||||
RoomLinks.links.forEach { link ->
|
||||
val ago = if (link.lastSyncMs == 0L) "Not synced yet: open Orbit on both TVs" else "Synced ${((System.currentTimeMillis() - link.lastSyncMs) / 60_000).coerceAtLeast(0)} min ago"
|
||||
SettingLine("Sync with ${link.room}", "$ago. Profiles, the PIN, Continue watching and what Orbit has learnt. Channels and schedules stay each room's own.") {
|
||||
val ago = if (link.lastSyncMs == 0L) "Not synced yet: open Orbit on both TVs" else "Up to date ${((System.currentTimeMillis() - link.lastSyncMs) / 60_000).coerceAtLeast(0)} min ago"
|
||||
SettingLine(link.room, "$ago. Profiles, the PIN and Continue watching match; each TV keeps its own channels.") {
|
||||
OnOff(link.on, Modifier, onClick = { RoomLinks.setOn(link.id, !link.on) })
|
||||
}
|
||||
}
|
||||
Rooms.joined.forEach { (room, at) ->
|
||||
val day = java.time.Instant.ofEpochMilli(at).atZone(java.time.ZoneId.systemDefault()).toLocalDate()
|
||||
SettingLine(room, "Copied this Orbit's set-up on ${day.dayOfMonth} ${day.month.getDisplayName(java.time.format.TextStyle.SHORT, java.util.Locale.UK)}. Not connected: it plans its own schedules.") {}
|
||||
SettingLine(room, "Copied from this TV on ${day.dayOfMonth} ${day.month.getDisplayName(java.time.format.TextStyle.SHORT, java.util.Locale.UK)}. Not linked: it plans its own schedules.") {}
|
||||
}
|
||||
if (RoomLinks.links.isEmpty() && Rooms.joined.isEmpty()) Text("No other TVs yet. Add a TV below to copy this one onto it.", color = Muted, fontSize = 12.sp)
|
||||
SettingLine("Bring in from another TV", brought ?: "Merge in everyone's profiles and Continue watching from a TV that's already set up. Channels here stay as they are.") {
|
||||
OrbitButton("Bring in", onClick = { park(); bringing = true })
|
||||
}
|
||||
Heading("Phones")
|
||||
SettingLine("Connect a phone", "Orbit Companion: your phone as a remote, with the guide, Catch Up and rooms. No app to install, just scan a code.") {
|
||||
OrbitButton("Connect", Modifier.focusRequester(connectButton), onClick = { park(); returnTo = connectButton; connecting = true })
|
||||
PhoneLink.phones.forEach { (id, name) -> SettingLine(name, "A remote for this TV, with the guide and Catch Up, and it can make your channels.") {
|
||||
OrbitButton("Remove", onClick = { PhoneLink.forget(id) }) } }
|
||||
if (PhoneLink.phones.isEmpty()) Text("No phones yet. Connect one below: scan a code, nothing to install.", color = Muted, fontSize = 12.sp)
|
||||
Row(Modifier.fillMaxWidth().padding(top = 4.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
OrbitButton("+ Add a TV", Modifier.focusRequester(addButton), onClick = { park(); returnTo = addButton; adding = true })
|
||||
OrbitButton("+ Connect a phone", Modifier.focusRequester(connectButton), onClick = { park(); returnTo = connectButton; connecting = true })
|
||||
}
|
||||
PhoneLink.phones.forEachIndexed { i, (id, name) -> SettingLine(name, "A remote for this TV, and can make and edit your channels.") {
|
||||
OrbitButton("Remove", if (i == 0) Modifier.focusRequester(firstSwitch) else Modifier, onClick = { PhoneLink.forget(id) }) } }
|
||||
Text("Backing up to a phone is under Help and account.", color = Muted, fontSize = 12.sp)
|
||||
}
|
||||
}
|
||||
|
||||
/** Back up to a phone, and undoing a restore (moved from Rooms to Help and account, 12 November 2026). */
|
||||
@Composable
|
||||
private fun BackupLines(park: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
// Back up Orbit to my phone: the data kept aside by the last restore, which Undo puts back (with the Adult PIN if set).
|
||||
val undoable = remember(PhoneBackups.screen) { runCatching { PhoneBackups.restorer(context, Workspaces.current(context).scheduleDir).undoable() }.getOrNull() }
|
||||
var undoing by remember { mutableStateOf(false) }
|
||||
var undoPin by remember { mutableStateOf(false) }
|
||||
var undoProblem by remember { mutableStateOf<String?>(null) }
|
||||
val undoScope = rememberCoroutineScope()
|
||||
if (undoPin) { PinEntry("Enter the Adult PIN to undo the restore", undoProblem, onDone = { pin ->
|
||||
if (AfterDarkLock.check(context, pin)) { undoPin = false; undoScope.launch { (context as? android.app.Activity)?.let { PhoneBackups.undo(it) } } } else undoProblem = AfterDarkLock.refusal(context, "That PIN didn't match.")
|
||||
}, onCancel = { undoPin = false }); return }
|
||||
Heading("Backups")
|
||||
SettingLine("Back up to a phone", "In the Companion on a connected phone: More › Back up and restore. The file is locked with this TV's backup code, which is shown here, never on the phone.") {}
|
||||
undoable?.let { u ->
|
||||
@@ -500,23 +424,28 @@ private fun RoomsDetail(firstSwitch: FocusRequester, modifier: Modifier,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A small heading over a group of settings. */
|
||||
@Composable
|
||||
private fun Heading(text: String) = Text(text.uppercase(), Modifier.padding(top = 6.dp), color = Muted, fontSize = 11.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.sp)
|
||||
internal fun Heading(text: String) = Text(text.uppercase(), Modifier.padding(top = 6.dp), color = Muted, fontSize = 11.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.sp)
|
||||
|
||||
@Composable
|
||||
private fun AccountDetail(server: String, titles: Long?, onSignOut: () -> Unit, onRemoveServer: () -> Unit, firstSwitch: FocusRequester, modifier: Modifier) {
|
||||
private fun AccountDetail(server: String, titles: Long?, onSignOut: () -> Unit, onRemoveServer: () -> Unit, firstSwitch: FocusRequester, modifier: Modifier, park: () -> Unit = {}) {
|
||||
val context = LocalContext.current
|
||||
val version = remember { runCatching { context.packageManager.getPackageInfo(context.packageName, 0).versionName }.getOrNull().orEmpty() }
|
||||
var confirming by remember { mutableStateOf(false) }
|
||||
var removing by remember { mutableStateOf(false) }
|
||||
// Scrolls (0.129): with the requests line added, the Welcome tour and the version were squeezed off the foot of the screen.
|
||||
Column(modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SettingLine("Connected", server + (titles?.let { ", $it titles available" }.orEmpty())) {}
|
||||
Text("Your password is never saved. This box only keeps a sign-in token, in encrypted storage.", color = Muted, fontSize = 13.sp)
|
||||
// Help and account (Paul, 12 November 2026, design/settings): your server, help, signing out, then the technical bits.
|
||||
Column(modifier.footScroll(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Heading("Your server")
|
||||
SettingLine("Connected", server + (titles?.let { ", $it titles available" }.orEmpty()) + ". Your password is never saved: this box only keeps a sign-in token, in encrypted storage.") {}
|
||||
Heading("Help")
|
||||
SettingLine("Show me around", "The welcome tour again, from Ollie's welcome to You're on air. Nothing is changed by it.") {
|
||||
OrbitButton("Start", Modifier.focusRequester(firstSwitch), onClick = { Onboarding.start(tour = true) })
|
||||
}
|
||||
BackupLines(park)
|
||||
Heading("Account")
|
||||
if (confirming) {
|
||||
SettingLine("Sign out of this box?", "Your channels, schedules, review choices and tickets for this server stay on this box for when you sign back in. Your Emby library isn't touched.") {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
@@ -526,7 +455,8 @@ private fun AccountDetail(server: String, titles: Long?, onSignOut: () -> Unit,
|
||||
OrbitButton("Sign out", onClick = onSignOut)
|
||||
}
|
||||
}
|
||||
} else SettingLine("Sign out", "Disconnect this box from Emby. Signing in to another server keeps this one's channels and schedules too.") { OrbitButton("Sign out", Modifier.focusRequester(firstSwitch), onClick = { confirming = true }) }
|
||||
} else SettingLine("Sign out", "Your channels and schedules are kept for when you sign back in, here or on another server.") { OrbitButton("Sign out", onClick = { confirming = true }) }
|
||||
Heading("For the technical")
|
||||
if (removing) {
|
||||
SettingLine("Remove this server from this box?", "Signs out and deletes this server's channels, schedules, bookings, review choices, tickets and library data from this box. Other servers and your Emby library aren't touched. This can't be undone.") {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
@@ -542,15 +472,56 @@ private fun AccountDetail(server: String, titles: Long?, onSignOut: () -> Unit,
|
||||
val ceilingHit = remember { BackgroundPacing.ceilingHitMs?.let { java.text.SimpleDateFormat("HH:mm", java.util.Locale.UK).format(java.util.Date(it)) } }
|
||||
SettingLine("Requests to your server", "This hour: $requestsHour. Last 24 hours: $requestsDay. Counted on this TV only; nothing is sent anywhere. Background reading keeps to $BACKGROUND_BUDGET_LINE, " +
|
||||
"and stops whenever this TV has made ${BackgroundPacing.TOTAL_CEILING} requests in an hour." + (ceilingHit?.let { " It last stopped at $it; watching carried on." } ?: "")) {}
|
||||
SettingLine("Welcome tour", "See the first-launch steps a new box goes through, from Ollie's welcome to You're on air. Nothing is changed by it.") {
|
||||
OrbitButton("Show it", onClick = { Onboarding.start(tour = true) })
|
||||
}
|
||||
// Credits for the sounds Paul chose (8 November 2026): royalty-free effects, named with thanks (design/channels/sound/samples).
|
||||
Text("Sound credits: VHS, Horror, After Dark, Vortex, Heroes, Riot, Paradox and Ring X use royalty-free effects from Pixabay by " +
|
||||
"freesound_community, jusatti890, tomas_herudek, audiopapkin, vishiv and other Pixabay creators, mastered for Orbit. Thank you.",
|
||||
Modifier.fillMaxWidth().clip(RailCorner).background(Panel).padding(horizontal = 12.dp, vertical = 8.dp), color = Muted, fontSize = 12.sp)
|
||||
Text("Orbit TV $version", color = Muted, fontSize = 12.sp)
|
||||
}
|
||||
}
|
||||
|
||||
private enum class ChannelPage { Director, Arrivals }
|
||||
|
||||
/**
|
||||
* The first page of Settings (Paul, 12 November 2026, design/settings): six big choices in plain words, each with a line on
|
||||
* what it's for. The sixth is a way back, not a setting: nothing changes until you choose.
|
||||
*/
|
||||
@Composable
|
||||
private fun SettingsHome(last: SettingsSection, modifier: Modifier, onOpen: (SettingsSection) -> Unit, onBackToTv: () -> Unit) {
|
||||
val focus = remember { SettingsSection.entries.associateWith { FocusRequester() } }
|
||||
LaunchedEffect(Unit) { repeat(20) { if (runCatching { focus.getValue(last).requestFocus() }.getOrDefault(false)) return@LaunchedEffect; kotlinx.coroutines.delay(50) } }
|
||||
Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Text("Settings", color = Ink, fontSize = 22.sp, fontWeight = FontWeight.SemiBold)
|
||||
Text("What would you like to change?", color = Muted, fontSize = 15.sp)
|
||||
val tiles: List<Triple<String, String, Pair<Int?, () -> Unit>>> = SettingsSection.entries.map { item -> Triple(item.label, item.line, item.icon to { onOpen(item) }) } +
|
||||
Triple("Back to TV", "Nothing changes until you choose", null to onBackToTv)
|
||||
tiles.chunked(3).forEachIndexed { r, rowTiles ->
|
||||
Row(Modifier.fillMaxWidth().weight(1f), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
rowTiles.forEachIndexed { c, (title, line, action) ->
|
||||
val section = SettingsSection.entries.getOrNull(r * 3 + c)
|
||||
HomeTile(title, line, action.first, Modifier.weight(1f).fillMaxHeight().then(if (section != null) Modifier.focusRequester(focus.getValue(section)) else Modifier), action.second)
|
||||
}
|
||||
}
|
||||
}
|
||||
Text("◀ ▲ ▼ ▶ Choose OK Open Back Main menu", color = Muted, fontSize = 11.sp)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun HomeTile(title: String, line: String, icon: Int?, modifier: Modifier, onClick: () -> Unit) {
|
||||
var focused by remember { mutableStateOf(false) }
|
||||
val shape = RoundedCornerShape(12.dp)
|
||||
Column(modifier.onFocusChanged { focused = it.isFocused }.clip(shape)
|
||||
.background(if (focused) Yellow else if (icon == null) Color.Transparent else Panel)
|
||||
.border(if (focused) 3.dp else if (icon == null) 2.dp else 0.dp, if (focused) Yellow else Blue, shape)
|
||||
.clickable(onClick = onClick).padding(16.dp), verticalArrangement = Arrangement.Bottom) {
|
||||
if (icon != null) Image(cachedPainter(icon), null, Modifier.size(40.dp), colorFilter = ColorFilter.tint(if (focused) OnAccent else Ink))
|
||||
Spacer(Modifier.weight(1f))
|
||||
Text(title, color = if (focused) OnAccent else Ink, fontSize = 22.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(line, color = if (focused) OnAccent.copy(alpha = .8f) else Muted, fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
|
||||
/** Everything behind the gear: a rail of sections on the left, and the chosen one beside it. */
|
||||
@Composable
|
||||
internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSection) -> Unit, modifier: Modifier, busy: Boolean, message: String?, server: String, titles: Long?,
|
||||
@@ -559,7 +530,12 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio
|
||||
isOn: (Int) -> Boolean, onSwitch: (ChannelProgramming, Boolean) -> Unit, onSuggestions: (ChannelProgramming) -> Unit, onSignOut: () -> Unit,
|
||||
windingDown: Boolean, onWindDown: (Boolean) -> Unit, onRemoveServer: () -> Unit = {},
|
||||
/** Create your own: null where there's no library to make channels from. */
|
||||
maker: ChannelMaker? = null) {
|
||||
maker: ChannelMaker? = null,
|
||||
/** The Back to TV choice on the first page. */
|
||||
onBackToTv: () -> Unit = {}) {
|
||||
// Settings opens on six plain choices (Paul, 12 November 2026); a section opens beside the list as before, and Back
|
||||
// from a section comes back here, onto the section you were in.
|
||||
var home by remember { mutableStateOf(true) }
|
||||
// Making or editing a channel of your own takes over the Channels detail until it's done.
|
||||
var making by remember { mutableStateOf<Pair<Boolean, CustomChannel?>?>(null) }
|
||||
var made by remember { mutableStateOf<String?>(null) }
|
||||
@@ -572,7 +548,14 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio
|
||||
val firstSwitch = remember { FocusRequester() }
|
||||
val channelList = rememberLazyListState()
|
||||
val scope = rememberCoroutineScope()
|
||||
LaunchedEffect(Unit) { firstFocus.requestFocus() }
|
||||
// Into a section: onto its first item once it's drawn, else its name in the list.
|
||||
LaunchedEffect(home) {
|
||||
if (home) return@LaunchedEffect
|
||||
repeat(30) { if (runCatching { firstSwitch.requestFocus() }.getOrDefault(false)) return@LaunchedEffect; kotlinx.coroutines.delay(50) }
|
||||
runCatching { firstFocus.requestFocus() }
|
||||
}
|
||||
if (home) { SettingsHome(section, modifier, onOpen = { item -> onSection(item); home = false }, onBackToTv = onBackToTv); return }
|
||||
BackHandler { home = true }
|
||||
// The card that opened a page in place of the list gets the remote back when the page closes (0.129).
|
||||
val createCard = remember { FocusRequester() }; val chairCard = remember { FocusRequester() }; val arrivalsCard = remember { FocusRequester() }
|
||||
var returnTo by remember { mutableStateOf<FocusRequester?>(null) }
|
||||
@@ -612,20 +595,20 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio
|
||||
ChannelsDetail(busy, made ?: message, isOn, onSwitch, onSuggestions, listFirst, channelList, Modifier.weight(1f), onEdit = { c -> made = null; making = true to c })
|
||||
}
|
||||
}
|
||||
SettingsSection.OnScreen -> ViewingDetail(firstSwitch, detail) {
|
||||
SettingsSection.OnScreen -> WatchingDetail(firstSwitch, detail, park = { runCatching { firstFocus.requestFocus() } }, isOn(TOTS_NUMBER), windingDown, onWindDown) { first ->
|
||||
Heading("Layout")
|
||||
Text("How Home is laid out. Any layout works with any look below.", color = Muted, fontSize = 12.sp)
|
||||
Text("How Home is laid out. Any layout works with any colours below.", color = Muted, fontSize = 12.sp)
|
||||
LayoutPicker()
|
||||
Heading("Look")
|
||||
Text("Every screen takes the look you pick, straight away. The cast, the channels' idents and the games keep their own colours.", color = Muted, fontSize = 12.sp)
|
||||
LookPicker(firstSwitch, cardWidth = 128.dp)
|
||||
Heading("Colours")
|
||||
Text("Every screen takes the colours you pick, straight away. The cast, the channels' idents and the games keep their own.", color = Muted, fontSize = 12.sp)
|
||||
LookPicker(first, cardWidth = 128.dp)
|
||||
}
|
||||
SettingsSection.Family -> FamilyDetail(isOn(TOTS_NUMBER), windingDown, onWindDown, firstSwitch, detail)
|
||||
SettingsSection.Rooms -> RoomsDetail(firstSwitch, detail, park = { runCatching { firstFocus.requestFocus() } })
|
||||
SettingsSection.Account -> AccountDetail(server, titles, onSignOut, onRemoveServer, firstSwitch, detail)
|
||||
SettingsSection.Account -> AccountDetail(server, titles, onSignOut, onRemoveServer, firstSwitch, detail, park = { runCatching { firstFocus.requestFocus() } })
|
||||
}
|
||||
}
|
||||
Text("▲▼ Move ► Into this section OK Select Back Main menu", color = Muted, fontSize = 11.sp)
|
||||
Text("▲▼ Move ► Into this section OK Select Back Settings", color = Muted, fontSize = 11.sp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.foundation.focusGroup
|
||||
import androidx.compose.ui.focus.focusProperties
|
||||
import kotlinx.coroutines.launch
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.role
|
||||
import androidx.compose.ui.semantics.selected
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.tv.material3.Text
|
||||
|
||||
/**
|
||||
* What plays between programmes, as one of three styles (Paul, 12 November 2026, from design/settings): eighteen switches
|
||||
* were more than most people want to think about. A style sets the seven switches that shape the evening; the rarer extras
|
||||
* (special ident sounds, the cast's cameos and mini shorts) stay as they are, and every switch is still under Choose each one.
|
||||
* Change any of the seven by hand and the style shows as Custom, since it no longer matches.
|
||||
*/
|
||||
internal data class BetweenSwitches(val idents: Boolean, val identSound: Boolean, val upNext: Boolean, val specialIdents: Boolean,
|
||||
val squeezeBack: Boolean, val castOn: Boolean, val curtains: Boolean)
|
||||
|
||||
internal enum class BetweenStyle(val title: String, val line: String, val explains: String, val switches: BetweenSwitches) {
|
||||
Full("Full TV feel", "Idents, what's next, the cast",
|
||||
"Each channel's ident with its sound between programmes, special idents for named blocks, Coming up next, the credits squeeze with the cast, and the Drive-In curtains.",
|
||||
BetweenSwitches(idents = true, identSound = true, upNext = true, specialIdents = true, squeezeBack = true, castOn = true, curtains = true)),
|
||||
Little("A little", "Idents and what's next",
|
||||
"Idents between programmes, special idents for named blocks, and Coming up next. No ident sounds, no credits squeeze, no cast, no curtains.",
|
||||
BetweenSwitches(idents = true, identSound = false, upNext = true, specialIdents = true, squeezeBack = false, castOn = false, curtains = false)),
|
||||
Plain("Just the programmes", "Nothing in between",
|
||||
"One programme straight into the next: no idents, no cards, no sounds, no cast, no curtains.",
|
||||
BetweenSwitches(idents = false, identSound = false, upNext = false, specialIdents = false, squeezeBack = false, castOn = false, curtains = false));
|
||||
|
||||
companion object {
|
||||
/** The style these switches match, or null when they've been chosen one by one (Custom). */
|
||||
fun of(switches: BetweenSwitches) = entries.firstOrNull { it.switches == switches }
|
||||
const val CUSTOM_EXPLAINS = "You've chosen each one yourself, under Choose each one. Pick a style to start again from it."
|
||||
}
|
||||
}
|
||||
|
||||
/** Every Watching switch, read once and shared by the Watching page and its pages, so a change on one shows on the other. */
|
||||
internal class WatchingSwitches(private val settings: OrbitSettings) {
|
||||
var channelLogo by mutableStateOf(settings.channelLogo)
|
||||
var idents by mutableStateOf(settings.idents)
|
||||
var identSound by mutableStateOf(settings.identSound)
|
||||
var identSoundQuiet by mutableStateOf(settings.identSoundQuiet)
|
||||
var identSoundNightQuiet by mutableStateOf(settings.identSoundNightQuiet)
|
||||
var upNext by mutableStateOf(settings.upNext)
|
||||
var curtains by mutableStateOf(settings.driveInIntro)
|
||||
var reduceMotion by mutableStateOf(settings.reduceMotion)
|
||||
var squeezeBack by mutableStateOf(settings.squeezeBack)
|
||||
var castOn by mutableStateOf(settings.castOn)
|
||||
var cameos by mutableStateOf(settings.characterCameos)
|
||||
var miniShorts by mutableStateOf(settings.miniShorts)
|
||||
var specialIdents by mutableStateOf(settings.specialIdents)
|
||||
var blockIdentSound by mutableStateOf(settings.blockIdentSound)
|
||||
|
||||
val between get() = BetweenSwitches(idents, identSound, upNext, specialIdents, squeezeBack, castOn, curtains)
|
||||
|
||||
fun apply(style: BetweenStyle) {
|
||||
val s = style.switches
|
||||
idents = s.idents; settings.idents = s.idents
|
||||
identSound = s.identSound; settings.identSound = s.identSound
|
||||
upNext = s.upNext; settings.upNext = s.upNext
|
||||
specialIdents = s.specialIdents; settings.specialIdents = s.specialIdents
|
||||
squeezeBack = s.squeezeBack; settings.squeezeBack = s.squeezeBack
|
||||
castOn = s.castOn; settings.castOn = s.castOn
|
||||
curtains = s.curtains; settings.driveInIntro = s.curtains
|
||||
}
|
||||
|
||||
fun putChannelLogo(v: Boolean) { channelLogo = v; settings.channelLogo = v }
|
||||
fun putIdents(v: Boolean) { idents = v; settings.idents = v }
|
||||
fun putIdentSound(v: Boolean) { identSound = v; settings.identSound = v }
|
||||
fun putIdentSoundQuiet(v: Boolean) { identSoundQuiet = v; settings.identSoundQuiet = v }
|
||||
fun putNightQuiet(v: Boolean) { identSoundNightQuiet = v; settings.identSoundNightQuiet = v }
|
||||
fun putUpNext(v: Boolean) { upNext = v; settings.upNext = v }
|
||||
fun putCurtains(v: Boolean) { curtains = v; settings.driveInIntro = v }
|
||||
fun putReduceMotion(v: Boolean) { reduceMotion = v; settings.reduceMotion = v; Motion.reduce = v }
|
||||
fun putSqueezeBack(v: Boolean) { squeezeBack = v; settings.squeezeBack = v }
|
||||
fun putCastOn(v: Boolean) { castOn = v; settings.castOn = v }
|
||||
fun putCameos(v: Boolean) { cameos = v; settings.characterCameos = v }
|
||||
fun putMiniShorts(v: Boolean) { miniShorts = v; settings.miniShorts = v }
|
||||
fun putSpecialIdents(v: Boolean) { specialIdents = v; settings.specialIdents = v }
|
||||
fun putBlockIdentSound(v: Boolean) { blockIdentSound = v; settings.blockIdentSound = v }
|
||||
}
|
||||
|
||||
private enum class WatchingPage { Look, EachOne, Comfort }
|
||||
|
||||
/**
|
||||
* Watching (Paul, 12 November 2026): everyday choices first, then what plays between programmes as a style, then two pages
|
||||
* for whoever wants more: Choose each one, and Comfort and accessibility (the sensory settings in one findable place).
|
||||
* Every page here scrolls, and the focused row is always brought fully into view.
|
||||
*/
|
||||
@Composable
|
||||
internal fun WatchingDetail(firstSwitch: FocusRequester, modifier: Modifier, park: () -> Unit, totsOn: Boolean, windingDown: Boolean, onWindDown: (Boolean) -> Unit,
|
||||
look: @Composable (FocusRequester) -> Unit) {
|
||||
val context = LocalContext.current
|
||||
val settings = remember { OrbitSettings(context) }
|
||||
val s = remember { WatchingSwitches(settings) }
|
||||
var page by remember { mutableStateOf<WatchingPage?>(null) }
|
||||
// The row that opened a page gets the remote back when it closes (as everywhere in Settings since 0.129).
|
||||
val lookRow = remember { FocusRequester() }; val eachRow = remember { FocusRequester() }; val comfortRow = remember { FocusRequester() }
|
||||
var returnTo by remember { mutableStateOf<FocusRequester?>(null) }
|
||||
LaunchedEffect(page) { if (page == null) returnTo?.let { r -> repeat(20) { if (runCatching { r.requestFocus() }.getOrDefault(false)) { returnTo = null; return@LaunchedEffect }; kotlinx.coroutines.delay(50) } } }
|
||||
val pageFirst = remember { FocusRequester() }
|
||||
when (page) {
|
||||
WatchingPage.Look -> { SettingsSubPage(pageFirst, { park(); page = null }, modifier) {
|
||||
Column(Modifier.fillMaxSize().footScroll(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
PageTitle("How Orbit looks", "Back returns to Watching")
|
||||
look(pageFirst)
|
||||
}
|
||||
}; return }
|
||||
WatchingPage.EachOne -> { SettingsSubPage(pageFirst, { park(); page = null }, modifier) { EachOnePage(s, pageFirst) }; return }
|
||||
WatchingPage.Comfort -> { SettingsSubPage(pageFirst, { park(); page = null }, modifier) { ComfortPage(s, pageFirst, totsOn, windingDown, onWindDown) }; return }
|
||||
null -> Unit
|
||||
}
|
||||
Column(modifier.footScroll(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Heading("Everyday")
|
||||
// Off, On or Automatic (0.129): each says what it does; the choice applies from the next programme.
|
||||
SettingLine("Subtitles: ${Subtitles.mode.title}", Subtitles.mode.line + " Press right while watching to change them for one programme.") {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
SubtitleMode.entries.forEachIndexed { i, m -> OrbitButton(m.title, if (i == 0) Modifier.focusRequester(firstSwitch) else Modifier, selected = Subtitles.mode == m, onClick = { Subtitles.set(settings, m) }) }
|
||||
}
|
||||
}
|
||||
SettingLine("How Orbit looks", "Layout and colours: ${OrbitLayouts.current.title}, ${OrbitTheme.look.title}") {
|
||||
OrbitButton("Change", Modifier.focusRequester(lookRow), onClick = { park(); returnTo = lookRow; page = WatchingPage.Look })
|
||||
}
|
||||
SettingLine("Channel logo", "The channel's small logo in the corner during programmes.") { OnOff(s.channelLogo, Modifier, onClick = { s.putChannelLogo(!s.channelLogo) }) }
|
||||
|
||||
Heading("Between programmes")
|
||||
val chosen = BetweenStyle.of(s.between)
|
||||
var focusedStyle by remember { mutableStateOf<BetweenStyle?>(null) }
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
BetweenStyle.entries.forEach { style ->
|
||||
StyleCard(style.title, style.line, style == chosen, Modifier.weight(1f), onFocus = { focusedStyle = if (it) style else if (focusedStyle == style) null else focusedStyle }) { s.apply(style) }
|
||||
}
|
||||
}
|
||||
// What the style does, in words: the one the remote is on, else the one chosen; Custom once switches are set by hand.
|
||||
val explaining = focusedStyle ?: chosen
|
||||
Text((if (explaining == null) "Custom. " + BetweenStyle.CUSTOM_EXPLAINS else (if (explaining == chosen) "Chosen: " else "") + explaining.explains),
|
||||
Modifier.fillMaxWidth().clip(RailCorner).background(Panel).padding(horizontal = 12.dp, vertical = 8.dp), color = if (explaining == null) Yellow else Muted, fontSize = 12.sp)
|
||||
SettingLine("Choose each one", "Every switch for idents, sounds, the cast and the Drive-In, grouped and explained.") {
|
||||
OrbitButton(if (chosen == null) "Custom" else "Open", Modifier.focusRequester(eachRow), onClick = { park(); returnTo = eachRow; page = WatchingPage.EachOne })
|
||||
}
|
||||
|
||||
Heading("Comfort and accessibility")
|
||||
SettingLine("Comfort and accessibility", "Less motion, softer sounds, quieter nights" + (if (totsOn) ", and Wind Down for Tots." else ".")) {
|
||||
OrbitButton("Open", Modifier.focusRequester(comfortRow), onClick = { park(); returnTo = comfortRow; page = WatchingPage.Comfort })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PageTitle(title: String, line: String) {
|
||||
Column {
|
||||
Text(title, color = Ink, fontSize = 18.sp, fontWeight = FontWeight.SemiBold)
|
||||
Text(line, color = Muted, fontSize = 12.sp)
|
||||
}
|
||||
}
|
||||
|
||||
/** One of the three styles: a card that says what it is, ticked when chosen (never colour alone: a filled dot and the word). */
|
||||
@Composable
|
||||
private fun StyleCard(title: String, line: String, chosen: Boolean, modifier: Modifier, onFocus: (Boolean) -> Unit, onClick: () -> Unit) {
|
||||
var focused by remember { mutableStateOf(false) }
|
||||
val shape = RoundedCornerShape(10.dp)
|
||||
Column(modifier.onFocusChanged { focused = it.isFocused; onFocus(it.isFocused) }.clip(shape)
|
||||
.background(if (focused) Yellow else if (chosen) Ink else Panel).border(if (focused) 3.dp else 0.dp, if (focused) Yellow else Color.Transparent, shape)
|
||||
.clickable(onClick = onClick).semantics { role = Role.RadioButton; selected = chosen }.padding(horizontal = 12.dp, vertical = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
val ink = if (focused || chosen) OnAccent else Ink
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Box(Modifier.size(14.dp).clip(RoundedCornerShape(7.dp)).border(2.dp, ink, RoundedCornerShape(7.dp)), contentAlignment = Alignment.Center) {
|
||||
if (chosen) Box(Modifier.size(6.dp).clip(RoundedCornerShape(3.dp)).background(ink))
|
||||
}
|
||||
Text(title, color = ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
Text(if (chosen) "Chosen · $line" else line, color = ink.copy(alpha = .8f), fontSize = 11.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
|
||||
/** Choose each one: every presentation switch, grouped under plain headings, each with a line on what it does. */
|
||||
@Composable
|
||||
private fun EachOnePage(s: WatchingSwitches, first: FocusRequester) {
|
||||
Column(Modifier.fillMaxSize().footScroll(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
PageTitle("Choose each one", "Changing any of these sets the style to Custom. Back returns to Watching.")
|
||||
Heading("Between programmes")
|
||||
SettingLine("Idents", "A short film for the channel between programmes. When off, Tots shows a still picture instead.") { OnOff(s.idents, Modifier.focusRequester(first), onClick = { s.putIdents(!s.idents) }) }
|
||||
SettingLine("Coming up next", "Near the end of a programme, a small card in the corner says what's on next.") { OnOff(s.upNext, Modifier, onClick = { s.putUpNext(!s.upNext) }) }
|
||||
SettingLine("Special idents", "Named blocks and events get their own ident as they begin, such as Riot Laughs or PPV Sunday.") { OnOff(s.specialIdents, Modifier, onClick = { s.putSpecialIdents(!s.specialIdents) }) }
|
||||
SettingLine("Credits squeeze", "Over a programme's last minute, the credits shrink into a corner and what's next fills the screen beside them.") { OnOff(s.squeezeBack, Modifier, onClick = { s.putSqueezeBack(!s.squeezeBack) }) }
|
||||
var promoNote by remember { mutableStateOf<String?>(null) }
|
||||
SettingLine("Promos", promoNote ?: "Now and then a promo for tonight's highlights plays in place of a channel's ident. See one now; it closes by itself.") {
|
||||
OrbitButton("Show one", onClick = {
|
||||
val item = PromoBoard.previewItem(System.currentTimeMillis())
|
||||
if (item == null) promoNote = "Nothing coming up to promote yet. Try again in a few minutes." else { promoNote = null; PromoBoard.preview = item }
|
||||
})
|
||||
}
|
||||
SettingLine("Drive-In curtains", "The curtain intro, with its fanfare, as you go into a screening. Back skips it.") { OnOff(s.curtains, Modifier, onClick = { s.putCurtains(!s.curtains) }) }
|
||||
Heading("Sound")
|
||||
SettingLine("Ident sounds", "Each channel's ident plays its own short sound, at most every 20 minutes a channel; Tots plays its jingle.") { OnOff(s.identSound, Modifier, onClick = { s.putIdentSound(!s.identSound) }) }
|
||||
SettingLine("Special ident sounds", "A short sound with each special ident. Off keeps them silent.") { OnOff(s.blockIdentSound, Modifier, onClick = { s.putBlockIdentSound(!s.blockIdentSound) }) }
|
||||
Text("Softer sounds and quiet nights are under Comfort and accessibility.", color = Muted, fontSize = 12.sp)
|
||||
Heading("The cast")
|
||||
SettingLine("The cast", "Ollie, Zip, Blaze, Drift and Luna in the credits squeeze and promos.") { OnOff(s.castOn, Modifier, onClick = { s.putCastOn(!s.castOn) }) }
|
||||
// Character Shorts (Paul, 6 November 2026): both follow The cast, which turns everything off.
|
||||
SettingLine("Character cameos", if (s.castOn) "Now and then the cast pop up between programmes on Riot, ToonZ in the evening and Nite Owl. Never over a programme or a film." else "Turn on The cast first.") {
|
||||
OnOff(s.cameos, Modifier, enabled = s.castOn, onClick = { s.putCameos(!s.cameos) })
|
||||
}
|
||||
SettingLine("See The Chase", "The first cameo, over a plain frame: Luna's ending and Drift's in turn. It closes by itself.") { OrbitButton("Show one", onClick = { CameoPreview.next() }) }
|
||||
SettingLine("Mini shorts", if (s.castOn) "Rarer still: a short cartoon with the cast in a gap the schedule already has. Coming in a later update." else "Turn on The cast first.") {
|
||||
OnOff(s.miniShorts, Modifier, enabled = s.castOn, onClick = { s.putMiniShorts(!s.miniShorts) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Comfort and accessibility (Paul, 12 November 2026): the sensory settings in one place you can find. */
|
||||
@Composable
|
||||
private fun ComfortPage(s: WatchingSwitches, first: FocusRequester, totsOn: Boolean, windingDown: Boolean, onWindDown: (Boolean) -> Unit) {
|
||||
Column(Modifier.fillMaxSize().footScroll(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
PageTitle("Comfort and accessibility", "Text in Orbit follows your TV's own text size setting. Back returns to Watching.")
|
||||
Heading("Motion")
|
||||
SettingLine("Reduce motion", "Slides and rises become short fades, and the Drive-In's curtains are left out. Idents show as a still card, with no sound.") {
|
||||
OnOff(s.reduceMotion, Modifier.focusRequester(first), onClick = { s.putReduceMotion(!s.reduceMotion) })
|
||||
}
|
||||
Heading("Sound")
|
||||
SettingLine("Soft ident sounds", if (s.identSound) "Ident sounds play softly, well under the programmes." else "Ident sounds are off (Watching › Choose each one).") {
|
||||
OnOff(s.identSoundQuiet, Modifier, enabled = s.identSound, onClick = { s.putIdentSoundQuiet(!s.identSoundQuiet) })
|
||||
}
|
||||
SettingLine("Quieter late at night", "From 11pm to 7am, ident sounds play softly on their own, so nobody's woken.") {
|
||||
OnOff(s.identSoundNightQuiet, Modifier, enabled = s.identSound && !s.identSoundQuiet, onClick = { s.putNightQuiet(!s.identSoundNightQuiet) })
|
||||
}
|
||||
Heading("Bedtime")
|
||||
if (totsOn) {
|
||||
var confirming by remember { mutableStateOf(false) }
|
||||
if (confirming) SettingLine(if (windingDown) "Go back to Tots' usual schedule now?" else "Start Wind Down on Tots?", if (windingDown) "The programme on Tots changes straight away." else "Calm shows begin when the current programme ends, and run until morning unless you stop them.") {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
val keep = remember { FocusRequester() }
|
||||
LaunchedEffect(Unit) { keep.requestFocus() }
|
||||
OrbitButton("Not now", Modifier.focusRequester(keep), onClick = { confirming = false })
|
||||
OrbitButton("Yes", onClick = { confirming = false; onWindDown(!windingDown) })
|
||||
}
|
||||
} else SettingLine("Wind Down Now", "Calm shows on Tots at any time of day. Tots' usual schedule stays saved.") { OnOff(windingDown, Modifier, onClick = { confirming = true }) }
|
||||
} else SettingLine("Wind Down", "Calm shows on Tots, with Luna. Turn Tots on in Channels to use it.") {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A page that scrolls, and shows its very end when Down is pressed on its last item (Paul, 12 November 2026: a note or a
|
||||
* switched-off row below the last thing you can move to could never be seen, as on the Arcade before). Moving between
|
||||
* items still brings each one fully into view, as Compose does for focus.
|
||||
*/
|
||||
@Composable
|
||||
internal fun Modifier.footScroll(): Modifier {
|
||||
val scroll = rememberScrollState()
|
||||
val scope = rememberCoroutineScope()
|
||||
return this.focusProperties {
|
||||
onExit = { if (requestedFocusDirection == androidx.compose.ui.focus.FocusDirection.Down) scope.launch { scroll.animateScrollTo(scroll.maxValue) } }
|
||||
}.focusGroup().verticalScroll(scroll)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
|
||||
/** Paul, 12 November 2026: three styles for what plays between programmes, and Custom once a switch is set by hand. */
|
||||
class BetweenStyleTest {
|
||||
@Test
|
||||
fun aNewBoxStartsOnFullTvFeel() {
|
||||
// Orbit's defaults: idents, sounds, what's next, special idents, the squeeze, the cast and the curtains all on.
|
||||
assertEquals(BetweenStyle.Full, BetweenStyle.of(BetweenSwitches(idents = true, identSound = true, upNext = true, specialIdents = true, squeezeBack = true, castOn = true, curtains = true)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun eachStyleIsItselfAndTheyAllDiffer() {
|
||||
BetweenStyle.entries.forEach { assertEquals(it, BetweenStyle.of(it.switches)) }
|
||||
assertEquals(3, BetweenStyle.entries.map { it.switches }.distinct().size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun changingOneSwitchByHandIsCustom() {
|
||||
val full = BetweenStyle.Full.switches
|
||||
assertNull(BetweenStyle.of(full.copy(identSound = false)))
|
||||
assertNull(BetweenStyle.of(BetweenStyle.Plain.switches.copy(idents = true)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun everyStyleSaysWhatItChanges() {
|
||||
BetweenStyle.entries.forEach { assertTrue(it.explains.length > 40); assertTrue(it.title.isNotBlank()) }
|
||||
assertTrue(BetweenStyle.CUSTOM_EXPLAINS.contains("Choose each one"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user