Six looks: every screen takes its colours from the chosen theme

Orbit Night, Daybreak, Nebula, Retro Tube (with scanlines), Deep Sea and High Contrast, from the approved design. Colours
are theme tokens read while drawing, so a choice applies at once everywhere. Orbit Night stays colour for colour the same.
Text uses Ink, text on the accent OnAccent; the cast, idents, takeover marks and game boards keep their own colours.
Choose your look comes right after Welcome in onboarding (the tour puts yours back), and in Settings > Look. Every look is
tested for readable contrast.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-06 03:20:22 +00:00
co-authored by Claude Opus 5.5
parent 56e017ec90
commit 7f9320dd7f
39 changed files with 535 additions and 251 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ android {
applicationId = "tv.orbit.classic"
minSdk = 26
targetSdk = 36
versionCode = 201
versionName = "0.108.41-portability"
versionCode = 202
versionName = "0.108.42-looks"
}
buildFeatures { compose = true }
// Android logging and the like do nothing in unit tests, so whole flows (a channel read from a fake server) can run.
@@ -98,11 +98,11 @@ internal fun PinEntry(title: String, problem: String?, onDone: (String) -> Unit,
}
true
}, horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(title, color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.SemiBold)
Text(title, color = Ink, fontSize = 16.sp, fontWeight = FontWeight.SemiBold)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
entry.digits.forEachIndexed { i, d ->
Box(Modifier.size(40.dp, 46.dp).background(if (i == entry.slot) Yellow else Panel, RoundedCornerShape(4.dp)), contentAlignment = Alignment.Center) {
Text(if (i == entry.slot) d.toString() else if (i < entry.slot) "•" else "", color = if (i == entry.slot) Navy else Color.White, fontSize = 22.sp, fontWeight = FontWeight.SemiBold)
Text(if (i == entry.slot) d.toString() else if (i < entry.slot) "•" else "", color = if (i == entry.slot) OnAccent else Ink, fontSize = 22.sp, fontWeight = FontWeight.SemiBold)
}
}
}
@@ -126,7 +126,7 @@ internal fun LockDetail(firstSwitch: FocusRequester, modifier: Modifier) {
!AfterDarkLock.pinSet -> "Off: After Dark and The Late Show are showing"
AfterDarkLock.unlocked -> "Unlocked until Orbit closes"
else -> "Locked: After Dark and The Late Show are hidden"
}, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.SemiBold)
}, color = Ink, fontSize = 18.sp, fontWeight = FontWeight.SemiBold)
Text("With a PIN set, Orbit After Dark and The Late Show at the Drive-In are hidden from the guide, Home, What's On and Catch Up, and from channel up and down. " +
"Enter the PIN here to watch them; they lock again when Orbit closes.", color = Muted, fontSize = 12.sp)
note?.let { Text(it, color = Yellow, fontSize = 13.sp) }
@@ -190,7 +190,7 @@ internal fun BlastOffScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Uni
val bestBefore = remember(game.alive) { best }
val newBest = game.score > bestBefore && game.score > 0
BackHandler { if (game.alive) paused = !paused else onLeave() }
Row(Modifier.fillMaxSize().background(Navy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
Row(Modifier.fillMaxSize().background(NightNavy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
val native = event.nativeKeyEvent
if (native.action != KeyEvent.ACTION_DOWN || paused || !game.alive) return@onPreviewKeyEvent false
val next = when (native.keyCode) {
@@ -207,16 +207,16 @@ internal fun BlastOffScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Uni
Column(Modifier.width(180.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("BLAST OFF", color = Honey, fontFamily = Marquee, fontSize = 32.sp)
Spacer(Modifier.height(10.dp))
Text("SCORE", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("SCORE", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(game.score.toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Text("BEST", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("BEST", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(maxOf(best, game.score).toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
if (game.streak >= 2) Text("COMBO ×${game.streak}", color = Color(0xFFFF4FA3), fontFamily = Marquee, fontSize = 26.sp)
Spacer(Modifier.weight(1f))
Text("◄►▲▼ Move the shape", color = Muted, fontSize = 13.sp)
Text("OK Place it", color = Muted, fontSize = 13.sp)
Text("▼ off the board: choose another", color = Muted, fontSize = 13.sp)
Text("Back Pause", color = Muted, fontSize = 13.sp)
Text("◄►▲▼ Move the shape", color = NightMuted, fontSize = 13.sp)
Text("OK Place it", color = NightMuted, fontSize = 13.sp)
Text("▼ off the board: choose another", color = NightMuted, fontSize = 13.sp)
Text("Back Pause", color = NightMuted, fontSize = 13.sp)
}
Box(Modifier.weight(1f).fillMaxHeight(), contentAlignment = Alignment.Center) {
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) {
@@ -225,8 +225,8 @@ internal fun BlastOffScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Uni
game.tray.forEachIndexed { i, p ->
val chosen = i == game.selected
val corner = RoundedCornerShape(8.dp)
Box(Modifier.size(96.dp, 80.dp).background(if (chosen && game.inTray) Navy else Panel, corner)
.border(if (chosen) 3.dp else 0.dp, if (chosen && game.inTray) Yellow else if (chosen) Muted else Color.Transparent, corner)) {
Box(Modifier.size(96.dp, 80.dp).background(if (chosen && game.inTray) NightNavy else NightPanel, corner)
.border(if (chosen) 3.dp else 0.dp, if (chosen && game.inTray) NightYellow else if (chosen) NightMuted else Color.Transparent, corner)) {
if (p != null) Canvas(Modifier.fillMaxSize().padding(8.dp)) { drawTrayPiece(p, minOf(size.width / 5, size.height / 5)) }
}
}
@@ -239,7 +239,7 @@ internal fun BlastOffScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Uni
for (k in 1..6) drawCircle(Color(0xFFFFE066).copy(alpha = .8f - k * .12f), r * .16f, at + Offset(k * r * .5f, 0f))
drawOrbChaser(at, r, OrbCharacter.Zip, OrbDir.Left, false, false, false, 0f)
}
if (paused || !game.alive) Column(Modifier.background(Navy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
if (paused || !game.alive) Column(Modifier.background(NightNavy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(if (game.alive) "PAUSED" else "NO ROOM LEFT", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
if (!game.alive && newBest) CastCheer()
if (!game.alive) Text(if (newBest) "New best: ${game.score}" else "Score: ${game.score}", color = Color.White, fontSize = 16.sp)
@@ -174,7 +174,7 @@ internal fun BlockDropScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Un
val bestBefore = remember(game.alive) { best }
val newBest = game.score > bestBefore && game.score > 0
BackHandler { if (game.alive) paused = !paused else onLeave() }
Row(Modifier.fillMaxSize().background(Navy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
Row(Modifier.fillMaxSize().background(NightNavy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
val native = event.nativeKeyEvent
if (native.action != KeyEvent.ACTION_DOWN || paused || !game.alive) return@onPreviewKeyEvent false
val next = when (native.keyCode) {
@@ -191,19 +191,19 @@ internal fun BlockDropScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Un
Column(Modifier.width(190.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("BLOCK DROP", color = Honey, fontFamily = Marquee, fontSize = 34.sp)
Spacer(Modifier.height(10.dp))
Text("SCORE", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("SCORE", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(game.score.toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Text("BEST", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("BEST", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(maxOf(best, game.score).toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Text("LEVEL ${game.level} · ROWS ${game.lines}", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)
Text("LEVEL ${game.level} · ROWS ${game.lines}", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)
Spacer(Modifier.weight(1f))
Text("◄► Move ▲ Turn", color = Muted, fontSize = 13.sp)
Text("▼ Down OK Drop", color = Muted, fontSize = 13.sp)
Text("Back Pause", color = Muted, fontSize = 13.sp)
Text("◄► Move ▲ Turn", color = NightMuted, fontSize = 13.sp)
Text("▼ Down OK Drop", color = NightMuted, fontSize = 13.sp)
Text("Back Pause", color = NightMuted, fontSize = 13.sp)
}
Box(Modifier.weight(1f).fillMaxHeight().border(2.dp, Blue), contentAlignment = Alignment.Center) {
Box(Modifier.weight(1f).fillMaxHeight().border(2.dp, NightBlue), contentAlignment = Alignment.Center) {
BlockField(game, Modifier.fillMaxSize().padding(6.dp))
if (paused || !game.alive) Column(Modifier.background(Navy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
if (paused || !game.alive) Column(Modifier.background(NightNavy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(if (game.alive) "PAUSED" else "GAME OVER", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
if (!game.alive && newBest) CastCheer()
if (!game.alive) Text(if (newBest) "New best: ${game.score}" else "Score: ${game.score}", color = Color.White, fontSize = 16.sp)
@@ -215,7 +215,7 @@ internal fun BlockDropScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Un
}
}
Column(Modifier.width(130.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("NEXT", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("NEXT", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
NextPiece(game.next, Modifier.size(110.dp).background(Color(0xFF050E2A), RoundedCornerShape(6.dp)).padding(10.dp))
}
}
@@ -123,7 +123,7 @@ internal fun BrickField(game: BrickGame, modifier: Modifier) = Canvas(modifier)
drawRoundRect(if (b.hits > 1) Color.White else colour, Offset(o.x + b.left * k, o.y + b.top * k), Size((b.right - b.left) * k, BRICK_HEIGHT * k), CornerRadius(2 * k))
if (b.hits > 1) drawRoundRect(colour, Offset(o.x + (b.left + 1.5f) * k, o.y + (b.top + 1.5f) * k), Size((b.right - b.left - 3f) * k, (BRICK_HEIGHT - 3f) * k), CornerRadius(1.5f * k))
}
drawRoundRect(Yellow, Offset(o.x + (game.paddleX - PADDLE_W / 2) * k, o.y + PADDLE_Y * k), Size(PADDLE_W * k, 6 * k), CornerRadius(3 * k))
drawRoundRect(NightYellow, Offset(o.x + (game.paddleX - PADDLE_W / 2) * k, o.y + PADDLE_Y * k), Size(PADDLE_W * k, 6 * k), CornerRadius(3 * k))
drawCircle(Color.White, BALL_R * k, Offset(o.x + game.ballX * k, o.y + game.ballY * k))
}
@@ -149,7 +149,7 @@ internal fun BrickBreakScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> U
val bestBefore = remember(game.alive) { best }
val newBest = game.score > bestBefore && game.score > 0
BackHandler { if (game.alive) paused = !paused else onLeave() }
Row(Modifier.fillMaxSize().background(Navy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
Row(Modifier.fillMaxSize().background(NightNavy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
val native = event.nativeKeyEvent
if (paused || !game.alive) return@onPreviewKeyEvent false
val down = native.action == KeyEvent.ACTION_DOWN
@@ -164,19 +164,19 @@ internal fun BrickBreakScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> U
Column(Modifier.width(190.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("BRICK BREAK", color = Honey, fontFamily = Marquee, fontSize = 32.sp)
Spacer(Modifier.height(10.dp))
Text("SCORE", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("SCORE", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(game.score.toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Text("BEST", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("BEST", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(maxOf(best, game.score).toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Text("WALL ${game.level} · BALLS ${game.lives}", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)
Text("WALL ${game.level} · BALLS ${game.lives}", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)
Spacer(Modifier.weight(1f))
Text("◄► Hold to move", color = Muted, fontSize = 13.sp)
Text("OK Launch Back Pause", color = Muted, fontSize = 13.sp)
Text("◄► Hold to move", color = NightMuted, fontSize = 13.sp)
Text("OK Launch Back Pause", color = NightMuted, fontSize = 13.sp)
}
Box(Modifier.weight(1f).fillMaxHeight().border(2.dp, Blue), contentAlignment = Alignment.Center) {
Box(Modifier.weight(1f).fillMaxHeight().border(2.dp, NightBlue), contentAlignment = Alignment.Center) {
BrickField(game, Modifier.fillMaxSize().padding(6.dp))
if (game.alive && !game.launched && !paused) Text("Press OK to launch", Modifier.align(Alignment.BottomCenter).padding(bottom = 40.dp), color = Honey, fontSize = 16.sp)
if (paused || !game.alive) Column(Modifier.background(Navy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
if (paused || !game.alive) Column(Modifier.background(NightNavy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(if (game.alive) "PAUSED" else "GAME OVER", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
if (!game.alive && newBest) CastCheer()
if (!game.alive) Text(if (newBest) "New best: ${game.score}" else "Score: ${game.score}", color = Color.White, fontSize = 16.sp)
@@ -491,7 +491,7 @@ internal fun OrbManScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Unit)
BackHandler { if (game.alive) paused = !paused else onLeave() }
// The power glow breathes gently; with Reduce motion on it holds steady.
val glow = if (!game.powered) 0f else if (calm) .7f else .55f + .25f * sin(clock / 400.0).toFloat()
Row(Modifier.fillMaxSize().background(Navy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
Row(Modifier.fillMaxSize().background(NightNavy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
val native = event.nativeKeyEvent
if (native.action != KeyEvent.ACTION_DOWN || paused || !game.alive) return@onPreviewKeyEvent false
val dir = when (native.keyCode) {
@@ -506,14 +506,14 @@ internal fun OrbManScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Unit)
Column(Modifier.width(170.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("STAR CHASE", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
Spacer(Modifier.height(10.dp))
Text("SCORE", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("SCORE", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(game.score.toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Text("BEST", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("BEST", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(maxOf(best, game.score).toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Text("LEVEL ${game.level}", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("LEVEL ${game.level}", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Canvas(Modifier.height(30.dp).fillMaxWidth()) { repeat(game.lives) { drawOrbMascot(Offset(16f + it * 44f, size.height / 2), 11f) } }
Spacer(Modifier.height(8.dp))
Text("THE CAST", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("THE CAST", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
OrbCharacter.entries.forEach { who ->
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Canvas(Modifier.size(22.dp)) { drawOrbChaser(center, size.minDimension * .4f, who, OrbDir.Right, false, false, false, 0f) }
@@ -521,14 +521,14 @@ internal fun OrbManScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Unit)
}
}
Spacer(Modifier.weight(1f))
Text("◄►▲▼ Steer", color = Muted, fontSize = 13.sp)
Text("OK or Back Pause", color = Muted, fontSize = 13.sp)
Text("◄►▲▼ Steer", color = NightMuted, fontSize = 13.sp)
Text("OK or Back Pause", color = NightMuted, fontSize = 13.sp)
}
Box(Modifier.weight(1f).fillMaxHeight(), contentAlignment = Alignment.Center) {
Canvas(Modifier.fillMaxSize()) { drawOrbField(game, phase, glow, clock) }
if (game.alive && game.readyLeft > 0 && !paused) Text(if (game.tick == 0 && game.level == 1) "READY!" else if (game.score > 0 && game.stars.size + game.powers.size == game.maze.cells('.').size + game.maze.cells('o').size) "LEVEL ${game.level}" else "READY!",
Modifier.background(Navy.copy(alpha = .8f), RoundedCornerShape(6.dp)).padding(horizontal = 16.dp, vertical = 6.dp), color = Honey, fontFamily = Marquee, fontSize = 26.sp)
if (paused || !game.alive) Column(Modifier.background(Navy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Modifier.background(NightNavy.copy(alpha = .8f), RoundedCornerShape(6.dp)).padding(horizontal = 16.dp, vertical = 6.dp), color = Honey, fontFamily = Marquee, fontSize = 26.sp)
if (paused || !game.alive) Column(Modifier.background(NightNavy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(if (game.alive) "PAUSED" else "GAME OVER", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
if (!game.alive && newBest) CastCheer()
if (!game.alive) Text(if (newBest) "New best: ${game.score}" else "Score: ${game.score} · level ${game.level}", color = Color.White, fontSize = 16.sp)
@@ -76,10 +76,10 @@ private val Honey = Color(0xFFFFD84A)
private fun PairsCard(channel: Int, up: Boolean, matched: Boolean, selected: Boolean, modifier: Modifier) {
val turn by animateFloatAsState(if (up) 1f else 0f, tween(260), label = "turn")
Box(modifier.graphicsLayer { rotationY = 180f * (1 - turn); cameraDistance = 12 * density }
.background(if (turn > .5f) Color(0xFF0B1B44) else Panel, RoundedCornerShape(8.dp))
.border(if (selected) 3.dp else 1.dp, if (selected) Yellow else if (matched) Honey else Blue, RoundedCornerShape(8.dp)), contentAlignment = Alignment.Center) {
.background(if (turn > .5f) Color(0xFF0B1B44) else NightPanel, RoundedCornerShape(8.dp))
.border(if (selected) 3.dp else 1.dp, if (selected) NightYellow else if (matched) Honey else NightBlue, RoundedCornerShape(8.dp)), contentAlignment = Alignment.Center) {
if (turn > .5f) ChannelBrands.forNumber(channel)?.let { Image(painterResource(it.logo), it.displayName, Modifier.fillMaxSize().padding(10.dp).alpha(if (matched) .7f else 1f)) }
else Text("O", color = Muted.copy(alpha = .5f), fontFamily = Marquee, fontSize = 26.sp)
else Text("O", color = NightMuted.copy(alpha = .5f), fontFamily = Marquee, fontSize = 26.sp)
}
}
@@ -93,7 +93,7 @@ internal fun PairsScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Unit)
var newBest by remember { mutableStateOf(false) }
LaunchedEffect(game.done) { if (game.done) { newBest = best == 0 || game.moves < best; if (newBest) onBest(game.moves); menuFocus.requestFocus() } else focus.requestFocus() }
BackHandler(onBack = onLeave)
Row(Modifier.fillMaxSize().background(Navy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
Row(Modifier.fillMaxSize().background(NightNavy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
val native = event.nativeKeyEvent
if (native.action != KeyEvent.ACTION_DOWN || game.done) return@onPreviewKeyEvent false
val next = when (native.keyCode) {
@@ -110,14 +110,14 @@ internal fun PairsScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Unit)
Column(Modifier.width(190.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("PAIRS", color = Honey, fontFamily = Marquee, fontSize = 40.sp)
Spacer(Modifier.height(10.dp))
Text("MOVES", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("MOVES", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(game.moves.toString(), color = Color.White, fontFamily = Marquee, fontSize = 36.sp)
Text("BEST", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("BEST", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(if (best == 0) "–" else best.toString(), color = Color.White, fontFamily = Marquee, fontSize = 36.sp)
Text("PAIRS ${game.matched.size / 2} OF ${game.cards.size / 2}", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)
Text("PAIRS ${game.matched.size / 2} OF ${game.cards.size / 2}", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)
Spacer(Modifier.weight(1f))
Text("◄►▲▼ Move OK Turn", color = Muted, fontSize = 13.sp)
Text("Back Leave", color = Muted, fontSize = 13.sp)
Text("◄►▲▼ Move OK Turn", color = NightMuted, fontSize = 13.sp)
Text("Back Leave", color = NightMuted, fontSize = 13.sp)
}
Box(Modifier.weight(1f).fillMaxHeight(), contentAlignment = Alignment.Center) {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
@@ -128,7 +128,7 @@ internal fun PairsScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Unit)
}
}
}
if (game.done) Column(Modifier.background(Navy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
if (game.done) Column(Modifier.background(NightNavy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text("ALL PAIRED", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
if (newBest) CastCheer()
Text(if (newBest) "New best: ${game.moves} moves" else "${game.moves} moves", color = Color.White, fontSize = 16.sp)
@@ -123,16 +123,16 @@ private val CardH = 88.dp
@Composable
private fun CardFace(card: PlayingCard?, empty: String = "", modifier: Modifier = Modifier) {
Box(modifier.width(CardW).height(CardH).background(when { card == null -> Color(0x22FFFFFF); card.up -> Color(0xFFF4F6FB); else -> Panel }, RoundedCornerShape(6.dp))
.border(1.dp, if (card?.up == false) Blue else Color(0x55FFFFFF), RoundedCornerShape(6.dp)).padding(5.dp)) {
Box(modifier.width(CardW).height(CardH).background(when { card == null -> Color(0x22FFFFFF); card.up -> Color(0xFFF4F6FB); else -> NightPanel }, RoundedCornerShape(6.dp))
.border(1.dp, if (card?.up == false) NightBlue else Color(0x55FFFFFF), RoundedCornerShape(6.dp)).padding(5.dp)) {
when {
card == null -> Text(empty, Modifier.align(Alignment.Center), color = Muted.copy(alpha = .6f), fontSize = 14.sp)
card == null -> Text(empty, Modifier.align(Alignment.Center), color = NightMuted.copy(alpha = .6f), fontSize = 14.sp)
card.up -> {
val colour = if (card.red) Color(0xFFD32F2F) else Color(0xFF0B1B44)
Text(card.label, color = colour, fontSize = 15.sp, fontWeight = FontWeight.Bold)
Text("♠♥♦♣"[card.suit].toString(), Modifier.align(Alignment.Center), color = colour, fontSize = 26.sp)
}
else -> Text("O", Modifier.align(Alignment.Center), color = Muted.copy(alpha = .5f), fontFamily = Marquee, fontSize = 20.sp)
else -> Text("O", Modifier.align(Alignment.Center), color = NightMuted.copy(alpha = .5f), fontFamily = Marquee, fontSize = 20.sp)
}
}
}
@@ -163,16 +163,16 @@ internal fun PatienceScreen(wins: Int, onWin: () -> Unit, onLeave: () -> Unit) {
Column(Modifier.width(170.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("PATIENCE", color = Honey, fontFamily = Marquee, fontSize = 34.sp)
Spacer(Modifier.height(10.dp))
Text("MOVES", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("MOVES", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(game.moves.toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Text("GAMES WON", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text("GAMES WON", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(wins.toString(), color = Color.White, fontFamily = Marquee, fontSize = 32.sp)
Spacer(Modifier.weight(1f))
Text("◄►▲▼ Point", color = Muted, fontSize = 13.sp)
Text("OK Pick up / put down", color = Muted, fontSize = 13.sp)
Text("▲▼ in a column: how many", color = Muted, fontSize = 13.sp)
Text("Back Put back / leave", color = Muted, fontSize = 13.sp)
Text("Menu Send a card home", color = Muted, fontSize = 13.sp)
Text("◄►▲▼ Point", color = NightMuted, fontSize = 13.sp)
Text("OK Pick up / put down", color = NightMuted, fontSize = 13.sp)
Text("▲▼ in a column: how many", color = NightMuted, fontSize = 13.sp)
Text("Back Put back / leave", color = NightMuted, fontSize = 13.sp)
Text("Menu Send a card home", color = NightMuted, fontSize = 13.sp)
}
Box(Modifier.weight(1f).fillMaxHeight()) {
Column(verticalArrangement = Arrangement.spacedBy(14.dp)) {
@@ -181,7 +181,7 @@ internal fun PatienceScreen(wins: Int, onWin: () -> Unit, onLeave: () -> Unit) {
if (i < 0) Spacer(Modifier.width(CardW)) else {
val pointed = game.pile == i; val holding = game.held?.first == i
CardFace(game.piles[i].lastOrNull()?.let { if (i == STOCK) it.copy(up = false) else it }, if (i == STOCK) "↺" else if (i in HOMES) "A" else "",
Modifier.border(if (pointed) 3.dp else 0.dp, if (holding) Honey else Yellow, RoundedCornerShape(6.dp)))
Modifier.border(if (pointed) 3.dp else 0.dp, if (holding) Honey else NightYellow, RoundedCornerShape(6.dp)))
}
}
}
@@ -191,17 +191,17 @@ internal fun PatienceScreen(wins: Int, onWin: () -> Unit, onLeave: () -> Unit) {
val pointed = game.pile == c
val chosen = if (game.held?.first == c) game.held!!.second else if (pointed) game.depth else 0
Box(Modifier.width(CardW).height(CardH + 22.dp * 12)) {
if (cards.isEmpty()) CardFace(null, "K", Modifier.border(if (pointed) 3.dp else 0.dp, Yellow, RoundedCornerShape(6.dp)))
if (cards.isEmpty()) CardFace(null, "K", Modifier.border(if (pointed) 3.dp else 0.dp, NightYellow, RoundedCornerShape(6.dp)))
cards.forEachIndexed { n, card ->
val inRun = n >= cards.size - chosen
CardFace(card, modifier = Modifier.offset(y = (if (card.up) 22.dp else 12.dp) * n - offsetFix(cards, n))
.border(if (inRun) 3.dp else 0.dp, if (game.held?.first == c) Honey else Yellow, RoundedCornerShape(6.dp)))
.border(if (inRun) 3.dp else 0.dp, if (game.held?.first == c) Honey else NightYellow, RoundedCornerShape(6.dp)))
}
}
}
}
}
if (game.won) Column(Modifier.align(Alignment.Center).background(Navy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
if (game.won) Column(Modifier.align(Alignment.Center).background(NightNavy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text("WON!", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
Text("In ${game.moves} moves", color = Color.White, fontSize = 16.sp)
OrbitButton("Deal again", Modifier.width(200.dp).focusRequester(menuFocus), onClick = { game = PatienceGame.deal(random) })
@@ -155,7 +155,7 @@ internal fun DrawScope.drawSkyBoard(game: SkyGame, showCursor: Boolean = true) {
val regions = game.puzzle.regions
for (i in regions.indices) {
val at = origin + Offset(i % SKY_SIZE * cell, i / SKY_SIZE * cell)
drawRect(Navy, at, Size(cell, cell))
drawRect(NightNavy, at, Size(cell, cell))
drawRect(SkyColours[regions[i]].copy(alpha = .42f), at, Size(cell, cell))
if (i in game.placed) drawSkyFace(regions[i], at + Offset(cell / 2, cell / 2), cell * .36f)
else if (i in game.crossed) {
@@ -175,7 +175,7 @@ internal fun DrawScope.drawSkyBoard(game: SkyGame, showCursor: Boolean = true) {
drawRoundRect(Color.White, origin, Size(cell * SKY_SIZE, cell * SKY_SIZE), CornerRadius(cell * .08f), style = Stroke(cell * .07f))
if (showCursor && !game.done && !game.out) {
val at = origin + Offset(game.cursor % SKY_SIZE * cell, game.cursor / SKY_SIZE * cell)
drawRoundRect(Yellow, at + Offset(cell * .05f, cell * .05f), Size(cell * .9f, cell * .9f), CornerRadius(cell * .12f), style = Stroke(cell * .08f))
drawRoundRect(NightYellow, at + Offset(cell * .05f, cell * .05f), Size(cell * .9f, cell * .9f), CornerRadius(cell * .12f), style = Stroke(cell * .08f))
}
}
@@ -191,7 +191,7 @@ internal fun SkydokuScreen(solved: Int, dailyDone: Boolean, onSolved: (daily: Bo
LaunchedEffect(game.done) { if (game.done) onSolved(daily) }
LaunchedEffect(paused, game.done, game.out) { if (paused || game.done || game.out) menuFocus.requestFocus() else focus.requestFocus() }
BackHandler { if (!game.done && !game.out) paused = !paused else onLeave() }
Row(Modifier.fillMaxSize().background(Navy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
Row(Modifier.fillMaxSize().background(NightNavy).padding(20.dp).focusRequester(focus).focusable().onPreviewKeyEvent { event ->
val native = event.nativeKeyEvent
if (native.action != KeyEvent.ACTION_DOWN || paused || game.done || game.out) return@onPreviewKeyEvent false
game = when (native.keyCode) {
@@ -206,7 +206,7 @@ internal fun SkydokuScreen(solved: Int, dailyDone: Boolean, onSolved: (daily: Bo
}, horizontalArrangement = Arrangement.spacedBy(20.dp)) {
Column(Modifier.width(200.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("SKYDOKU", color = Honey, fontFamily = Marquee, fontSize = 32.sp)
Text(if (daily) "TODAY'S PUZZLE" else "NEW PUZZLE", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(if (daily) "TODAY'S PUZZLE" else "NEW PUZZLE", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Canvas(Modifier.height(26.dp).fillMaxWidth()) {
repeat(SKY_HEARTS) { k ->
val c = Offset(13f + k * 34f, size.height / 2)
@@ -214,17 +214,17 @@ internal fun SkydokuScreen(solved: Int, dailyDone: Boolean, onSolved: (daily: Bo
val heart = androidx.compose.ui.graphics.Path().apply {
moveTo(c.x, c.y + 9f); cubicTo(c.x - 16f, c.y - 2f, c.x - 7f, c.y - 13f, c.x, c.y - 5f); cubicTo(c.x + 7f, c.y - 13f, c.x + 16f, c.y - 2f, c.x, c.y + 9f); close()
}
if (full) drawPath(heart, Color(0xFFFF6B8A)) else drawPath(heart, Muted.copy(alpha = .5f), style = Stroke(2f))
if (full) drawPath(heart, Color(0xFFFF6B8A)) else drawPath(heart, NightMuted.copy(alpha = .5f), style = Stroke(2f))
}
}
Spacer(Modifier.height(4.dp))
Text("Put each of the cast in their own colour.", color = Color.White, fontSize = 14.sp)
Text("One in every row and column, and no two touching, not even at the corners.", color = Muted, fontSize = 13.sp)
Text("SOLVED", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp, modifier = Modifier.padding(top = 6.dp))
Text("One in every row and column, and no two touching, not even at the corners.", color = NightMuted, fontSize = 13.sp)
Text("SOLVED", color = NightMuted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp, modifier = Modifier.padding(top = 6.dp))
Text(solved.toString(), color = Color.White, fontFamily = Marquee, fontSize = 28.sp)
Spacer(Modifier.weight(1f))
Text("◄►▲▼ Move OK Place", color = Muted, fontSize = 13.sp)
Text("Back Pause", color = Muted, fontSize = 13.sp)
Text("◄►▲▼ Move OK Place", color = NightMuted, fontSize = 13.sp)
Text("Back Pause", color = NightMuted, fontSize = 13.sp)
}
Box(Modifier.weight(1f).fillMaxHeight(), contentAlignment = Alignment.Center) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
@@ -234,10 +234,10 @@ internal fun SkydokuScreen(solved: Int, dailyDone: Boolean, onSolved: (daily: Bo
val region = game.puzzle.regions[game.cursor]
Canvas(Modifier.size(72.dp)) { drawCircle(SkyColours[region].copy(alpha = .35f), size.minDimension / 2); drawSkyFace(region, center, size.minDimension * .4f) }
Text(SkyCast[region], color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.SemiBold)
Text("goes here?", color = Muted, fontSize = 12.sp)
Text("goes here?", color = NightMuted, fontSize = 12.sp)
}
}
if (paused || game.done || game.out) Column(Modifier.background(Navy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
if (paused || game.done || game.out) Column(Modifier.background(NightNavy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(if (game.done) "SOLVED!" else if (game.out) "OUT OF HEARTS" else "PAUSED", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
if (game.done) CastCheer()
if (game.out) Text("Every puzzle can be solved by logic alone.", color = Color.White, fontSize = 14.sp)
@@ -149,7 +149,7 @@ private fun TonightLowerThird(title: String, t: Long) {
if (u <= 0f) return
Box(Modifier.fillMaxSize()) {
Row(Modifier.align(Alignment.BottomStart).padding(start = 40.dp, bottom = 34.dp).fillMaxWidth(.62f)
.graphicsLayer { alpha = u; translationY = (1 - u) * 14f }.background(Navy.copy(alpha = .82f))) {
.graphicsLayer { alpha = u; translationY = (1 - u) * 14f }.background(NightNavy.copy(alpha = .82f))) {
Box(Modifier.width(5.dp).height(64.dp).background(Color(0xFFE21E30)))
Column(Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) {
Text("TONIGHT", color = Color(0xFFFFD278), fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 3.sp)
@@ -111,7 +111,7 @@ internal fun TotsBumper(mood: TotsMood, modifier: Modifier = Modifier) {
private fun TotsTitle(line: String?, shown: Float, modifier: Modifier, soft: Boolean) {
if (shown <= 0f) return
Column(modifier, horizontalAlignment = Alignment.CenterHorizontally) {
Text("ORBIT", color = (if (soft) Color(0xFFD5DCEA) else Navy).copy(alpha = shown), fontSize = 16.sp, letterSpacing = 6.sp)
Text("ORBIT", color = (if (soft) Color(0xFFD5DCEA) else NightNavy).copy(alpha = shown), fontSize = 16.sp, letterSpacing = 6.sp)
Text(buildAnnotatedString {
"TOTS".forEachIndexed { i, c -> withStyle(SpanStyle(color = TotsLetters[i].copy(alpha = shown * if (soft) .85f else 1f))) { append(c) } }
}, fontFamily = Anton, fontSize = 54.sp)
@@ -41,8 +41,8 @@ internal const val CATCH_UP_SKIP_MS = 30_000L
internal const val JUST_MISSED_MS = 3 * 60 * 60_000L
private const val SHELF_MAX = 30
internal val CatchUpGreen = Color(0xFF6EDCAA)
private val CatchUpDim = Color(0xFF0C2046)
internal val CatchUpGreen: Color get() = if (OrbitTheme.look == OrbitLook.Night) Color(0xFF6EDCAA) else Mint
private val CatchUpDim: Color get() = OrbitTheme.palette.dim
/** The earliest moment [channel] can be caught up from: its plan's first programme inside the last two days, else now. */
internal fun catchUpEarliest(channel: SampleChannel, nowMs: Long): Long =
@@ -110,20 +110,20 @@ internal fun CatchUpCard(entry: CatchUpEntry, nowMs: Long, onWatch: () -> Unit,
val corner = RoundedCornerShape(12.dp)
val watchFocus = remember { FocusRequester() }
LaunchedEffect(Unit) { watchFocus.requestFocus() }
Column(Modifier.width(560.dp).background(Color(0xFF0A1E42), corner).border(2.dp, Yellow, corner).padding(24.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Column(Modifier.width(560.dp).background(themed(Color(0xFF0A1E42)) { Deep }, corner).border(2.dp, Yellow, corner).padding(24.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text("CATCH UP", color = CatchUpGreen, fontFamily = Anton, fontSize = 18.sp)
Spacer(Modifier.weight(1f))
Text("${entry.channel.number} ${ChannelBrands.displayName(entry.channel).uppercase()}", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)
}
val (name, detail) = guideTitleParts(entry.show.media.item.title)
Text(name.uppercase(), color = Color.White, fontFamily = Anton, fontSize = 34.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
if (detail != null) Text(detail, color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(name.uppercase(), color = Ink, fontFamily = Anton, fontSize = 34.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
if (detail != null) Text(detail, color = Ink, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text("Aired ${guideDayPrefix(entry.show.startMs, nowMs).trim().ifEmpty { "today" }} ${clock(entry.show.startMs)} to ${clock(entry.show.endMs)} • ${entry.show.media.durationMs / 60_000} min • " +
"watchable until ${guideDayPrefix(entry.untilMs, nowMs).trim().ifEmpty { "today" }} ${clock(entry.untilMs)}", color = Muted, fontSize = 13.sp)
entry.next?.let { next ->
Text(if (entry.continues) "${guideTitleParts(next.media.item.title).let { it.second ?: it.first }} carries straight on after it, as it aired."
else "Then the channel carries on as it aired: ${guideTitleParts(next.media.item.title).first} at ${clock(next.startMs)}.", color = Color.White, fontSize = 14.sp, maxLines = 2)
else "Then the channel carries on as it aired: ${guideTitleParts(next.media.item.title).first} at ${clock(next.startMs)}.", color = Ink, fontSize = 14.sp, maxLines = 2)
}
Spacer(Modifier.height(8.dp))
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
@@ -151,7 +151,7 @@ internal fun CatchUpScreen(channels: List<SampleChannel>, modifier: Modifier = M
Text("CATCH UP", color = CatchUpGreen, fontFamily = Anton, fontSize = 26.sp)
Text("Anything shown on Orbit in the last two days, from the start", color = Muted, fontSize = 14.sp)
if (shelves.isEmpty()) {
Text("Nothing to catch up on yet. Programmes appear here once they've aired.", color = Color.White, fontSize = 16.sp,
Text("Nothing to catch up on yet. Programmes appear here once they've aired.", color = Ink, fontSize = 16.sp,
modifier = Modifier.focusRequester(focus).focusProperties { if (nav != null) up = nav }.focusable())
return@Column
}
@@ -193,7 +193,7 @@ internal fun CatchUpScreen(channels: List<SampleChannel>, modifier: Modifier = M
private fun CatchUpTile(entry: CatchUpEntry, nowMs: Long, on: Boolean, modifier: Modifier) {
val corner = RoundedCornerShape(6.dp)
// Focused as on What's On: navy inside a gold ring, so the words stay crisp rather than washed out in gold.
val ink = Color.White
val ink = Ink
Column(modifier.height(92.dp).background(if (on) Navy else Panel, corner).border(if (on) 3.dp else 0.dp, if (on) Yellow else Color.Transparent, corner).padding(horizontal = 10.dp, vertical = 7.dp), verticalArrangement = Arrangement.spacedBy(2.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
val mark = ChannelBrands.forNumber(entry.channel.number)
@@ -213,7 +213,7 @@ private fun CatchUpTile(entry: CatchUpEntry, nowMs: Long, on: Boolean, modifier:
/** The badge in the corner while catching up. */
@Composable
internal fun CatchUpBadge(modifier: Modifier = Modifier) {
Text("CATCH UP", modifier.background(CatchUpGreen, RoundedCornerShape(5.dp)).padding(horizontal = 12.dp, vertical = 4.dp), color = Navy, fontFamily = Anton, fontSize = 18.sp)
Text("CATCH UP", modifier.background(CatchUpGreen, RoundedCornerShape(5.dp)).padding(horizontal = 12.dp, vertical = 4.dp), color = OnAccent, fontFamily = Anton, fontSize = 18.sp)
}
/** True while a channel is being replayed from the past. */
@@ -238,7 +238,7 @@ internal fun DriftWaiting(modifier: Modifier = Modifier) {
drawOrbChaser(center + androidx.compose.ui.geometry.Offset(0f, bob), size.minDimension * .36f, OrbCharacter.Drift, OrbDir.Right, false, false, false, t / 500f)
}
Column {
Text("Drift's fetching it", color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
Text("Drift's fetching it", color = Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
Text("Just a moment" + if (calm) "…" else ".".repeat(1 + (t / 500 % 3).toInt()), color = Muted, fontSize = 12.sp)
}
}
@@ -97,7 +97,7 @@ internal fun SuggestionsScreen(programming: ChannelProgramming, suggestions: Lis
onToggle: (String) -> Unit, onAll: (Boolean) -> Unit, onSave: (Boolean) -> Unit, onBack: () -> Unit) {
BackHandler(onBack = onBack)
Column(modifier.fillMaxWidth().background(Navy).padding(14.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("${programming.number} ${programming.name} suggestions", color = Color.White, fontSize = 20.sp)
Text("${programming.number} ${programming.name} suggestions", color = Ink, fontSize = 20.sp)
Text("${ticked.size} of ${suggestions.size} ticked. Anything you untick won't be suggested again.", color = Muted, fontSize = 13.sp)
message?.let { Text(it, color = Yellow, fontSize = 13.sp, maxLines = 3) }
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
@@ -112,7 +112,7 @@ internal fun SuggestionsScreen(programming: ChannelProgramming, suggestions: Lis
Row(Modifier.fillMaxWidth().background(Panel).padding(horizontal = 8.dp, vertical = 3.dp), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
OrbitButton(if (suggestion.id in ticked) "✓ In" else "Out", Modifier.width(70.dp), selected = suggestion.id in ticked, enabled = !busy, onClick = { onToggle(suggestion.id) })
Column(Modifier.weight(1f)) {
Text(suggestion.title + (suggestion.year?.let { " ($it)" } ?: ""), color = Color.White, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(suggestion.title + (suggestion.year?.let { " ($it)" } ?: ""), color = Ink, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(suggestion.reason, color = Muted, fontSize = 11.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
@@ -25,27 +25,27 @@ internal fun ClassicProgrammeStrip(item: SampleItem, playing: Boolean, modifier:
val paper = Color(0xFFE8EDF5)
Column(modifier.border(1.dp, paper)) {
Row(Modifier.fillMaxWidth().background(paper).padding(horizontal = 12.dp, vertical = 3.dp), verticalAlignment = Alignment.CenterVertically) {
Text(scheduled?.let { "${it.channel.number} ${ChannelBrands.displayName(it.channel)}${if (it.catchingUp()) " / Catch Up" else if (it.clockOffsetMs != 0L) " / Transition check" else ""}" } ?: "Orbit Preview", color = Navy, fontWeight = FontWeight.Bold, fontSize = 14.sp)
Text(scheduled?.let { "${it.channel.number} ${ChannelBrands.displayName(it.channel)}${if (it.catchingUp()) " / Catch Up" else if (it.clockOffsetMs != 0L) " / Transition check" else ""}" } ?: "Orbit Preview", color = NightNavy, fontWeight = FontWeight.Bold, fontSize = 14.sp)
Spacer(Modifier.weight(1f))
Text(SimpleDateFormat("HH:mm EEE d MMM", Locale.UK).format(Date(now)), color = Navy, fontSize = 13.sp)
Text(SimpleDateFormat("HH:mm EEE d MMM", Locale.UK).format(Date(now)), color = NightNavy, fontSize = 13.sp)
}
Column(Modifier.fillMaxWidth().background(Blue).padding(horizontal = 14.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(3.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
val catching = scheduled?.catchingUp() == true
Text(if (catching) (if (playing) "FROM START" else "PAUSED") else if (playing || scheduled != null) "NOW" else "PAUSED", Modifier.width(70.dp), color = Yellow, fontWeight = FontWeight.Bold, fontSize = 14.sp)
Text(item.title, color = Color.White, fontWeight = FontWeight.Bold, fontSize = 20.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(item.title, color = Ink, fontWeight = FontWeight.Bold, fontSize = 20.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
Row(verticalAlignment = Alignment.CenterVertically) {
if (scheduled != null && scheduled.catchingUp()) {
// How far in, and what's on the channel live meanwhile.
val into = scheduled.programme.offsetAt(scheduled.nowMs())
Text("${minutesSeconds(into)} of ${minutesSeconds(scheduled.programme.media.durationMs)}", Modifier.width(150.dp), color = Muted, fontWeight = FontWeight.Bold, fontSize = 13.sp)
Text("Live now: ${guideTitleParts(scheduled.channel.at(now).media.item.title).first}", color = Color.White, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text("Live now: ${guideTitleParts(scheduled.channel.at(now).media.item.title).first}", color = Ink, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
return@Row
}
Text(if (scheduled == null) "INFO" else "NEXT", Modifier.width(70.dp), color = Muted, fontWeight = FontWeight.Bold, fontSize = 13.sp)
Text(scheduled?.let { "${clock(it.next.startMs)} ${it.next.media.item.title}" } ?: listOf(item.type, item.minutes?.let { "$it min" }.orEmpty()).filter { it.isNotBlank() }.joinToString(" • "),
color = Color.White, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
color = Ink, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
Row(Modifier.fillMaxWidth().background(paper).padding(horizontal = 14.dp, vertical = 5.dp),
@@ -68,8 +68,8 @@ internal fun ClassicProgrammeStrip(item: SampleItem, playing: Boolean, modifier:
@Composable
private fun Legend(icon: String, label: String) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Text(icon, color = Navy, fontSize = 16.sp, fontWeight = FontWeight.Bold)
Text(label, color = Navy, fontSize = 14.sp, fontWeight = FontWeight.Bold)
Text(icon, color = NightNavy, fontSize = 16.sp, fontWeight = FontWeight.Bold)
Text(label, color = NightNavy, fontSize = 14.sp, fontWeight = FontWeight.Bold)
}
}
@@ -375,11 +375,13 @@ internal fun dropFromChair(store: ScheduleStore, id: String, title: String, type
internal class ChairChoice(val title: String, val id: String, val type: String, val year: Int?, val tag: String?, val line: String, val options: List<DeskOption>, val ask: Boolean,
val firstRun: DeskOption? = null)
private val ChairNavy = Color(0xFF07163A)
private val ChairPanel = Color(0xFF10285A)
private val ChairGold = Color(0xFFF2C14E)
private val ChairMint = Color(0xFF6EDCAA)
private val ChairSky = Color(0xFF78BEFF)
private val ChairNavy: Color get() = OrbitTheme.palette.chairPage
/** Text on the Chair's gold and mint. */
private val ChairOnGold: Color get() = if (OrbitTheme.look == OrbitLook.Night) Color(0xFF07163A) else OnAccent
private val ChairPanel: Color get() = OrbitTheme.palette.chairPanel
private val ChairGold: Color get() = Gold
private val ChairMint: Color get() = if (OrbitTheme.look == OrbitLook.Night) Color(0xFF6EDCAA) else Mint
private val ChairSky: Color get() = if (OrbitTheme.look == OrbitLook.Night) Color(0xFF78BEFF) else Sky
/**
* Settings › Director's Chair. Press a pick or an ask for its pop-up: place it on the suggested channel or another that fits,
@@ -415,8 +417,8 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
var focused by remember { mutableStateOf(false) }
Text(m.label, Modifier.then(if (i == 1) Modifier.focusRequester(first) else Modifier).onFocusChanged { focused = it.isFocused }
.clickable { mode = m }
.background(if (m == mode) ChairGold else ChairPanel, RoundedCornerShape(12.dp)).border(if (focused) 2.dp else 0.dp, Color.White, RoundedCornerShape(12.dp))
.padding(horizontal = 10.dp, vertical = 3.dp), color = if (m == mode) ChairNavy else Color.White, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
.background(if (m == mode) ChairGold else ChairPanel, RoundedCornerShape(12.dp)).border(if (focused) 2.dp else 0.dp, Ink, RoundedCornerShape(12.dp))
.padding(horizontal = 10.dp, vertical = 3.dp), color = if (m == mode) ChairOnGold else Ink, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
}
Spacer(Modifier.width(8.dp))
Text("Auto-approval: OFF", color = ChairMint, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
@@ -425,17 +427,17 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
var learnFocused by remember { mutableStateOf(false) }
Text("Learning: " + if (learningOn) "ON" else "OFF", Modifier.onFocusChanged { learnFocused = it.isFocused }
.clickable { scope.launch { setLearning(!learningOn); said = if (learningOn) "Learning off: suggestions come from the channel briefs alone." else "Learning on: what it's learned from your decisions now shapes the suggestions."; version++ } }
.background(if (learningOn) ChairMint else ChairPanel, RoundedCornerShape(12.dp)).border(if (learnFocused) 2.dp else 0.dp, Color.White, RoundedCornerShape(12.dp))
.padding(horizontal = 10.dp, vertical = 3.dp), color = if (learningOn) ChairNavy else Color.White, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
.background(if (learningOn) ChairMint else ChairPanel, RoundedCornerShape(12.dp)).border(if (learnFocused) 2.dp else 0.dp, Ink, RoundedCornerShape(12.dp))
.padding(horizontal = 10.dp, vertical = 3.dp), color = if (learningOn) ChairOnGold else Ink, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
}
val r = report
if (r == null) { Text("Working out this week's report. The first time takes a little while; after that the Chair opens straight away.", color = Muted, fontSize = 12.sp); return@Column }
// Each column scrolls on its own, following the focus, so nothing sits below the screen out of reach.
Row(Modifier.fillMaxWidth().weight(1f), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Column(Modifier.weight(.9f).verticalScroll(rememberScrollState()).background(ChairPanel, RoundedCornerShape(8.dp)).padding(10.dp), verticalArrangement = Arrangement.spacedBy(3.dp)) {
Text("THIS WEEK", color = Color.White, fontFamily = Anton, fontSize = 14.sp)
Text("THIS WEEK", color = Ink, fontFamily = Anton, fontSize = 14.sp)
Text("${r.newlyReleased} newly released", color = ChairGold, fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
Text("${r.newToLibrary} new to the library (14 days)", color = Color.White, fontSize = 11.sp)
Text("${r.newToLibrary} new to the library (14 days)", color = Ink, fontSize = 11.sp)
Text("${r.strong} strong matches", color = ChairMint, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
r.strongByChannel.take(6).forEach { (c, n) -> Text("$c $n", color = Muted, fontSize = 11.sp) }
if (r.strongByChannel.size > 6) Text("+${r.strongByChannel.size - 6} more channels", color = Muted, fontSize = 11.sp)
@@ -448,7 +450,7 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
Text(if (gaps.isEmpty()) "Scan complete: ${r.scanned} read, ${r.franchises} franchise collections" else "Scan: " + gaps.joinToString("; "), color = if (gaps.isEmpty()) Muted else ChairGold, fontSize = 10.sp)
}
Column(Modifier.weight(1.3f).verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(5.dp)) {
Text("WORTH A LOOK", color = Color.White, fontFamily = Anton, fontSize = 14.sp)
Text("WORTH A LOOK", color = Ink, fontFamily = Anton, fontSize = 14.sp)
// Orbit Premiere's proposals, at most three a week, apart from the channel picks.
r.premieres.filter { it.id !in decided }.forEach { p ->
ChairCard("ORBIT PREMIERE", p.title, p.home?.name?.uppercase(java.util.Locale.UK)?.let { "THEN $it" } ?: p.after.uppercase(java.util.Locale.UK),
@@ -468,16 +470,16 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
onClick = { open = ChairChoice(p.title, p.id, p.type, p.year, p.tag, p.line, p.options, false, p.firstRun) }.takeIf { p.options.isNotEmpty() && p.id.isNotEmpty() }) }
}
Column(Modifier.weight(1f).verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(5.dp)) {
Text("NEEDS YOUR EYE", color = Color.White, fontFamily = Anton, fontSize = 14.sp)
Text("NEEDS YOUR EYE", color = Ink, fontFamily = Anton, fontSize = 14.sp)
val asks = r.asks.filter { it.id !in decided }
if (asks.isEmpty()) Text("No either-or calls this week.", color = Muted, fontSize = 12.sp)
asks.forEach { a -> ChairCard(null, a.title, null, "${a.first} or ${a.second}?",
onClick = { open = ChairChoice(a.title, a.id, a.type, a.year, null, a.line, a.options, true, a.firstRun) }.takeIf { a.options.isNotEmpty() && a.id.isNotEmpty() }) }
Spacer(Modifier.height(4.dp))
Text("RULES IN FORCE", color = Color.White, fontFamily = Anton, fontSize = 13.sp)
Text("RULES IN FORCE", color = Ink, fontFamily = Anton, fontSize = 13.sp)
DirectorRules.forEach { Text("· $it", color = Muted, fontSize = 10.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) }
Spacer(Modifier.height(4.dp))
Text("WHAT IT'S LEARNED", color = Color.White, fontFamily = Anton, fontSize = 13.sp)
Text("WHAT IT'S LEARNED", color = Ink, fontFamily = Anton, fontSize = 13.sp)
Text(r.learnedSummary.ifEmpty { "No decisions yet." }, color = Muted, fontSize = 10.sp)
if (r.lessons.isEmpty()) Text("Nothing to change yet: a pattern needs decisions that share something specific.", color = Muted, fontSize = 10.sp)
r.lessons.take(4).forEach { l ->
@@ -495,9 +497,9 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
LaunchedEffect(Unit) { runCatching { first.requestFocus() } }
Column(Modifier.width(600.dp).background(ChairNavy, RoundedCornerShape(10.dp)).border(2.dp, ChairGold, RoundedCornerShape(10.dp)).padding(20.dp), verticalArrangement = Arrangement.spacedBy(7.dp)) {
Text("DRIVE-IN EVENT IDEA", color = ChairGold, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
Text(idea.theme.uppercase(java.util.Locale.UK), color = Color.White, fontFamily = Anton, fontSize = 26.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(idea.theme.uppercase(java.util.Locale.UK), color = Ink, fontFamily = Anton, fontSize = 26.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text("${idea.format} · ${idea.evening}", color = ChairSky, fontSize = 13.sp)
idea.films.forEachIndexed { i, f -> Text("${i + 1}. $f", color = Color.White, fontSize = 13.sp) }
idea.films.forEachIndexed { i, f -> Text("${i + 1}. $f", color = Ink, fontSize = 13.sp) }
idea.reasons.forEach { Text("· $it", color = Muted, fontSize = 11.sp) }
Text(if (idea.decision == "approved") "Approved: it books like the Drive-In's other events once the Drive-In plans that evening (about a week ahead), after every film is checked on the box again. Nothing already booked changes."
else "Checked on the box: every film is the right library item with a copy this box can play, rested, not booked elsewhere around the evening, and nothing competes for the night. Approve books it like the Drive-In's other events; Defer brings it back in four weeks; Dismiss drops it.",
@@ -520,7 +522,7 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
LaunchedEffect(Unit) { runCatching { first.requestFocus() } }
Column(Modifier.width(560.dp).background(ChairNavy, RoundedCornerShape(10.dp)).border(2.dp, ChairGold, RoundedCornerShape(10.dp)).padding(20.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(if (l.state == "confirmed") "CONFIRMED LESSON" else "PROPOSED LESSON", color = ChairGold, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
Text(l.text, color = Color.White, fontSize = 15.sp)
Text(l.text, color = Ink, fontSize = 15.sp)
Text("Confirmed, it shapes suggestions while learning is on. It never changes a channel's rules or anything booked.", color = Muted, fontSize = 11.sp)
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
if (l.state != "confirmed") OrbitButton("Confirm", Modifier.focusRequester(first), onClick = { lesson = null; scope.launch { decideLesson(l.key, true); said = "Lesson confirmed."; version++ } })
@@ -555,9 +557,9 @@ private fun ChairPopup(choice: ChairChoice, onPlace: (DeskOption) -> Unit, onDro
Column(Modifier.width(620.dp).background(ChairNavy, RoundedCornerShape(10.dp)).border(2.dp, ChairGold, RoundedCornerShape(10.dp)).padding(20.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(if (choice.ask) "NEEDS YOUR EYE" else choice.tag ?: "WORTH A LOOK", color = ChairGold, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
Text(choice.title.uppercase(java.util.Locale.UK), color = Color.White, fontFamily = Anton, fontSize = 28.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(choice.title.uppercase(java.util.Locale.UK), color = Ink, fontFamily = Anton, fontSize = 28.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(listOfNotNull(choice.year?.toString(), if (choice.type == "Series") "Series" else "Film").joinToString(" · "), color = ChairSky, fontSize = 12.sp)
Text(choice.line, color = Color.White, fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(choice.line, color = Ink, fontSize = 13.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
// Two recommendations, not one: the first-run event on Premiere, then the film's genre home.
val home = choice.options.firstOrNull()
if (choice.firstRun != null) Row(Modifier.fillMaxWidth().background(ChairPanel, RoundedCornerShape(6.dp)).border(1.dp, ChairGold, RoundedCornerShape(6.dp)).padding(10.dp),
@@ -604,10 +606,10 @@ private fun ChairPopup(choice: ChairChoice, onPlace: (DeskOption) -> Unit, onDro
private fun ChairCard(tag: String?, title: String, channel: String?, line: String, onClick: (() -> Unit)? = null) {
var focused by remember { mutableStateOf(false) }
Column(Modifier.fillMaxWidth().onFocusChanged { focused = it.isFocused }.then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier.focusable())
.background(if (focused) Color(0xFF1C3A70) else ChairPanel, RoundedCornerShape(6.dp))
.background(if (focused) themed(Color(0xFF1C3A70)) { Blue } else ChairPanel, RoundedCornerShape(6.dp))
.border(if (focused) 2.dp else 0.dp, ChairGold, RoundedCornerShape(6.dp)).padding(horizontal = 8.dp, vertical = 5.dp)) {
Row { tag?.let { Text(it, Modifier.weight(1f), color = ChairGold, fontSize = 9.sp, fontWeight = FontWeight.SemiBold) }; channel?.let { Text(it, color = ChairSky, fontSize = 9.sp, fontWeight = FontWeight.SemiBold) } }
Text(title, color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(title, color = Ink, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(line, color = if (tag == null) ChairGold else Muted, fontSize = 10.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
}
}
@@ -259,7 +259,6 @@ internal fun driveInReminderDue(bills: List<DriveInBill>, tickets: Map<Long, Int
internal fun liveTickets(tickets: Map<Long, Int>, nowMs: Long) = tickets.filterKeys { it > nowMs - 24 * 60 * 60_000L }
private val Marquee = FontFamily(Font(R.font.anton_regular))
private val Gold = Color(0xFFF2C14E)
@Composable
internal fun rememberFilmPicture(session: EmbySampleSession, itemId: String?): Bitmap? {
@@ -282,17 +281,17 @@ private fun DriveInTicket(bill: DriveInBill, nowMs: Long, ticketed: Boolean, onT
val firstButton = remember { FocusRequester() }
LaunchedEffect(ticketed) { firstButton.requestFocus() }
Box(Modifier.fillMaxSize().background(Color.Black.copy(alpha = .6f)), contentAlignment = Alignment.Center) {
Row(Modifier.width(640.dp).height(290.dp).background(Color(0xFF0E2147)).border(3.dp, Gold).padding(20.dp)) {
Row(Modifier.width(640.dp).height(290.dp).background(themed(Color(0xFF0E2147)) { Deep }).border(3.dp, Gold).padding(20.dp)) {
Column(Modifier.weight(1f).fillMaxHeight()) {
Text("ORBIT DRIVE-IN", color = Gold, fontFamily = Marquee, fontSize = 26.sp, maxLines = 1)
Text(bill.kind.label, color = Color.White, fontFamily = Barlow, fontSize = 15.sp)
Text(bill.kind.label, color = Ink, fontFamily = Barlow, fontSize = 15.sp)
Spacer(Modifier.height(8.dp))
Text(bill.title, color = Color.White, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 22.sp, lineHeight = 26.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(bill.title, color = Ink, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 22.sp, lineHeight = 26.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
if (bill.films.size > 1) Text(bill.films.joinToString(" • "), color = Muted, fontFamily = Barlow, fontSize = 12.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Spacer(Modifier.weight(1f))
Text("Doors open ${driveInWhen(bill, nowMs)}", color = Gold, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 17.sp, maxLines = 1)
Text(if (ticketed) "You have your ticket. We'll remind you 5 minutes before, and when it starts." else "Get your ticket? We'll remind you 5 minutes before, and when it starts.",
color = Color.White, fontFamily = Barlow, fontSize = 12.sp, maxLines = 2)
color = Ink, fontFamily = Barlow, fontSize = 12.sp, maxLines = 2)
Spacer(Modifier.height(8.dp))
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
if (ticketed) {
@@ -307,7 +306,7 @@ private fun DriveInTicket(bill: DriveInBill, nowMs: Long, ticketed: Boolean, onT
Box(Modifier.padding(horizontal = 16.dp).width(1.dp).fillMaxHeight().background(Gold.copy(alpha = .6f)))
Column(Modifier.width(84.dp).fillMaxHeight(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
Text("ADMIT", color = Gold, fontFamily = Barlow, fontSize = 18.sp)
Text("01", color = Color.White, fontFamily = Barlow, fontSize = 36.sp)
Text("01", color = Ink, fontFamily = Barlow, fontSize = 36.sp)
Text("FRONT ROW", color = Gold, fontFamily = Barlow, fontSize = 10.sp)
}
}
@@ -323,10 +322,10 @@ internal fun DriveInReminderCard(reminder: DriveInReminder, nowMs: Long, onGo: (
SideEffect { window?.setDimAmount(0f); window?.setGravity(android.view.Gravity.TOP or android.view.Gravity.END) }
val first = remember { FocusRequester() }
LaunchedEffect(reminder.stage) { first.requestFocus() }
Column(Modifier.padding(20.dp).width(380.dp).background(Color(0xF00E2147), RoundedCornerShape(6.dp)).border(2.dp, Gold, RoundedCornerShape(6.dp)).padding(14.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Column(Modifier.padding(20.dp).width(380.dp).background(themed(Color(0xF00E2147)) { Deep.copy(alpha = .94f) }, RoundedCornerShape(6.dp)).border(2.dp, Gold, RoundedCornerShape(6.dp)).padding(14.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
val left = ((reminder.bill.startMs - nowMs + 59_999) / 60_000).coerceAtLeast(1)
Text(if (reminder.stage == 2) "NOW SHOWING AT THE DRIVE-IN" else "AT THE DRIVE-IN IN $left ${if (left == 1L) "MINUTE" else "MINUTES"}", color = Gold, fontFamily = Marquee, fontSize = 16.sp, maxLines = 1)
Text(reminder.bill.title, color = Color.White, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 19.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(reminder.bill.title, color = Ink, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 19.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OrbitButton(if (reminder.stage == 2) "Watch now" else "Go to the Drive-In", Modifier.focusRequester(first), onClick = onGo)
OrbitButton(if (reminder.stage == 2) "Not tonight" else "Later", onClick = onDismiss)
@@ -384,26 +383,26 @@ internal fun DriveInScreen(session: EmbySampleSession, plan: ChannelPlan?, visit
if (takeover != null) Image(painterResource(takeover), selected.title, Modifier.width(160.dp).height(50.dp), alignment = Alignment.CenterStart)
else Image(painterResource(R.drawable.orbit_drive_in_epg), "Orbit Drive-In", Modifier.width(110.dp).height(34.dp), alignment = Alignment.CenterStart)
if (selected == null) {
Text("Tonight's bill is on its way.", color = Color.White, fontFamily = Barlow, fontSize = 20.sp)
Text("Tonight's bill is on its way.", color = Ink, fontFamily = Barlow, fontSize = 20.sp)
return@Column
}
Text("${driveInDay(selected, now).uppercase(java.util.Locale.UK)} · ${selected.kind.label.uppercase(java.util.Locale.UK)}",
Modifier.background(Yellow, RoundedCornerShape(3.dp)).padding(horizontal = 8.dp, vertical = 3.dp), color = Navy, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 12.sp, letterSpacing = .5.sp, maxLines = 1)
Modifier.background(Yellow, RoundedCornerShape(3.dp)).padding(horizontal = 8.dp, vertical = 3.dp), color = OnAccent, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 12.sp, letterSpacing = .5.sp, maxLines = 1)
Text(if (selected.startMs <= now) "Now showing" else "Gates ${clock(selected.startMs - 5 * 60_000)} · Feature ${clock(selected.startMs)}", color = Yellow, fontFamily = BarlowCondensed, fontSize = 22.sp)
Text(selected.title.uppercase(java.util.Locale.UK), color = Color.White, fontFamily = Marquee, fontSize = if (selected.title.length > 28) 30.sp else 42.sp, lineHeight = 46.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text((if (selected.films.size > 1) selected.films.joinToString(" · ") + " · " else "") + "${(selected.endMs - selected.startMs) / 60_000} min", color = Color(0xFFE4ECF8), fontFamily = Barlow, fontSize = 14.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(selected.title.uppercase(java.util.Locale.UK), color = Ink, fontFamily = Marquee, fontSize = if (selected.title.length > 28) 30.sp else 42.sp, lineHeight = 46.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text((if (selected.films.size > 1) selected.films.joinToString(" · ") + " · " else "") + "${(selected.endMs - selected.startMs) / 60_000} min", color = themed(Color(0xFFE4ECF8)) { Ink }, fontFamily = Barlow, fontSize = 14.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Spacer(Modifier.height(10.dp))
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Image(painterResource(R.drawable.orbit_drive_in_ticket), "Ticket", Modifier.width(150.dp).height(47.dp))
val held = selected.startMs in tickets
Column {
Text(when { selected.startMs <= now -> "Showing now"; held -> "Ticket held"; else -> "No ticket yet" }, color = if (held || selected.startMs <= now) Mint else Color.White, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 15.sp)
Text(when { selected.startMs <= now -> "Showing now"; held -> "Ticket held"; else -> "No ticket yet" }, color = if (held || selected.startMs <= now) Mint else Ink, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 15.sp)
Text(when { selected.startMs <= now -> "OK to watch"; held -> "Reminder 5 minutes before, and at the start. OK to see it"; else -> "OK to get your ticket" }, color = Muted, fontFamily = Barlow, fontSize = 11.sp)
}
}
}
Column(Modifier.align(Alignment.TopEnd).padding(top = 78.dp, end = 36.dp).width(300.dp).background(Navy.copy(alpha = .86f), RoundedCornerShape(8.dp)).padding(10.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("THIS WEEK'S BILLS", color = Color.White, fontFamily = Marquee, fontSize = 16.sp)
Text("THIS WEEK'S BILLS", color = Ink, fontFamily = Marquee, fontSize = 16.sp)
bills.forEach { bill -> BillRow(bill, now, bill === selected, bill.startMs in tickets) }
if (bills.isEmpty()) Text("Nothing booked yet.", color = Muted, fontFamily = Barlow, fontSize = 13.sp)
}
@@ -419,14 +418,14 @@ private const val DRIVE_IN_LISTED = 5
@Composable
private fun BillRow(bill: DriveInBill, nowMs: Long, selected: Boolean, ticketed: Boolean) {
val shape = RoundedCornerShape(6.dp)
val ink = if (selected) Navy else Color.White
val ink = if (selected) OnAccent else Ink
Row(Modifier.fillMaxWidth().height(52.dp).background(if (selected) Yellow else Panel, shape).padding(horizontal = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Column(Modifier.width(52.dp)) {
Text(driveInDay(bill, nowMs).take(3).uppercase(java.util.Locale.UK), color = if (selected) Navy else Muted, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 10.sp)
Text(clock(bill.startMs), color = if (selected) Navy else Yellow, fontFamily = BarlowCondensed, fontSize = 18.sp)
Text(driveInDay(bill, nowMs).take(3).uppercase(java.util.Locale.UK), color = if (selected) OnAccent else Muted, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 10.sp)
Text(clock(bill.startMs), color = if (selected) OnAccent else Yellow, fontFamily = BarlowCondensed, fontSize = 18.sp)
}
Column(Modifier.weight(1f)) {
Text((if (bill.event != null) "SPECIAL EVENT · " else "") + bill.kind.label.uppercase(java.util.Locale.UK) + if (ticketed) " · TICKET HELD" else "", color = if (selected) Navy else if (ticketed) Mint else Yellow, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 9.sp, letterSpacing = .5.sp, maxLines = 1)
Text((if (bill.event != null) "SPECIAL EVENT · " else "") + bill.kind.label.uppercase(java.util.Locale.UK) + if (ticketed) " · TICKET HELD" else "", color = if (selected) OnAccent else if (ticketed) Mint else Yellow, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 9.sp, letterSpacing = .5.sp, maxLines = 1)
Text(bill.title, color = ink, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
@@ -69,7 +69,7 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI
connection.connectTimeout = 10_000
connection.readTimeout = request.readTimeoutMs ?: if (request.path == "/Sessions/Logout") 5_000 else 15_000
connection.setRequestProperty("Accept", "application/json")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.41\"")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.42\"")
request.token?.let { connection.setRequestProperty("X-Emby-Token", it) }
if (request.method == "POST") {
val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8)
@@ -624,12 +624,12 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
}
Box(modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Column(Modifier.width(460.dp).verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text("Sign in to Emby", color = Color.White, fontSize = 26.sp, fontWeight = FontWeight.SemiBold)
Text("Sign in to Emby", color = Ink, fontSize = 26.sp, fontWeight = FontWeight.SemiBold)
// The server's address (release essentials, 6 November 2026): typed in, HTTPS only.
Text("Server address", color = Muted, fontSize = 14.sp)
var serverFocused by remember { mutableStateOf(false) }
BasicTextField(value = serverText, onValueChange = { if (it.length <= 255) serverText = it.replace("\n", "").trim() },
enabled = !busy && !restoring, singleLine = true, textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
enabled = !busy && !restoring, singleLine = true, textStyle = TextStyle(color = Ink, fontSize = 18.sp),
cursorBrush = SolidColor(Yellow),
keyboardOptions = KeyboardOptions(autoCorrectEnabled = false, keyboardType = KeyboardType.Uri, imeAction = ImeAction.Next),
modifier = Modifier.fillMaxWidth().onFocusChanged { serverFocused = it.isFocused }
@@ -644,7 +644,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
Text("Username", color = Muted, fontSize = 14.sp)
var userFocused by remember { mutableStateOf(false) }
BasicTextField(value = username, onValueChange = { if (it.length <= 256) username = it.replace("\n", "") },
enabled = !busy && !restoring, singleLine = true, textStyle = TextStyle(color = Color.White, fontSize = 18.sp),
enabled = !busy && !restoring, singleLine = true, textStyle = TextStyle(color = Ink, fontSize = 18.sp),
cursorBrush = SolidColor(Yellow),
keyboardOptions = KeyboardOptions(autoCorrectEnabled = false, imeAction = ImeAction.Next),
keyboardActions = KeyboardActions(onNext = { passwordFocus.requestFocus(); keyboard?.show() }),
@@ -661,7 +661,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
BasicSecureTextField(state = password, enabled = !busy && !restoring,
textObfuscationMode = TextObfuscationMode.Hidden,
inputTransformation = InputTransformation.maxLength(1024),
textStyle = TextStyle(color = Color.White, fontSize = 18.sp), cursorBrush = SolidColor(Yellow),
textStyle = TextStyle(color = Ink, fontSize = 18.sp), cursorBrush = SolidColor(Yellow),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password, imeAction = ImeAction.Done),
onKeyboardAction = { keyboard?.hide(); if (ready) submitFocus.requestFocus() else focus.clearFocus() },
modifier = Modifier.fillMaxWidth().focusRequester(passwordFocus)
@@ -492,7 +492,7 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl
ident?.invoke()
if (window == null) intro?.let { IntroOverlay(it) }
trackMenu?.let { TrackPanel(it, trackCursor, Modifier.align(Alignment.CenterEnd).padding(end = 28.dp)) }
trackProblem?.let { Text(it, Modifier.align(Alignment.TopCenter).padding(top = 44.dp).background(Navy.copy(alpha = .85f)).padding(horizontal = 14.dp, vertical = 8.dp), color = Color.White, fontSize = 16.sp) }
trackProblem?.let { Text(it, Modifier.align(Alignment.TopCenter).padding(top = 44.dp).background(Navy.copy(alpha = .85f)).padding(horizontal = 14.dp, vertical = 8.dp), color = Ink, fontSize = 16.sp) }
numberEntry?.let { ChannelNumberBox(it, numberProblem, Modifier.align(Alignment.TopCenter).padding(top = 44.dp)) }
// In a window of its own; a scheduled channel draws it over its idents instead.
if (window == null && SleepTimer.warning) SleepWarning(Modifier.align(Alignment.TopCenter).padding(top = 44.dp))
@@ -84,7 +84,7 @@ internal fun guideNowFraction(nowMs: Long, windowStart: Long, windowEnd: Long):
private val GuideTitleMinWidth = 34.dp
/** Programmes later than now: a shade darker than what's on, so now stands out down the rows. */
private val GuideLater = Color(0xFF0F2C5C)
private val GuideLater: Color get() = OrbitTheme.palette.later
/** One category along the top of the guide. Down goes straight to the grid. */
@Composable
@@ -92,9 +92,9 @@ private fun CategoryChip(category: ChannelCategory, current: Boolean, grid: Focu
var focused by remember { mutableStateOf(false) }
val shape = androidx.compose.foundation.shape.RoundedCornerShape(12.dp)
Box(Modifier.focusProperties { down = grid }.onFocusChanged { focused = it.isFocused }
.background(if (current || focused) Yellow else Panel, shape).then(if (focused) Modifier.border(2.dp, Color.White, shape) else Modifier)
.background(if (current || focused) Yellow else Panel, shape).then(if (focused) Modifier.border(2.dp, Ink, shape) else Modifier)
.clickable(onClick = onClick).padding(horizontal = 12.dp, vertical = 4.dp)) {
Text(category.label, color = if (current || focused) Navy else Color.White, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
Text(category.label, color = if (current || focused) OnAccent else Ink, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
}
}
@@ -161,10 +161,10 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
// The picture stays on the tuned channel while the cursor browses, so moving rows never re-tunes.
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(3.dp)) {
if (branding != null) Image(painterResource(branding.logo), branding.displayName, Modifier.width(96.dp).height(30.dp))
else Text(ChannelBrands.displayName(channel), color = Color.White, fontSize = 16.sp)
else Text(ChannelBrands.displayName(channel), color = Ink, fontSize = 16.sp)
val (focusedName, focusedDetail) = if (kidsAsleep(takeoverOf(channel.number, focused))) "Asleep till 6am" to "Back for Kids in the morning" else guideTitleParts(focused.media.item.title)
Text(focusedName, color = Color.White, fontFamily = Anton, fontSize = 20.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
if (focusedDetail != null) Text(focusedDetail, color = Color.White, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(focusedName, color = Ink, fontFamily = Anton, fontSize = 20.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
if (focusedDetail != null) Text(focusedDetail, color = Ink, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text("${guideDayPrefix(focused.startMs, now)}${clock(focused.startMs)} to ${clock(focused.endMs)} • ${channel.number} ${ChannelBrands.displayName(channel)}" +
if (focusedPast) " • ${airedAgo(focused.endMs, now)}" else "", color = Muted, fontSize = 13.sp, maxLines = 1)
if (focusedPast) Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
@@ -176,10 +176,10 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
}
}
Row(Modifier.fillMaxWidth().height(20.dp).background(Blue, androidx.compose.foundation.shape.RoundedCornerShape(3.dp)), verticalAlignment = Alignment.CenterVertically) {
Text(guideDayPrefix(windowStart, now).trim().ifEmpty { "$title, today" }, Modifier.width(136.dp).padding(start = 8.dp), color = Color.White, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
Text(guideDayPrefix(windowStart, now).trim().ifEmpty { "$title, today" }, Modifier.width(136.dp).padding(start = 8.dp), color = Ink, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
BoxWithConstraints(Modifier.weight(1f).fillMaxHeight()) {
Row(Modifier.fillMaxSize(), verticalAlignment = Alignment.CenterVertically) {
repeat(GUIDE_SLOTS) { Text(clock(windowStart + it * GUIDE_SLOT_MS), Modifier.weight(1f).padding(start = 4.dp), color = Color.White, fontSize = 12.sp, fontWeight = FontWeight.SemiBold) }
repeat(GUIDE_SLOTS) { Text(clock(windowStart + it * GUIDE_SLOT_MS), Modifier.weight(1f).padding(start = 4.dp), color = Ink, fontSize = 12.sp, fontWeight = FontWeight.SemiBold) }
}
if (nowFraction != null) Box(Modifier.align(Alignment.BottomStart).offset(x = maxWidth * nowFraction - 3.dp).size(6.dp, 6.dp).background(Yellow))
}
@@ -222,7 +222,7 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
Text(line.number.toString(), Modifier.width(30.dp), color = Yellow, fontFamily = BarlowCondensed, fontSize = 13.sp)
if (takeover != null) TakeoverMark(takeover, Modifier.width(92.dp), height = 18.dp, textSize = 13.sp)
else if (mark != null) Image(painterResource(mark.logo), mark.displayName, Modifier.width(88.dp).height(28.dp))
else Text(ChannelBrands.displayName(line), color = Color.White, fontSize = 13.sp, maxLines = 1)
else Text(ChannelBrands.displayName(line), color = Ink, fontSize = 13.sp, maxLines = 1)
}
BoxWithConstraints(Modifier.weight(1f).fillMaxHeight()) {
guideWatchableCells(guideCells(line, windowStart, windowEnd), now, catchUpEarliest(line, now)).forEach { cell ->
@@ -237,7 +237,7 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
// Focused as on What's On: navy inside a gold ring, the title crisp in white.
.border(if (isFocus) 2.dp else 0.dp, if (isFocus) Yellow else Color.Transparent, androidx.compose.foundation.shape.RoundedCornerShape(4.dp)), contentAlignment = Alignment.CenterStart) {
val runsOn = cell.show.endMs > windowEnd
val ink = if (isFocus) Color.White else if (past) Muted else Color.White
val ink = if (isFocus) Ink else if (past) Muted else Ink
if (elapsed > 0.dp) Box(Modifier.align(Alignment.BottomStart).width(elapsed).height(3.dp).background(Yellow))
Row(Modifier.padding(horizontal = 6.dp), verticalAlignment = Alignment.CenterVertically) {
// Kids never sees what a grown-up takeover is showing.
@@ -72,14 +72,14 @@ internal fun HomeScreen(channels: List<SampleChannel>, modifier: Modifier = Modi
LaunchedEffect(Unit) { runCatching { firstFocus.requestFocus() } }
Column(modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally) {
Spacer(Modifier.weight(.6f))
Text("What would you like to watch?", color = Color.White, fontFamily = Anton, fontSize = 22.sp)
Text("What would you like to watch?", color = Ink, fontFamily = Anton, fontSize = 22.sp)
Spacer(Modifier.height(16.dp))
Column(Modifier.width(400.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
homeCategories(channels.map { it.number }).forEachIndexed { index, category ->
HomeCard(Modifier.fillMaxWidth().height(31.dp).focusProperties { if (index == 0 && nav != null) up = nav }, if (index == 0) firstFocus else null, onClick = { onCategory(category) }) { focused ->
Row(Modifier.fillMaxSize().padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Image(painterResource(category.icon), null, Modifier.size(18.dp), colorFilter = if (focused) ColorFilter.tint(Navy) else null)
Text(category.label.uppercase(java.util.Locale.UK), color = if (focused) Navy else Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, letterSpacing = .5.sp, maxLines = 1)
Text(category.label.uppercase(java.util.Locale.UK), color = if (focused) OnAccent else Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, letterSpacing = .5.sp, maxLines = 1)
}
}
}
@@ -100,7 +100,7 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
val settings = remember { OrbitSettings(context) }
val fade = remember { Animatable(0f) }
LaunchedEffect(Unit) { fade.animateTo(1f, tween(mood?.fadeMs ?: 400)) }
Box(Modifier.fillMaxSize().graphicsLayer { alpha = fade.value }.background(Navy)) {
Box(Modifier.fillMaxSize().graphicsLayer { alpha = fade.value }.background(NightNavy)) {
val video = block?.video ?: identVideo(channel.number, next.startMs)
// With idents off, Tots still says goodbye with a picture that doesn't move.
if (mood != null && !settings.idents) Image(painterResource(mood.still), null, Modifier.fillMaxSize())
@@ -134,7 +134,7 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
}
}
// A booked event's own lower third says what's next instead.
if (block?.overlay != BlockOverlay.TonightsEvent || eventTitle(next) == null) Column(Modifier.align(Alignment.BottomStart).padding(start = 40.dp, bottom = 32.dp).background(Navy.copy(alpha = .72f)).padding(horizontal = 14.dp, vertical = 8.dp)) {
if (block?.overlay != BlockOverlay.TonightsEvent || eventTitle(next) == null) Column(Modifier.align(Alignment.BottomStart).padding(start = 40.dp, bottom = 32.dp).background(NightNavy.copy(alpha = .72f)).padding(horizontal = 14.dp, vertical = 8.dp)) {
Text(heading ?: if (early) "NEXT AT ${clock(next.startMs)}" else "NEXT", color = Color(0xFFD5DCEA), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(guideTitleParts(next.media.item.title).first, color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
@@ -0,0 +1,85 @@
package tv.orbit.classic
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.tv.material3.Text
/**
* The six looks as small screens, each in its own colours (design/first-run/first-run-5-look.png). OK uses one at once: every
* screen, this one included, changes there and then. Used by onboarding's Look step and Settings › Look.
*/
@Composable
internal fun LookPicker(first: FocusRequester, cardWidth: Dp = 220.dp, onChosen: (OrbitLook) -> Unit = {}) {
val context = LocalContext.current
Column(verticalArrangement = Arrangement.spacedBy(14.dp)) {
OrbitLook.entries.chunked(3).forEachIndexed { row, looks ->
Row(horizontalArrangement = Arrangement.spacedBy(18.dp)) {
looks.forEachIndexed { i, look ->
var focused by remember { mutableStateOf(false) }
val inUse = OrbitTheme.look == look
Column(Modifier.width(cardWidth).then(if (row == 0 && i == 0) Modifier.focusRequester(first) else Modifier)
.onFocusChanged { focused = it.isFocused }.clickable { OrbitTheme.choose(context, look); onChosen(look) },
verticalArrangement = Arrangement.spacedBy(4.dp)) {
LookPreview(look.palette, Modifier.fillMaxWidth().height(cardWidth * .5f).border(if (focused) 3.dp else 1.dp,
if (focused) Yellow else Muted.copy(alpha = .4f), RoundedCornerShape(8.dp)))
Row(verticalAlignment = Alignment.CenterVertically) {
Text(look.title, color = if (focused) Yellow else Ink, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))
if (inUse) Text("In use", Modifier.background(Yellow, RoundedCornerShape(3.dp)).padding(horizontal = 6.dp, vertical = 1.dp),
color = OnAccent, fontSize = 10.sp, fontWeight = FontWeight.SemiBold)
}
Text(look.line, color = Muted, fontSize = 11.sp, maxLines = 1)
}
}
}
}
}
}
/** A tiny Orbit home in one look: its stars, the top bar with Home picked, a programme card and a guide row. */
@Composable
private fun LookPreview(p: Palette, modifier: Modifier) {
Canvas(modifier.background(p.background, RoundedCornerShape(8.dp))) {
val w = size.width; val h = size.height
val stars = java.util.Random(3)
repeat(26) { drawCircle(p.stars, 1.2f + stars.nextFloat(), Offset(stars.nextFloat() * w, stars.nextFloat() * h)) }
if (p.scanlines) { var y = 0f; while (y < h) { drawRect(Color.Black.copy(alpha = .16f), Offset(0f, y), Size(w, 1f)); y += 3f } }
val r = CornerRadius(h * .04f)
// The top bar: Home picked, two more places beside it.
drawRoundRect(p.accent, Offset(w * .3f, h * .08f), Size(w * .12f, h * .09f), r)
drawRoundRect(p.onAccent, Offset(w * .32f, h * .115f), Size(w * .08f, h * .02f), r)
drawRoundRect(p.surface, Offset(w * .44f, h * .08f), Size(w * .12f, h * .09f), r)
drawRoundRect(p.surface, Offset(w * .58f, h * .08f), Size(w * .12f, h * .09f), r)
// A programme card: title in ink, a line in muted, the time in the accent.
drawRoundRect(p.surface, Offset(w * .06f, h * .26f), Size(w * .55f, h * .42f), r)
drawRoundRect(p.accent, Offset(w * .1f, h * .32f), Size(w * .14f, h * .04f), r)
drawRoundRect(p.ink, Offset(w * .1f, h * .41f), Size(w * .38f, h * .07f), r)
drawRoundRect(p.muted, Offset(w * .1f, h * .53f), Size(w * .3f, h * .04f), r)
drawRoundRect(p.deep, Offset(w * .65f, h * .26f), Size(w * .29f, h * .42f), r)
drawRoundRect(p.mint, Offset(w * .69f, h * .32f), Size(w * .1f, h * .04f), r)
drawRoundRect(p.ink, Offset(w * .69f, h * .41f), Size(w * .2f, h * .05f), r)
// A guide row, the programme on now picked out.
drawRoundRect(p.raised, Offset(w * .06f, h * .76f), Size(w * .88f, h * .07f), r)
drawRoundRect(p.surface, Offset(w * .06f, h * .86f), Size(w * .3f, h * .08f), r)
drawRoundRect(p.later, Offset(w * .38f, h * .86f), Size(w * .56f, h * .08f), r)
drawRoundRect(p.accent, Offset(w * .06f, h * .86f), Size(w * .3f, h * .08f), r, style = androidx.compose.ui.graphics.drawscope.Stroke(2f))
}
}
@@ -18,6 +18,7 @@ import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.res.painterResource
@@ -40,11 +41,6 @@ import java.util.Locale
internal val LocalNavFocus = staticCompositionLocalOf<FocusRequester?> { null }
internal val LocalDriveInFocus = staticCompositionLocalOf<FocusRequester?> { null }
internal val Barlow = FontFamily(Font(R.font.barlow_regular), Font(R.font.barlow_semibold, FontWeight.SemiBold), Font(R.font.barlow_semibold, FontWeight.Bold))
internal val Navy = Color(0xFF071632)
internal val Panel = Color(0xFF12356B)
internal val Blue = Color(0xFF194C91)
internal val Yellow = Color(0xFFFFDE59)
internal val Muted = Color(0xFFB7CBE8)
internal fun clock(time: Long) = SimpleDateFormat("HH:mm", Locale.UK).format(Date(time))
class MainActivity : ComponentActivity() {
@@ -61,6 +57,9 @@ class MainActivity : ComponentActivity() {
// Before anything is drawn, so a locked After Dark never shows for a moment.
AfterDarkLock.load(this)
Profiles.load(this)
// The chosen look, before the first frame, so a light look never flashes navy.
OrbitTheme.load(this)
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(Navy.toArgb()))
// One typeface everywhere, matching the channel logos.
setContent { MaterialTheme { CompositionLocalProvider(androidx.tv.material3.LocalTextStyle provides androidx.compose.ui.text.TextStyle(fontFamily = Barlow)) { OrbitApp() } } }
}
@@ -72,9 +71,9 @@ internal fun OrbitButton(label: String, modifier: Modifier = Modifier, selected:
var focused by remember { mutableStateOf(false) }
Box(modifier.onFocusChanged { focused = it.isFocused; if (it.isFocused) onFocus() }
.background(if (focused) Yellow else if (selected) Blue else Panel)
.border(if (focused) 2.dp else 1.dp, if (focused) Color.White else Color(0xFF38629A))
.border(if (focused) 2.dp else 1.dp, if (focused) Ink else themed(Color(0xFF38629A)) { Blue })
.clickable(enabled = enabled, onClick = onClick).padding(horizontal = 14.dp, vertical = 8.dp)) {
Text(label, color = if (focused) Navy else Color.White, fontSize = 14.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,
Text(label, color = if (focused) OnAccent else Ink, fontSize = 14.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,
fontWeight = if (focused || selected) FontWeight.Bold else FontWeight.Normal)
}
}
@@ -89,7 +88,7 @@ private fun NavItem(label: String, selected: Boolean, focus: FocusRequester?, be
val corner = androidx.compose.foundation.shape.RoundedCornerShape(5.dp)
Column((if (focus != null) Modifier.focusRequester(focus) else Modifier).focusProperties { if (below != null) down = below }.height(32.dp).onFocusChanged { focused = it.isFocused }
.background(if (focused) Yellow else Color.Transparent, corner).clickable(onClick = onClick).padding(horizontal = 12.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
Text(label, color = if (focused) Navy else if (selected) Color.White else Muted, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
Text(label, color = if (focused) OnAccent else if (selected) Ink else Muted, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
Box(Modifier.padding(top = 2.dp).width(28.dp).height(2.dp).background(if (selected && !focused) Yellow else Color.Transparent))
}
}
@@ -190,7 +189,7 @@ private fun OrbitApp() {
Image(painterResource(R.drawable.orbit_logo), "Orbit", Modifier.width(144.dp).height(36.dp))
Spacer(Modifier.weight(1f))
Column(horizontalAlignment = Alignment.End) {
Text(SimpleDateFormat("HH:mm", Locale.UK).format(Date(now)), color = Color.White, fontFamily = BarlowCondensed, fontSize = 20.sp)
Text(SimpleDateFormat("HH:mm", Locale.UK).format(Date(now)), color = Ink, fontFamily = BarlowCondensed, fontSize = 20.sp)
Text(SimpleDateFormat("EEEE d MMMM", Locale.UK).format(Date(now)), color = Muted, fontSize = 10.sp)
}
// Who's watching, as a little picture: OK goes back to Who's watching? to switch.
@@ -130,7 +130,7 @@ internal fun NewArrivalsDetail(load: () -> ArrivalsReport?, first: androidx.comp
var focused by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(false) }
androidx.compose.foundation.layout.Column(androidx.compose.ui.Modifier.fillMaxWidth().onFocusChanged { focused = it.isFocused }.focusable()
.background(if (focused) Blue else Panel, androidx.compose.foundation.shape.RoundedCornerShape(4.dp)).padding(horizontal = 10.dp, vertical = 5.dp)) {
androidx.tv.material3.Text("${line.title} · ${line.type}", color = androidx.compose.ui.graphics.Color.White, fontSize = 13.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold, maxLines = 1)
androidx.tv.material3.Text("${line.title} · ${line.type}", color = Ink, fontSize = 13.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold, maxLines = 1)
androidx.tv.material3.Text((line.labels.joinToString(" · ") + " — " + line.evidence), color = Muted, fontSize = 11.sp, maxLines = 2)
}
}
@@ -40,7 +40,7 @@ import kotlin.math.sin
* Settings › Emby account can show it again as a tour, which changes nothing. Ollie rolls in and blinks; Drift bobs and blinks;
* at the end the cast floats right through the stars. All still with Reduce motion on.
*/
internal enum class OnboardStep(val label: String) { Welcome("Welcome"), Server("Server"), SignIn("Sign in"), Channels("Channels"), WhoWatches("Who watches"), AllSet("All set") }
internal enum class OnboardStep(val label: String) { Welcome("Welcome"), Look("Look"), Server("Server"), SignIn("Sign in"), Channels("Channels"), WhoWatches("Who watches"), AllSet("All set") }
/** The channels ticked to start with, as in the design: the ones most libraries suit. */
internal val OnboardStartChannels = setOf(101, 106, 201, 107, 302, TOTS_NUMBER, 605, 104)
@@ -56,7 +56,8 @@ internal object Onboarding {
fun markDone(context: Context) = prefs(context).edit().putBoolean("done", true).apply()
fun start(tour: Boolean) { this.tour = tour; ChannelSetup.begin(emptyList()); step = OnboardStep.Welcome }
fun go(to: OnboardStep) { step = to }
fun finish(context: Context) { if (!tour) markDone(context); step = null; tour = false }
/** The tour changes nothing: a look tried in it goes back to the one in use. */
fun finish(context: Context) { if (!tour) markDone(context) else OrbitTheme.load(context); step = null; tour = false }
}
/**
@@ -84,10 +85,10 @@ private fun Steps(at: OnboardStep, modifier: Modifier = Modifier) {
Row(modifier, verticalAlignment = Alignment.CenterVertically) {
OnboardStep.entries.forEachIndexed { i, s ->
Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.width(96.dp)) {
Box(Modifier.size(if (s == at) 12.dp else 9.dp).background(if (s == at) Yellow else if (s.ordinal < at.ordinal) Color(0xFF6EDCAA) else Color(0xFF3C5078), RoundedCornerShape(50)))
Text(s.label, color = if (s == at) Color.White else Muted, fontSize = 11.sp, modifier = Modifier.padding(top = 4.dp))
Box(Modifier.size(if (s == at) 12.dp else 9.dp).background(if (s == at) Yellow else if (s.ordinal < at.ordinal) themed(Color(0xFF6EDCAA)) { Mint } else OrbitTheme.palette.stars, RoundedCornerShape(50)))
Text(s.label, color = if (s == at) Ink else Muted, fontSize = 11.sp, modifier = Modifier.padding(top = 4.dp))
}
if (i < OnboardStep.entries.lastIndex) Box(Modifier.width(24.dp).height(2.dp).padding(bottom = 14.dp).background(if (s.ordinal < at.ordinal) Color(0xFF6EDCAA) else Color(0xFF283C64)))
if (i < OnboardStep.entries.lastIndex) Box(Modifier.width(24.dp).height(2.dp).padding(bottom = 14.dp).background(if (s.ordinal < at.ordinal) themed(Color(0xFF6EDCAA)) { Mint } else themed(Color(0xFF283C64)) { Blue }))
}
}
}
@@ -115,7 +116,8 @@ internal fun OnboardingScreen(signedIn: Boolean, onDone: (tour: Boolean) -> Unit
Steps(step, Modifier.align(Alignment.TopCenter).padding(top = 16.dp))
Box(Modifier.fillMaxSize().padding(top = 70.dp, bottom = 24.dp, start = 40.dp, end = 40.dp)) {
when (step) {
OnboardStep.Welcome -> WelcomeStep { Onboarding.go(OnboardStep.Server) }
OnboardStep.Welcome -> WelcomeStep { Onboarding.go(OnboardStep.Look) }
OnboardStep.Look -> LookStep { Onboarding.go(OnboardStep.Server) }
OnboardStep.Server -> ServerStep { Onboarding.go(OnboardStep.SignIn) }
OnboardStep.SignIn -> if (Onboarding.tour) TourSignedIn { Onboarding.go(OnboardStep.Channels) }
else Text("Sign in with your Emby account. Your password is never saved.", Modifier.align(Alignment.BottomCenter), color = Muted, fontSize = 13.sp)
@@ -146,13 +148,26 @@ private fun WelcomeStep(onNext: () -> Unit) {
drawOrbMascot(Offset(x, center.y - bounce), size.minDimension * .2f, blink = blink)
}
}
Text("Welcome to Orbit", color = Color.White, fontFamily = Anton, fontSize = 40.sp)
Text("Welcome to Orbit", color = Ink, fontFamily = Anton, fontSize = 40.sp)
Text("Proper TV channels, made from your own films and series.", color = Muted, fontSize = 18.sp, modifier = Modifier.padding(top = 8.dp))
Text("It takes about five minutes. I'm Ollie, and I'll show you round.", color = Muted, fontSize = 16.sp)
OrbitButton("Let's go", Modifier.padding(top = 24.dp).width(200.dp).focusRequester(go), onClick = onNext)
}
}
/** Choose your look, right after Welcome, so the rest of setting up is already in it. */
@Composable
private fun LookStep(onNext: () -> Unit) {
val first = remember { FocusRequester() }
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 › Look.", color = Muted, fontSize = 15.sp)
LookPicker(first, cardWidth = 200.dp)
OrbitButton("Next", Modifier.padding(top = 6.dp).width(200.dp), onClick = onNext)
}
}
@Composable
private fun ServerStep(onNext: () -> Unit) {
val first = remember { FocusRequester() }
@@ -160,7 +175,7 @@ private fun ServerStep(onNext: () -> Unit) {
var note by remember { mutableStateOf<String?>(null) }
Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(14.dp)) {
Spacer(Modifier.height(20.dp))
Text("Where are your films and series?", color = Color.White, fontFamily = Anton, fontSize = 32.sp)
Text("Where are your films and series?", color = Ink, fontFamily = Anton, fontSize = 32.sp)
Text("Choose the media server they live on. Orbit only reads it, and never changes or copies anything.", color = Muted, fontSize = 15.sp)
Row(horizontalArrangement = Arrangement.spacedBy(16.dp), modifier = Modifier.padding(top = 16.dp)) {
listOf(Triple("Emby", Color(0xFF52B54B), true), Triple("Plex", Color(0xFFE5A00D), false), Triple("Jellyfin", Color(0xFFAA5CC3), false), Triple("Silo", Color(0xFF45B8F5), false))
@@ -178,7 +193,7 @@ private fun ServerStep(onNext: () -> Unit) {
drawCircle(Navy, 4f, Offset(size.width - 12f, k * size.height / 3f + size.height / 6f - 2f))
}
}
Text(name, color = if (ready) Color.White else Muted, fontFamily = Anton, fontSize = 24.sp)
Text(name, color = if (ready) Ink else Muted, fontFamily = Anton, fontSize = 24.sp)
Text(if (ready) "Sign in with your Emby account" else "Coming soon", color = Muted, fontSize = 11.sp, textAlign = TextAlign.Center)
}
}
@@ -192,7 +207,7 @@ private fun TourSignedIn(onNext: () -> Unit) {
val go = remember { FocusRequester() }
LaunchedEffect(Unit) { go.requestFocus() }
Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
Text("Sign in to Emby", color = Color.White, fontFamily = Anton, fontSize = 32.sp)
Text("Sign in to Emby", color = Ink, fontFamily = Anton, fontSize = 32.sp)
Text("A new box signs in here with an Emby account. This box is already signed in, so the tour moves on.", color = Muted, fontSize = 15.sp, modifier = Modifier.padding(8.dp))
OrbitButton("Next", Modifier.width(200.dp).focusRequester(go), onClick = onNext)
}
@@ -206,7 +221,7 @@ private fun ChannelsStep(onNext: () -> Unit) {
val first = remember { FocusRequester() }
LaunchedEffect(Unit) { first.requestFocus() }
Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text("Your channels", color = Color.White, fontFamily = Anton, fontSize = 30.sp)
Text("Your channels", color = Ink, fontFamily = Anton, fontSize = 30.sp)
Text("Orbit's ready-made channels, each matched to your library. The ticked ones suit most libraries; tick any you like. " +
"Making your own channels comes next, in Settings.", color = Muted, fontSize = 14.sp)
LazyVerticalGrid(GridCells.Fixed(5), Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(6.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
@@ -218,10 +233,10 @@ private fun ChannelsStep(onNext: () -> Unit) {
.background(if (focused) Navy else Panel, corner).border(if (focused) 3.dp else 0.dp, if (focused) Yellow else Color.Transparent, corner)
.clickable { ticked = if (on) ticked - programming.number else ticked + programming.number }.padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {
val brand = ChannelBrands.forNumber(programming.number)
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.width(84.dp).height(26.dp)) else Text(programming.name, color = Color.White, fontSize = 13.sp)
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.width(84.dp).height(26.dp)) else Text(programming.name, color = Ink, fontSize = 13.sp)
Spacer(Modifier.weight(1f))
Box(Modifier.size(20.dp).background(if (on) Color(0xFF6EDCAA) else Color(0xFF283C64), RoundedCornerShape(5.dp)), contentAlignment = Alignment.Center) {
if (on) Text("✓", color = Navy, fontSize = 13.sp, fontWeight = FontWeight.Bold)
Box(Modifier.size(20.dp).background(if (on) themed(Color(0xFF6EDCAA)) { Mint } else themed(Color(0xFF283C64)) { Blue }, RoundedCornerShape(5.dp)), contentAlignment = Alignment.Center) {
if (on) Text("✓", color = OnAccent, fontSize = 13.sp, fontWeight = FontWeight.Bold)
}
}
}
@@ -249,14 +264,14 @@ private fun ChannelsStep(onNext: () -> Unit) {
drawLine(Color(0xFF14213D), eye - Offset(r * .2f, 0f), eye + Offset(r * .2f, 0f), r * .07f)
}
}
Text(if (ChannelSetup.finished) "All matched" else "Drift's matching your library", color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold, textAlign = TextAlign.Center)
Text(if (ChannelSetup.finished) "All matched" else "Drift's matching your library", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold, textAlign = TextAlign.Center)
val now = System.currentTimeMillis()
Text(if (ChannelSetup.finished) "${ChannelSetup.found.values.filter { it > 0 }.sum()} titles across ${ChannelSetup.found.count { it.value > 0 }} channels"
else "${ChannelSetup.found.size} of ${ChannelSetup.wanted.size} channels · about ${ChannelSetup.minutesLeft(now + t * 0)} min left", color = Yellow, fontSize = 14.sp, textAlign = TextAlign.Center)
if (ChannelSetup.finished) OrbitButton("Next", Modifier.padding(top = 16.dp).width(180.dp).focusRequester(go), onClick = onNext)
}
Column(Modifier.weight(1f).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(5.dp)) {
Text("Here's where everything goes", color = Color.White, fontFamily = Anton, fontSize = 26.sp)
Text("Here's where everything goes", color = Ink, fontFamily = Anton, fontSize = 26.sp)
ChannelSetup.wanted.forEach { number ->
val count = ChannelSetup.found[number]
val busy = ChannelSetup.current == number
@@ -264,7 +279,7 @@ private fun ChannelsStep(onNext: () -> Unit) {
.padding(horizontal = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
val brand = ChannelBrands.forNumber(number)
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.width(80.dp).height(24.dp))
Text(brand?.displayName ?: "$number", color = Color.White, fontSize = 14.sp, modifier = Modifier.weight(1f))
Text(brand?.displayName ?: "$number", color = Ink, fontSize = 14.sp, modifier = Modifier.weight(1f))
Text(when {
count == null && busy -> "Matching…"
count == null -> "Waiting"
@@ -287,7 +302,7 @@ private fun WhoWatchesStep(onNext: () -> Unit) {
val go = remember { FocusRequester() }
LaunchedEffect(pinStep) { if (pinStep == 0) runCatching { go.requestFocus() } }
Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(12.dp)) {
Text("Who watches?", color = Color.White, fontFamily = Anton, fontSize = 32.sp)
Text("Who watches?", color = Ink, fontFamily = Anton, fontSize = 32.sp)
Text("Set a PIN for Grown-ups, and keep a Kids profile if there are little ones about.", color = Muted, fontSize = 15.sp)
if (pinStep > 0) {
if (pinStep == 1) key(1) { PinEntry("Choose a four-digit PIN", null, onDone = { first = it; pinStep = 2 }, onCancel = { pinStep = 0 }) }
@@ -300,13 +315,13 @@ private fun WhoWatchesStep(onNext: () -> Unit) {
Row(horizontalArrangement = Arrangement.spacedBy(28.dp), modifier = Modifier.padding(top = 10.dp)) {
Column(Modifier.width(280.dp).background(Panel, RoundedCornerShape(14.dp)).padding(18.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
ProfileAvatar("sil-blue", 90.dp)
Text("Grown-ups", color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text("Grown-ups", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text("Everything, including After Dark", color = Muted, fontSize = 13.sp)
OrbitButton(if (AfterDarkLock.pinSet) "PIN set: change it" else "Set a PIN", Modifier.focusRequester(go), onClick = { note = null; pinStep = 1 })
}
Column(Modifier.width(280.dp).background(Panel, RoundedCornerShape(14.dp)).padding(18.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
ProfileAvatar("ollie", 90.dp)
Text("Kids", color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text("Kids", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text("Tots, cartoons and the Arcade", color = Muted, fontSize = 13.sp)
OrbitButton(if (Profiles.kidsOn) "Kids: On" else "Kids: Off", selected = Profiles.kidsOn, onClick = { if (!Onboarding.tour) Profiles.setKidsOn(context, !Profiles.kidsOn) })
}
@@ -345,7 +360,7 @@ private fun AllSetStep(onStart: () -> Unit) {
drawOrbMascot(c, r, blink = !calm && (t % 3_400) < 150)
}
Column(Modifier.align(Alignment.BottomCenter).padding(bottom = 30.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text("You're on air", color = Color.White, fontFamily = Anton, fontSize = 44.sp)
Text("You're on air", color = Ink, fontFamily = Anton, fontSize = 44.sp)
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)
OrbitButton("Start watching", Modifier.width(240.dp).focusRequester(go), onClick = onStart)
}
@@ -122,7 +122,7 @@ private fun SnakeBackdrop(scene: Int, modifier: Modifier) {
drawRect(Brush.verticalGradient(listOf(tops[scene], bottoms[scene])))
val stars = java.util.Random(7L + scene)
repeat(90) {
drawCircle(Color.White.copy(alpha = .12f + stars.nextFloat() * .28f), .8f + stars.nextFloat() * 1.4f, Offset(stars.nextFloat() * w, stars.nextFloat() * h))
drawCircle(Ink.copy(alpha = .12f + stars.nextFloat() * .28f), .8f + stars.nextFloat() * 1.4f, Offset(stars.nextFloat() * w, stars.nextFloat() * h))
}
when (scene) {
// A nebula, soft and off to one side.
@@ -167,7 +167,7 @@ private fun SnakeField(game: SnakeGame, modifier: Modifier, before: List<SnakeCe
val left = (size.width - cell * game.width) / 2
val top = (size.height - cell * game.height) / 2
for (y in 0 until game.height) for (x in 0 until game.width) if ((x + y) % 2 == 0)
drawRect(Color.White.copy(alpha = .025f), Offset(left + x * cell, top + y * cell), Size(cell, cell))
drawRect(Ink.copy(alpha = .025f), Offset(left + x * cell, top + y * cell), Size(cell, cell))
fun sprite(image: ImageBitmap, x: Float, y: Float, scale: Float) {
val side = (cell * scale).toInt()
val offset = (cell - side) / 2
@@ -237,9 +237,9 @@ private fun SnakeScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Unit) {
Text("SNAKE", color = Honey, fontFamily = Marquee, fontSize = 40.sp)
Spacer(Modifier.height(10.dp))
Text("SCORE", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(game.score.toString(), color = Color.White, fontFamily = Marquee, fontSize = 36.sp)
Text(game.score.toString(), color = Ink, fontFamily = Marquee, fontSize = 36.sp)
Text("BEST", color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 2.sp)
Text(maxOf(best, game.score).toString(), color = Color.White, fontFamily = Marquee, fontSize = 36.sp)
Text(maxOf(best, game.score).toString(), color = Ink, fontFamily = Marquee, fontSize = 36.sp)
Spacer(Modifier.weight(1f))
Text("◄►▲▼ Steer", color = Muted, fontSize = 13.sp)
Text("Back Pause", color = Muted, fontSize = 13.sp)
@@ -250,7 +250,7 @@ private fun SnakeScreen(best: Int, onBest: (Int) -> Unit, onLeave: () -> Unit) {
if (paused || !game.alive) Column(Modifier.background(Navy, RoundedCornerShape(6.dp)).border(2.dp, Honey, RoundedCornerShape(6.dp)).padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(if (game.alive) "PAUSED" else "GAME OVER", color = Honey, fontFamily = Marquee, fontSize = 30.sp)
if (!game.alive && newBest) CastCheer()
if (!game.alive) Text(if (newBest) "New best: ${game.score}" else "Score: ${game.score}", color = Color.White, fontSize = 16.sp)
if (!game.alive) Text(if (newBest) "New best: ${game.score}" else "Score: ${game.score}", color = Ink, fontSize = 16.sp)
OrbitButton(if (game.alive) "Carry on" else "Play again", Modifier.width(200.dp).focusRequester(menuFocus), onClick = {
if (!game.alive) { game = SnakeGame.start(30, 22, random); before = null; progress = 1f }
paused = false
@@ -337,20 +337,20 @@ private fun androidx.compose.ui.graphics.drawscope.DrawScope.gameIcon(game: Arca
listOf(-.32f, -.16f, 0f).forEachIndexed { i, x -> drawCircle(Color(0xFF3DDC97), s * .1f, c + Offset(x * s, (if (i % 2 == 0) .12f else .04f) * s)) }
val head = c + Offset(.2f * s, -.06f * s)
drawCircle(Color(0xFF3DDC97), s * .14f, head)
drawCircle(Color.White, s * .05f, head + Offset(-s * .05f, -s * .03f)); drawCircle(Color.White, s * .05f, head + Offset(s * .05f, -s * .03f))
drawCircle(Ink, s * .05f, head + Offset(-s * .05f, -s * .03f)); drawCircle(Ink, s * .05f, head + Offset(s * .05f, -s * .03f))
drawCircle(Navy, s * .025f, head + Offset(-s * .05f, -s * .03f)); drawCircle(Navy, s * .025f, head + Offset(s * .05f, -s * .03f))
}
ArcadeGame.Blocks -> { val b = s * .2f
listOf(Offset(0f, -1f), Offset(-1f, 0f), Offset(0f, 0f), Offset(1f, 0f)).forEach { o -> drawRect(Color(0xFF4C7DFF), c + Offset(o.x * b - b / 2 + 1, o.y * b - 1), Size(b - 2, b - 2)) } }
ArcadeGame.Bricks -> {
for (row in 0..1) for (col in 0..2) drawRect(Color(0xFFFF6BA8), Offset(c.x - s * .4f + col * s * .27f + (row % 2) * s * .1f, c.y - s * .35f + row * s * .16f), Size(s * .24f, s * .12f))
drawCircle(Color.White, s * .06f, c + Offset(s * .05f, s * .12f))
drawCircle(Ink, s * .06f, c + Offset(s * .05f, s * .12f))
drawRect(Color(0xFF6EF0FF), Offset(c.x - s * .18f, c.y + s * .3f), Size(s * .36f, s * .06f))
}
ArcadeGame.Pairs -> for (i in 0..1) {
val at = Offset(c.x - s * .36f + i * s * .38f, c.y - s * .3f)
drawRoundRect(Color(0xFF1E3E8C), at, Size(s * .34f, s * .5f), androidx.compose.ui.geometry.CornerRadius(s * .04f))
drawRoundRect(Color.White, at, Size(s * .34f, s * .5f), androidx.compose.ui.geometry.CornerRadius(s * .04f), style = Stroke(s * .03f))
drawRoundRect(Ink, at, Size(s * .34f, s * .5f), androidx.compose.ui.geometry.CornerRadius(s * .04f), style = Stroke(s * .03f))
drawCircle(Color(0xFFFFD84A), s * .08f, at + Offset(s * .17f, s * .25f))
}
ArcadeGame.Patience -> for (i in 0..2) withTransform({ rotate(-18f + i * 18f, c + Offset(0f, s * .3f)) }) {
@@ -374,7 +374,7 @@ private fun GameCard(game: ArcadeGame, modifier: Modifier, focus: FocusRequester
Canvas(Modifier.size(34.dp)) { gameIcon(game) }
Box(Modifier.width(1.dp).fillMaxHeight(.7f).background(Muted.copy(alpha = .4f)))
Column(verticalArrangement = Arrangement.spacedBy(1.dp)) {
Text(game.title.uppercase().takeIf { game == ArcadeGame.OrbMan } ?: game.title, color = Color.White, fontFamily = Marquee, fontSize = 17.sp, lineHeight = 20.sp, maxLines = 1)
Text(game.title.uppercase().takeIf { game == ArcadeGame.OrbMan } ?: game.title, color = Ink, fontFamily = Marquee, fontSize = 17.sp, lineHeight = 20.sp, maxLines = 1)
Text(game.tagline, color = Muted, fontSize = 11.sp, lineHeight = 14.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis)
}
}
@@ -454,11 +454,11 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit) {
verticalArrangement = Arrangement.spacedBy(8.dp)) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(14.dp)) {
Column {
if (chosen == ArcadePick) Text("ARCADE PICK", Modifier.background(Yellow, RoundedCornerShape(4.dp)).padding(horizontal = 8.dp, vertical = 2.dp), color = Navy, fontSize = 11.sp, fontWeight = FontWeight.Bold)
Text(chosen.title.uppercase(), color = Color.White, fontFamily = Marquee, fontSize = 36.sp, maxLines = 1)
if (chosen == ArcadePick) Text("ARCADE PICK", Modifier.background(Yellow, RoundedCornerShape(4.dp)).padding(horizontal = 8.dp, vertical = 2.dp), color = OnAccent, fontSize = 11.sp, fontWeight = FontWeight.Bold)
Text(chosen.title.uppercase(), color = Ink, fontFamily = Marquee, fontSize = 36.sp, maxLines = 1)
}
Box(Modifier.width(1.dp).height(40.dp).background(Muted.copy(alpha = .5f)))
Text(chosen.tagline, color = Color.White, fontSize = 14.sp, maxLines = 2)
Text(chosen.tagline, color = Ink, fontSize = 14.sp, maxLines = 2)
}
Box(Modifier.fillMaxWidth().weight(1f).background(Color(0xFF050E2A), RoundedCornerShape(8.dp)).border(2.dp, Color(0xFF3D63FF), RoundedCornerShape(8.dp)).padding(6.dp)) {
when (chosen) {
@@ -488,12 +488,12 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit) {
}
}
}
Text(chosen.blurb, color = Color.White, fontSize = 14.sp, maxLines = 2)
Text(chosen.blurb, color = Ink, fontSize = 14.sp, maxLines = 2)
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(14.dp)) {
bestLine(chosen)?.let { Text(if (chosen == ArcadeGame.Patience) "Games: " else "Your best: ", color = Color.White, fontSize = 15.sp); Text(it, color = Yellow, fontFamily = Marquee, fontSize = 20.sp) }
bestLine(chosen)?.let { Text(if (chosen == ArcadeGame.Patience) "Games: " else "Your best: ", color = Ink, fontSize = 15.sp); Text(it, color = Yellow, fontFamily = Marquee, fontSize = 20.sp) }
?: Text("New to you", color = Muted, fontSize = 15.sp)
Box(Modifier.width(1.dp).height(24.dp).background(Muted.copy(alpha = .5f)))
Text("OK Play", Modifier.background(Yellow, RoundedCornerShape(5.dp)).padding(horizontal = 12.dp, vertical = 3.dp), color = Navy, fontSize = 15.sp, fontWeight = FontWeight.Bold)
Text("OK Play", Modifier.background(Yellow, RoundedCornerShape(5.dp)).padding(horizontal = 12.dp, vertical = 3.dp), color = OnAccent, fontSize = 15.sp, fontWeight = FontWeight.Bold)
}
}
// Every game, two to a row, then what you played last.
@@ -510,7 +510,7 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit) {
if (recent.isNotEmpty()) {
Spacer(Modifier.height(2.dp))
Box(Modifier.fillMaxWidth().height(1.dp).background(Muted.copy(alpha = .3f)))
Text("RECENTLY PLAYED", color = Color.White, fontFamily = Marquee, fontSize = 16.sp)
Text("RECENTLY PLAYED", color = Ink, fontFamily = Marquee, fontSize = 16.sp)
Row(Modifier.fillMaxWidth().height(46.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
recent.take(3).forEach { game ->
var focused by remember { mutableStateOf(false) }
@@ -520,7 +520,7 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit) {
.clickable { play(game) }.padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Canvas(Modifier.size(30.dp)) { gameIcon(game) }
Column {
Text(game.title, color = Color.White, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
Text(game.title, color = Ink, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
Text(bestLine(game)?.let { "Your best: $it" } ?: "Played recently", color = Muted, fontSize = 10.sp, maxLines = 1)
}
}
@@ -142,7 +142,12 @@ internal fun StarrySky(modifier: Modifier = Modifier) {
Canvas(modifier.fillMaxSize()) {
val stars = java.util.Random(5)
repeat(140) {
drawCircle(Color(0xFF3C5078).copy(alpha = .55f + stars.nextFloat() * .45f), .8f + stars.nextFloat() * 1.6f, Offset(stars.nextFloat() * size.width, stars.nextFloat() * size.height))
drawCircle(OrbitTheme.palette.stars.copy(alpha = .55f + stars.nextFloat() * .45f), .8f + stars.nextFloat() * 1.6f, Offset(stars.nextFloat() * size.width, stars.nextFloat() * size.height))
}
// Retro Tube's telly: fine scanlines across the whole screen.
if (OrbitTheme.palette.scanlines) {
var y = 0f
while (y < size.height) { drawRect(Color.Black.copy(alpha = .16f), Offset(0f, y), androidx.compose.ui.geometry.Size(size.width, 1.5f)); y += 4f }
}
}
}
@@ -163,7 +168,7 @@ internal fun WhosWatching(onClose: () -> Unit) {
Box(Modifier.fillMaxSize()) {
Column(Modifier.align(Alignment.Center), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(28.dp)) {
Image(painterResource(R.drawable.orbit_logo), "Orbit", Modifier.width(150.dp).height(38.dp))
Text("Who's watching?", color = Color.White, fontFamily = Anton, fontSize = 40.sp)
Text("Who's watching?", color = Ink, fontFamily = Anton, fontSize = 40.sp)
Row(horizontalArrangement = Arrangement.spacedBy(56.dp)) {
// Kids first, so a child's OK goes straight to their own.
Profiles.all.sortedBy { if (it.kind == ProfileKind.Kids) 0 else 1 }.forEachIndexed { i, p ->
@@ -178,7 +183,7 @@ internal fun WhosWatching(onClose: () -> Unit) {
drawArc(Yellow, 180f, 180f, false, Offset(s * .27f, s * .12f), Size(s * .46f, s * .62f), style = androidx.compose.ui.graphics.drawscope.Stroke(s * .1f))
}
}
Text(p.name, color = if (focused) Yellow else Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text(p.name, color = if (focused) Yellow else Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
if (p.kind == ProfileKind.Grown && AfterDarkLock.pinSet) Text("PIN", color = Muted, fontSize = 13.sp)
}
}
@@ -190,7 +195,7 @@ internal fun WhosWatching(onClose: () -> Unit) {
Box(Modifier.fillMaxSize().background(Navy.copy(alpha = .85f)), contentAlignment = Alignment.Center) {
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) {
ProfileAvatar(p.picture, 90.dp)
Text(p.name, color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text(p.name, color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
PinEntry("Enter the PIN", problem, onDone = { pin ->
if (AfterDarkLock.unlock(context, pin)) { asking = null; Profiles.current = p } else problem = "That's not the PIN"
}, onCancel = { asking = null })
@@ -220,7 +225,7 @@ internal fun ProfilesDetail(firstSwitch: FocusRequester, modifier: Modifier) {
Column(Modifier.then(if (pic == p.picture) Modifier.focusRequester(first) else Modifier).onFocusChanged { focused = it.isFocused }
.clickable { Profiles.update(context, p.copy(picture = pic)); choosingFor = null }, horizontalAlignment = Alignment.CenterHorizontally) {
ProfileAvatar(pic, 64.dp, ringed = focused)
Text(pictureName(pic) + if (pic == p.picture) " (now)" else "", color = if (focused) Yellow else Color.White, fontSize = 11.sp, maxLines = 1)
Text(pictureName(pic) + if (pic == p.picture) " (now)" else "", color = if (focused) Yellow else Ink, fontSize = 11.sp, maxLines = 1)
}
}
}
@@ -230,7 +235,7 @@ internal fun ProfilesDetail(firstSwitch: FocusRequester, modifier: Modifier) {
Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
ProfileAvatar(grown.picture, 48.dp)
Text(grown.name, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))
Text(grown.name, color = Ink, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))
OrbitButton("Change picture", Modifier.focusRequester(firstSwitch), onClick = { choosingFor = grown })
}
// The PIN: what keeps Grown-ups, After Dark and The Late Show for grown-ups.
@@ -238,7 +243,7 @@ internal fun ProfilesDetail(firstSwitch: FocusRequester, modifier: Modifier) {
if (kids != null) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.padding(top = 6.dp)) {
ProfileAvatar(kids.picture, 48.dp)
Text(kids.name, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))
Text(kids.name, color = Ink, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))
OrbitButton("Change picture", onClick = { choosingFor = kids })
OrbitButton("Arcade: ${if (kids.arcade) "On" else "Off"}", selected = kids.arcade, onClick = { Profiles.update(context, kids.copy(arcade = !kids.arcade)) })
OrbitButton("Drive-In: ${if (kids.driveIn) "On" else "Off"}", selected = kids.driveIn, onClick = { Profiles.update(context, kids.copy(driveIn = !kids.driveIn)) })
@@ -255,10 +260,10 @@ internal fun ProfilesDetail(firstSwitch: FocusRequester, modifier: Modifier) {
.clickable { Profiles.update(context, kids.copy(channels = if (on) kids.channels - programming.number else kids.channels + programming.number)) }
.padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {
val brand = ChannelBrands.forNumber(programming.number)
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.width(84.dp).height(26.dp)) else Text(programming.name, color = Color.White, fontSize = 13.sp)
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.width(84.dp).height(26.dp)) else Text(programming.name, color = Ink, fontSize = 13.sp)
Spacer(Modifier.weight(1f))
Box(Modifier.size(22.dp).background(if (on) Color(0xFF6EDCAA) else Color(0xFF283C64), RoundedCornerShape(5.dp)), contentAlignment = Alignment.Center) {
if (on) Text("✓", color = Navy, fontSize = 14.sp, fontWeight = FontWeight.Bold)
Box(Modifier.size(22.dp).background(if (on) themed(Color(0xFF6EDCAA)) { Mint } else themed(Color(0xFF283C64)) { Blue }, RoundedCornerShape(5.dp)), contentAlignment = Alignment.Center) {
if (on) Text("✓", color = OnAccent, fontSize = 14.sp, fontWeight = FontWeight.Bold)
}
}
}
@@ -89,7 +89,7 @@ internal fun PromoOverlay(session: EmbySampleSession, item: WhatsOnItem) {
Box(Modifier.fillMaxSize().background(Color.Black.copy(alpha = .3f)))
Text(item.title.uppercase(), Modifier.align(Alignment.BottomStart).padding(14.dp), color = Color.White, fontFamily = Anton, fontSize = 26.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
item.detail?.let { Text(it, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis) }
item.detail?.let { Text(it, color = Ink, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis) }
Text("From ${clock(item.startMs)}", color = Muted, fontSize = 16.sp)
}
// Ollie rolls in from the left and Bumble buzzes in from the right, then they bob and blink.
@@ -33,7 +33,7 @@ internal class SecureMediaDataSource(private val session: EmbySampleSession) : B
next.instanceFollowRedirects = false
next.connectTimeout = 10_000
next.readTimeout = 20_000
next.setRequestProperty("User-Agent", "OrbitTV/0.108.41")
next.setRequestProperty("User-Agent", "OrbitTV/0.108.42")
next.setRequestProperty("Accept-Encoding", "identity")
session.mediaHeaders(address).forEach { (key, value) -> next.setRequestProperty(key, value) }
if (dataSpec.position != 0L || dataSpec.length != C.LENGTH_UNSET.toLong()) {
@@ -109,6 +109,10 @@ internal class OrbitSettings(context: Context) {
get() = saved.getBoolean("cast_on", true)
set(value) { saved.edit().putBoolean("cast_on", value).apply() }
/** Turns off moving presentation such as the Drive-In's curtains. More screens will follow it as they gain motion. */
/** The chosen look ([OrbitLook]); Orbit Night until one is chosen. */
var look: OrbitLook
get() = saved.getString("look", null)?.let { name -> OrbitLook.entries.firstOrNull { it.name == name } } ?: OrbitLook.Night
set(value) { saved.edit().putString("look", value.name).apply() }
var reduceMotion: Boolean
get() = saved.getBoolean("reduce_motion", false)
set(value) { saved.edit().putBoolean("reduce_motion", value).apply() }
@@ -120,6 +124,7 @@ internal enum class SettingsSection(val label: String, val icon: Int) {
Arrivals("New arrivals", R.drawable.orbit_icon_movies),
Director("Director's Chair", R.drawable.orbit_icon_entertainment),
Profiles("Profiles", R.drawable.orbit_icon_profile),
Look("Look", R.drawable.orbit_icon_all),
Account("Emby account", R.drawable.orbit_icon_profile),
}
@@ -146,7 +151,7 @@ private fun RailItem(section: SettingsSection, selected: Boolean, modifier: Modi
.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(painterResource(section.icon), null, Modifier.size(26.dp), colorFilter = if (focused) ColorFilter.tint(Navy) else null)
Text(section.label, color = if (focused) Navy else Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
Text(section.label, color = if (focused) OnAccent else Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
}
}
@@ -155,7 +160,7 @@ private fun RailItem(section: SettingsSection, selected: Boolean, modifier: Modi
private 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 = Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
Text(title, color = Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
Text(detail, color = Muted, fontSize = 12.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
}
button()
@@ -167,7 +172,7 @@ private fun ChannelsDetail(busy: Boolean, message: String?, isOn: (Int) -> Boole
onSwitch: (ChannelProgramming, Boolean) -> Unit, onSuggestions: (ChannelProgramming) -> Unit, firstSwitch: FocusRequester, list: LazyListState, modifier: Modifier) {
val all = SmartChannels.sortedBy { it.number }
Column(modifier, verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("${all.count { isOn(it.number) }} of ${all.size} channels on", color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.SemiBold)
Text("${all.count { isOn(it.number) }} of ${all.size} channels on", color = Ink, fontSize = 18.sp, fontWeight = FontWeight.SemiBold)
Text("A channel that's on runs its full schedule. Once it's been on, turning it off leaves a short repeat.", color = Muted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
message?.let { Text(it, color = Yellow, fontSize = 13.sp, maxLines = 3, overflow = TextOverflow.Ellipsis) }
LazyColumn(Modifier.weight(1f), state = list, verticalArrangement = Arrangement.spacedBy(4.dp)) {
@@ -180,7 +185,7 @@ private fun ChannelsDetail(busy: Boolean, message: String?, isOn: (Int) -> Boole
Row(Modifier.fillMaxWidth().clip(RailCorner).background(Panel).padding(horizontal = 8.dp, vertical = 4.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Text(programming.number.toString(), Modifier.width(30.dp), color = Muted, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.width(88.dp).height(28.dp))
Text(brand?.displayName ?: programming.name, Modifier.weight(1f), color = Color.White, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
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) })
OrbitButton(if (on) "On" else "Off", Modifier.width(64.dp).then(if (programming == all.first()) Modifier.focusRequester(firstSwitch) else Modifier), selected = on, enabled = !busy, onClick = { onSwitch(programming, !on) })
}
@@ -308,7 +313,7 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio
val scope = rememberCoroutineScope()
LaunchedEffect(Unit) { firstFocus.requestFocus() }
Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text("Settings", color = Color.White, fontSize = 22.sp, fontWeight = FontWeight.SemiBold)
Text("Settings", color = Ink, fontSize = 22.sp, fontWeight = FontWeight.SemiBold)
Row(Modifier.fillMaxWidth().weight(1f), horizontalArrangement = Arrangement.spacedBy(14.dp)) {
Column(Modifier.width(176.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
SettingsSection.entries.forEach { item ->
@@ -325,6 +330,10 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio
SettingsSection.Arrivals -> arrivals(detail, firstSwitch)
SettingsSection.Director -> director(detail, firstSwitch)
SettingsSection.Profiles -> ProfilesDetail(firstSwitch, detail)
SettingsSection.Look -> Column(detail, verticalArrangement = Arrangement.spacedBy(10.dp)) {
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 = 13.sp)
LookPicker(firstSwitch, cardWidth = 190.dp)
}
SettingsSection.Account -> AccountDetail(server, titles, onSignOut, onRemoveServer, firstSwitch, detail)
}
}
@@ -84,7 +84,7 @@ internal fun SleepWarning(modifier: Modifier = Modifier) {
Column(modifier.width(400.dp).background(Navy.copy(alpha = .96f), corner).border(2.dp, Yellow, corner).padding(horizontal = 22.dp, vertical = 16.dp),
verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("SLEEP TIMER", color = Yellow, fontFamily = Anton, fontSize = 18.sp)
Text("Orbit switches off in 1 minute", color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text("Orbit switches off in 1 minute", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text("Press any button to keep watching", color = Muted, fontSize = 15.sp)
}
}
@@ -107,7 +107,7 @@ internal fun LunaGoodnight(modifier: Modifier = Modifier) {
val stars = java.util.Random(11)
repeat(70) {
val twinkle = if (calm) .5f else .35f + .3f * kotlin.math.sin(t / 900.0 + it).toFloat()
drawCircle(Color.White.copy(alpha = twinkle), 1f + stars.nextFloat() * 1.6f, androidx.compose.ui.geometry.Offset(stars.nextFloat() * size.width, stars.nextFloat() * size.height))
drawCircle(Ink.copy(alpha = twinkle), 1f + stars.nextFloat() * 1.6f, androidx.compose.ui.geometry.Offset(stars.nextFloat() * size.width, stars.nextFloat() * size.height))
}
val luna = androidx.compose.ui.geometry.Offset(size.width / 2, size.height * .4f)
val r = size.minDimension * .14f
@@ -119,12 +119,12 @@ internal fun LunaGoodnight(modifier: Modifier = Modifier) {
val at = luna + androidx.compose.ui.geometry.Offset(r * (1.1f + k * .45f + rise * .3f), -r * (.6f + k * .45f + rise * .6f))
val z = r * (.18f + k * .06f)
val p = androidx.compose.ui.graphics.Path().apply { moveTo(at.x, at.y); lineTo(at.x + z, at.y); lineTo(at.x, at.y + z); lineTo(at.x + z, at.y + z) }
drawPath(p, Color.White.copy(alpha = if (calm) .8f else .9f * (1f - rise * .7f)), style = androidx.compose.ui.graphics.drawscope.Stroke(z * .18f))
drawPath(p, Ink.copy(alpha = if (calm) .8f else .9f * (1f - rise * .7f)), style = androidx.compose.ui.graphics.drawscope.Stroke(z * .18f))
}
}
Column(Modifier.align(androidx.compose.ui.Alignment.BottomCenter).padding(bottom = 70.dp), horizontalAlignment = androidx.compose.ui.Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("Goodnight from Orbit", color = Color.White, fontFamily = Anton, fontSize = 34.sp)
Text("Goodnight from Orbit", color = Ink, fontFamily = Anton, fontSize = 34.sp)
Text("Luna's turning the lights down. Sleep well.", color = Muted, fontSize = 17.sp)
Text("Any button keeps Orbit on", color = Muted.copy(alpha = .7f), fontSize = 12.sp, modifier = Modifier.padding(top = 10.dp))
}
@@ -69,7 +69,7 @@ internal fun SqueezePanel(session: EmbySampleSession, channel: SampleChannel, cu
Box(Modifier.fillMaxWidth().height(160.dp).clip(RoundedCornerShape(8.dp)).background(Panel)) {
ProgrammeArtwork(session, channel, next, Modifier.fillMaxSize())
}
Text(if (keep) (detail ?: name) else name, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(if (keep) (detail ?: name) else name, color = Ink, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(when {
keep -> "Straight after the credits"
detail != null -> detail
@@ -93,7 +93,7 @@ internal fun SqueezePanel(session: EmbySampleSession, channel: SampleChannel, cu
later.forEach { show ->
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {
Text(clock(show.startMs), color = Yellow, fontFamily = BarlowCondensed, fontSize = 18.sp)
Text(guideTitleParts(show.media.item.title).first, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 200.dp))
Text(guideTitleParts(show.media.item.title).first, color = Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 200.dp))
}
}
}
@@ -185,7 +185,7 @@ internal fun TakeoverIdent(t: Takeover, modifier: Modifier = Modifier) {
@Composable
internal fun KidsAsleep(channel: SampleChannel, t: Takeover, modifier: Modifier = Modifier) {
val (clock, calm) = motionClock()
Box(modifier.fillMaxSize().background(Navy)) {
Box(modifier.fillMaxSize().background(NightNavy)) {
StarrySky()
Column(Modifier.align(Alignment.Center).width(560.dp).background(Color(0xFF0C2148), RoundedCornerShape(20.dp)).padding(28.dp),
horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) {
@@ -194,8 +194,8 @@ internal fun KidsAsleep(channel: SampleChannel, t: Takeover, modifier: Modifier
drawNightCap(center + Offset(0f, size.height * .1f + bob), size.minDimension * .32f, !calm && (clock % 3_400) < 150)
}
Text("${ChannelBrands.displayName(channel).removePrefix("Orbit ")} is asleep", color = Color.White, fontFamily = Anton, fontSize = 34.sp)
Text("It's back for Kids at 6am.", color = Muted, fontSize = 17.sp, textAlign = TextAlign.Center)
Text("Up and down still go to Kids' other channels.", color = Muted, fontSize = 14.sp)
Text("It's back for Kids at 6am.", color = NightMuted, fontSize = 17.sp, textAlign = TextAlign.Center)
Text("Up and down still go to Kids' other channels.", color = NightMuted, fontSize = 14.sp)
}
}
}
@@ -0,0 +1,124 @@
package tv.orbit.classic
import android.content.Context
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.lerp
/**
* Orbit's looks (Paul, 5 November 2026, design/first-run/themes.png): six palettes, chosen at the start of onboarding or in
* Settings, applied at once everywhere. Every screen takes its colours from these tokens; nothing keeps a fixed navy or gold.
* Things with their own colours stay as they are in every look: the cast, the channels' idents and marks, the games' boards,
* and anything drawn over a picture. Orbit Night is the original, colour for colour.
*/
internal class Palette(
/** The page behind everything. */
val background: Color,
/** Cards, rows and panels. */
val surface: Color,
/** A raised strip on a panel: the guide's header, a selected tab. */
val raised: Color,
/** Focus, highlights and headings. */
val accent: Color,
/** Body text. */
val ink: Color,
/** Secondary text. */
val muted: Color,
/** A panel set deeper than the page. */
val deep: Color,
/** Information and links. */
val sky: Color,
/** Good news: on now, done, available. */
val mint: Color,
/** Text on the accent colour. */
val onAccent: Color,
/** The star field behind the screens. */
val stars: Color,
/** The Drive-In's and the Chair's warmer gold. */
val gold: Color = accent,
/** The guide's later programmes. */
val later: Color = lerp(background, surface, .45f),
/** The Director's Chair's page and panels. */
val chairPage: Color = background,
val chairPanel: Color = lerp(background, surface, .75f),
/** Catch Up's dimmed cards. */
val dim: Color = lerp(background, surface, .2f),
/** Light looks put dark text on light panels. */
val light: Boolean = false,
/** Retro Tube's scanlines over the star field. */
val scanlines: Boolean = false)
internal enum class OrbitLook(val title: String, val line: String, val palette: Palette) {
Night("Orbit Night", "The original: deep navy and gold", Palette(
background = Color(0xFF071632), surface = Color(0xFF12356B), raised = Color(0xFF194C91), accent = Color(0xFFFFDE59),
ink = Color.White, muted = Color(0xFFB7CBE8), deep = Color(0xFF0C2148), sky = Color(0xFF7FD1FF), mint = Color(0xFF7EE0A8),
onAccent = Color(0xFF071632), stars = Color(0xFF3C5078), gold = Color(0xFFF2C14E), later = Color(0xFF0F2C5C),
chairPage = Color(0xFF07163A), chairPanel = Color(0xFF10285A), dim = Color(0xFF0C2046))),
Daybreak("Daybreak", "Light and airy, for bright rooms", Palette(
background = Color(0xFFE8F1FB), surface = Color(0xFFFFFFFF), raised = Color(0xFFD2E2F6), accent = Color(0xFF1E66D0),
ink = Color(0xFF0E1E3C), muted = Color(0xFF4A5D7A), deep = Color(0xFFDCE8F6), sky = Color(0xFF1A6FB8), mint = Color(0xFF1C8A58),
onAccent = Color.White, stars = Color(0xFFBED2EB), gold = Color(0xFFB7791F), later = Color(0xFFF3F8FD),
chairPage = Color(0xFFE8F1FB), chairPanel = Color(0xFFF7FAFE), dim = Color(0xFFDDE7F3), light = true)),
Nebula("Nebula", "Purples and pinks of deep space", Palette(
background = Color(0xFF170B2E), surface = Color(0xFF3A1D6B), raised = Color(0xFF522D8F), accent = Color(0xFFFF7AC6),
ink = Color.White, muted = Color(0xFFC8B4E6), deep = Color(0xFF22113F), sky = Color(0xFFA9C8FF), mint = Color(0xFF8FE8C0),
onAccent = Color(0xFF170B2E), stars = Color(0xFF5A3C8C), gold = Color(0xFFFFB0DC))),
RetroTube("Retro Tube", "Warm 80s telly, with scanlines", Palette(
background = Color(0xFF1A120B), surface = Color(0xFF3B2A1A), raised = Color(0xFF574029), accent = Color(0xFFFFB347),
ink = Color(0xFFFFECD2), muted = Color(0xFFD2B48C), deep = Color(0xFF241911), sky = Color(0xFF9FD3E0), mint = Color(0xFFA8DB8C),
onAccent = Color(0xFF1A120B), stars = Color(0xFF5A4632), gold = Color(0xFFFFC870), scanlines = true)),
DeepSea("Deep Sea", "Calm teal and aqua", Palette(
background = Color(0xFF04212B), surface = Color(0xFF0B4A5C), raised = Color(0xFF126378), accent = Color(0xFF6EF0D8),
ink = Color(0xFFF0FFFC), muted = Color(0xFFA0D2D2), deep = Color(0xFF072C38), sky = Color(0xFF8FD8FF), mint = Color(0xFF9CF5B4),
onAccent = Color(0xFF04212B), stars = Color(0xFF285A64), gold = Color(0xFFF5D76E))),
HighContrast("High Contrast", "Black, white and yellow: easiest to read", Palette(
background = Color.Black, surface = Color(0xFF1A1A1A), raised = Color(0xFF333333), accent = Color(0xFFFFFF00),
ink = Color.White, muted = Color(0xFFDCDCDC), deep = Color(0xFF0D0D0D), sky = Color(0xFF66CCFF), mint = Color(0xFF66FF99),
onAccent = Color.Black, stars = Color(0xFF3C3C3C), gold = Color(0xFFFFFF00), later = Color(0xFF111111),
chairPanel = Color(0xFF1A1A1A), dim = Color(0xFF0D0D0D)));
}
/** The look in use. Read during drawing, so changing it redraws every screen at once. */
internal object OrbitTheme {
var look by mutableStateOf(OrbitLook.Night)
private set
val palette get() = look.palette
fun load(context: Context) { look = OrbitSettings(context).look }
fun choose(context: Context, chosen: OrbitLook) { OrbitSettings(context).look = chosen; look = chosen }
/** For tests and previews. */
internal fun use(chosen: OrbitLook) { look = chosen }
}
// The tokens every screen uses. The names are the original look's, kept so each screen reads as it always has.
internal val Navy: Color get() = OrbitTheme.palette.background
internal val Panel: Color get() = OrbitTheme.palette.surface
internal val Blue: Color get() = OrbitTheme.palette.raised
internal val Yellow: Color get() = OrbitTheme.palette.accent
internal val Muted: Color get() = OrbitTheme.palette.muted
internal val Deep: Color get() = OrbitTheme.palette.deep
internal val Sky: Color get() = OrbitTheme.palette.sky
internal val Mint: Color get() = OrbitTheme.palette.mint
/** Text: white in the dark looks, dark in the light one. */
internal val Ink: Color get() = OrbitTheme.palette.ink
/** Text on [Yellow] (the accent). */
internal val OnAccent: Color get() = OrbitTheme.palette.onAccent
internal val Gold: Color get() = OrbitTheme.palette.gold
/** A colour a screen had before looks existed: exactly that in Orbit Night, and [other] in every other look. */
internal inline fun themed(night: Color, other: () -> Color): Color = if (OrbitTheme.look == OrbitLook.Night) night else other()
/**
* The original look's colours, fixed: for the things that keep their own colours in every look (the games' boards, the
* cast's bumpers, the channels' idents and the takeovers' marks).
*/
internal val NightNavy = OrbitLook.Night.palette.background
internal val NightPanel = OrbitLook.Night.palette.surface
internal val NightBlue = OrbitLook.Night.palette.raised
internal val NightYellow = OrbitLook.Night.palette.accent
internal val NightMuted = OrbitLook.Night.palette.muted
internal val NightDeep = OrbitLook.Night.palette.deep
internal val NightSky = OrbitLook.Night.palette.sky
internal val NightMint = OrbitLook.Night.palette.mint
@@ -65,7 +65,7 @@ internal fun ChannelNumberBox(entry: ChannelEntry, problem: String?, modifier: M
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
entry.digits.forEachIndexed { index, digit ->
Box(Modifier.size(36.dp, 42.dp).background(if (index == entry.slot) Yellow else Panel, RoundedCornerShape(4.dp)), contentAlignment = Alignment.Center) {
Text(digit.toString(), color = if (index == entry.slot) Navy else Color.White, fontSize = 22.sp, fontWeight = FontWeight.SemiBold)
Text(digit.toString(), color = if (index == entry.slot) OnAccent else Ink, fontSize = 22.sp, fontWeight = FontWeight.SemiBold)
}
}
}
@@ -102,7 +102,7 @@ internal fun TrackPanel(rows: List<TrackRow>, cursor: Int, modifier: Modifier =
if (index == first || rows[index - 1].section != row.section) Text(row.section, color = Muted, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.padding(top = if (index == 0) 0.dp else 6.dp))
val on = index == cursor
Text((if (row.selected) "✓ " else " ") + row.label, Modifier.fillMaxWidth().background(if (on) Yellow else Color.Transparent, RoundedCornerShape(4.dp)).padding(horizontal = 8.dp, vertical = 4.dp),
color = if (on) Navy else Color.White, fontSize = 15.sp, fontWeight = if (on || row.selected) FontWeight.SemiBold else FontWeight.Normal, maxLines = 1)
color = if (on) OnAccent else Ink, fontSize = 15.sp, fontWeight = if (on || row.selected) FontWeight.SemiBold else FontWeight.Normal, maxLines = 1)
}
if (first + TRACK_PANEL_ROWS < rows.size) Text("▼ more", color = Muted, fontSize = 11.sp)
Text("▲▼ Move OK Choose Back Close", color = Muted, fontSize = 11.sp, modifier = Modifier.padding(top = 4.dp))
@@ -30,9 +30,6 @@ import androidx.tv.material3.Text
import kotlinx.coroutines.delay
/** Orbit's v2 colours beyond the originals (design/whats-on/v2). */
internal val Deep = Color(0xFF0C2148)
internal val Sky = Color(0xFF7FD1FF)
internal val Mint = Color(0xFF7EE0A8)
internal val Anton = FontFamily(Font(R.font.anton_regular))
internal val BarlowCondensed = FontFamily(Font(R.font.barlow_condensed_medium))
private val Corner = RoundedCornerShape(6.dp)
@@ -51,7 +48,7 @@ private fun tagColour(tag: String) = when (tag) { "FIRST ON ORBIT", "COMPLETE ST
@Composable
private fun Tag(text: String, colour: Color = tagColour(text), size: Int = 10) {
Text(text, Modifier.background(colour, RoundedCornerShape(3.dp)).padding(horizontal = 6.dp, vertical = 2.dp), color = Navy, fontSize = size.sp, fontWeight = FontWeight.SemiBold, letterSpacing = .5.sp, maxLines = 1)
Text(text, Modifier.background(colour, RoundedCornerShape(3.dp)).padding(horizontal = 6.dp, vertical = 2.dp), color = OnAccent, fontSize = size.sp, fontWeight = FontWeight.SemiBold, letterSpacing = .5.sp, maxLines = 1)
}
@Composable
@@ -111,8 +108,8 @@ internal fun WhatsOnScreen(session: EmbySampleSession, plans: Map<Int, ChannelPl
Tag("TONIGHT'S PICK", Yellow, 11)
Logo(pick.channel, 96, 30)
Text(dayAndTime(pick.startMs, now), color = Yellow, fontFamily = BarlowCondensed, fontSize = 20.sp)
Text(pick.title.uppercase(java.util.Locale.UK), color = Color.White, fontFamily = Anton, fontSize = 30.sp, lineHeight = 32.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
pick.detail?.let { Text(it, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis) }
Text(pick.title.uppercase(java.util.Locale.UK), color = Ink, fontFamily = Anton, fontSize = 30.sp, lineHeight = 32.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
pick.detail?.let { Text(it, color = Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis) }
Spacer(Modifier.weight(1f))
Row(horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically) {
Tag(pick.tag)
@@ -122,7 +119,7 @@ internal fun WhatsOnScreen(session: EmbySampleSession, plans: Map<Int, ChannelPl
}
}
Column(Modifier.width(288.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(5.dp)) {
Text("TONIGHT ON ORBIT", color = Color.White, fontFamily = Anton, fontSize = 16.sp)
Text("TONIGHT ON ORBIT", color = Ink, fontFamily = Anton, fontSize = 16.sp)
if (page.tonight.isEmpty()) Text("Nothing else is marked out tonight. The TV Guide has every programme.", color = Muted, fontSize = 12.sp)
page.tonight.forEach { item ->
FocusCard(Modifier.fillMaxWidth().height(46.dp), onClick = { choose(item) }) { focused ->
@@ -130,7 +127,7 @@ internal fun WhatsOnScreen(session: EmbySampleSession, plans: Map<Int, ChannelPl
Text(if (item.startMs <= now) "NOW" else clock(item.startMs), Modifier.width(44.dp), color = Yellow, fontFamily = BarlowCondensed, fontSize = 18.sp)
Column(Modifier.weight(1f)) {
Logo(item.channel, 56, 17)
Text(item.title, color = Color.White, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(item.title, color = Ink, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
}
@@ -138,7 +135,7 @@ internal fun WhatsOnScreen(session: EmbySampleSession, plans: Map<Int, ChannelPl
}
}
Row(verticalAlignment = Alignment.Bottom, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Text("COMING UP", color = Color.White, fontFamily = Anton, fontSize = 16.sp)
Text("COMING UP", color = Ink, fontFamily = Anton, fontSize = 16.sp)
Text("Premieres, specials and events, already booked", color = Muted, fontSize = 11.sp)
}
Row(Modifier.fillMaxWidth().weight(1f), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
@@ -151,7 +148,7 @@ internal fun WhatsOnScreen(session: EmbySampleSession, plans: Map<Int, ChannelPl
Spacer(Modifier.weight(1f))
Logo(item.channel, 56, 17)
}
Text(item.title, color = Color.White, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(item.title, color = Ink, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Row(verticalAlignment = Alignment.CenterVertically) {
Text(dayAndTime(item.startMs, now), color = Yellow, fontFamily = BarlowCondensed, fontSize = 16.sp)
Spacer(Modifier.weight(1f))
@@ -180,11 +177,11 @@ private fun WhatsOnPopup(item: WhatsOnItem, nowMs: Long, reminded: Boolean, onWa
Box(Modifier.fillMaxSize().background(Navy.copy(alpha = .8f)), contentAlignment = Alignment.Center) {
Column(Modifier.width(600.dp).background(Deep, RoundedCornerShape(10.dp)).border(1.dp, Blue, RoundedCornerShape(10.dp)).padding(20.dp), verticalArrangement = Arrangement.spacedBy(7.dp)) {
Logo(item.channel, 96, 30)
Text(item.title.uppercase(java.util.Locale.UK), color = Color.White, fontFamily = Anton, fontSize = 32.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
item.detail?.let { Text(it, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis) }
Text(item.title.uppercase(java.util.Locale.UK), color = Ink, fontFamily = Anton, fontSize = 32.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
item.detail?.let { Text(it, color = Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis) }
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
Tag(item.tag)
Text("${(item.endMs - item.startMs) / 60_000} min", Modifier.border(1.dp, Muted, RoundedCornerShape(3.dp)).padding(horizontal = 6.dp, vertical = 1.dp), color = Color.White, fontSize = 10.sp)
Text("${(item.endMs - item.startMs) / 60_000} min", Modifier.border(1.dp, Muted, RoundedCornerShape(3.dp)).padding(horizontal = 6.dp, vertical = 1.dp), color = Ink, fontSize = 10.sp)
}
Row(Modifier.fillMaxWidth().background(Panel, Corner).padding(12.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Text("${dayAndTime(item.startMs, nowMs)} to ${clock(item.endMs)}", color = Yellow, fontFamily = BarlowCondensed, fontSize = 22.sp)
@@ -217,7 +214,7 @@ internal fun ProgrammeReminderCard(reminder: ProgrammeReminder, nowMs: Long, onW
val left = ((reminder.startMs - nowMs + 59_999) / 60_000).coerceAtLeast(1)
Text(if (reminder.stage == 2) "STARTING NOW" else "STARTS IN $left ${if (left == 1L) "MINUTE" else "MINUTES"}", color = Yellow, fontFamily = Anton, fontSize = 16.sp, maxLines = 1)
Logo(reminder.channel, 84, 26)
Text(reminder.title, color = Color.White, fontWeight = FontWeight.SemiBold, fontSize = 19.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(reminder.title, color = Ink, fontWeight = FontWeight.SemiBold, fontSize = 19.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OrbitButton("Watch", Modifier.focusRequester(first), onClick = onWatch)
OrbitButton(if (reminder.stage == 2) "Not now" else "Later", onClick = onDismiss)
@@ -5,7 +5,7 @@ import org.junit.Test
class OnboardingTest {
@Test fun theStepsRunInTheDesignedOrder() {
assertEquals(listOf("Welcome", "Server", "Sign in", "Channels", "Who watches", "All set"), OnboardStep.entries.map { it.label })
assertEquals(listOf("Welcome", "Look", "Server", "Sign in", "Channels", "Who watches", "All set"), OnboardStep.entries.map { it.label })
}
@Test fun theStartingChannelsAreRealAndNeverAfterDark() {
@@ -0,0 +1,49 @@
package tv.orbit.classic
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.luminance
import org.junit.After
import org.junit.Assert.*
import org.junit.Test
/** The six looks (Paul, 5 November 2026): Orbit Night exactly as it was, and every look readable. */
class ThemesTest {
@After fun reset() = OrbitTheme.use(OrbitLook.Night)
private fun contrast(a: Color, b: Color): Double {
val (hi, lo) = listOf(a.luminance().toDouble(), b.luminance().toDouble()).sortedDescending()
return (hi + .05) / (lo + .05)
}
@Test fun orbitNightIsTheOriginalColourForColour() {
OrbitTheme.use(OrbitLook.Night)
assertEquals(Color(0xFF071632), Navy); assertEquals(Color(0xFF12356B), Panel); assertEquals(Color(0xFF194C91), Blue)
assertEquals(Color(0xFFFFDE59), Yellow); assertEquals(Color(0xFFB7CBE8), Muted); assertEquals(Color(0xFF0C2148), Deep)
assertEquals(Color(0xFF7FD1FF), Sky); assertEquals(Color(0xFF7EE0A8), Mint); assertEquals(Color.White, Ink); assertEquals(Navy, OnAccent)
assertEquals(Color(0xFFF2C14E), Gold)
assertEquals(Color(0xFF0A1E42), themed(Color(0xFF0A1E42)) { Deep })
}
@Test fun everyLookIsReadable() {
for (look in OrbitLook.entries) {
val p = look.palette
for ((name, back) in listOf("background" to p.background, "surface" to p.surface, "deep" to p.deep, "later" to p.later, "chair" to p.chairPanel)) {
assertTrue("${look.title}: text on $name ${contrast(p.ink, back)}", contrast(p.ink, back) >= 7.0)
assertTrue("${look.title}: secondary text on $name ${contrast(p.muted, back)}", contrast(p.muted, back) >= 4.5)
}
assertTrue("${look.title}: text on raised", contrast(p.ink, p.raised) >= 4.5)
assertTrue("${look.title}: text on the accent ${contrast(p.onAccent, p.accent)}", contrast(p.onAccent, p.accent) >= 4.5)
assertTrue("${look.title}: focus ring on panels ${contrast(p.accent, p.surface)}", contrast(p.accent, p.surface) >= 3.0)
for ((name, c) in listOf("sky" to p.sky, "mint" to p.mint, "gold" to p.gold))
assertTrue("${look.title}: $name on the page ${contrast(c, p.background)}", contrast(c, p.background) >= 3.0)
assertTrue("${look.title}: tags on mint", contrast(p.onAccent, p.mint) >= 3.0)
}
}
@Test fun theChosenLookIsWhatEveryTokenReads() {
OrbitTheme.use(OrbitLook.Daybreak)
assertEquals(OrbitLook.Daybreak.palette.background, Navy); assertEquals(OrbitLook.Daybreak.palette.ink, Ink)
assertNotEquals(Color(0xFF0A1E42), themed(Color(0xFF0A1E42)) { Deep })
// Things with their own colours keep them.
assertEquals(Color(0xFF071632), NightNavy)
}
}