Performance pass: minute clocks, pictures decoded once (0.108.62)
Paul, 6 November 2026: still stuttering, with slow frames held up on the UI thread. Screens that only show hours and minutes rebuilt every second; the main screen rebuilt every second for a sign-in timer; the top bar's clock rebuilt the whole app; and every logo and picture was decoded again each time a screen showed it. Now clocks move on as the minute turns, the sign-in timer is read through derived state, the top bar clock stands alone, and pictures are decoded once into a shared cache (guide logos ahead, in the background). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
||||
applicationId = "tv.orbit.classic"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
versionCode = 221
|
||||
versionName = "0.108.61-finished-build"
|
||||
versionCode = 222
|
||||
versionName = "0.108.62-smoother"
|
||||
}
|
||||
buildFeatures { compose = true }
|
||||
// The finished build for the TVs (Paul, 6 November 2026: the test build stuttered on the box). Not debuggable, so
|
||||
|
||||
@@ -20,7 +20,6 @@ import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
@@ -85,7 +84,7 @@ private fun PairsCard(channel: Int, up: Boolean, matched: Boolean, selected: Boo
|
||||
if (channel == 0) drawOrbMascot(center, r * .8f)
|
||||
else drawOrbChaser(center, r, OrbCharacter.entries[channel - 1], OrbDir.Down, scared = false, returning = false, blink = false, wobble = 0f)
|
||||
}
|
||||
else 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 if (turn > .5f) ChannelBrands.forNumber(channel)?.let { Image(cachedPainter(it.logo), it.displayName, Modifier.fillMaxSize().padding(10.dp).alpha(if (matched) .7f else 1f)) }
|
||||
else Text("O", color = NightMuted.copy(alpha = .5f), fontFamily = Marquee, fontSize = 26.sp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -197,7 +196,7 @@ private fun CatchUpTile(entry: CatchUpEntry, nowMs: Long, on: Boolean, modifier:
|
||||
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)
|
||||
if (mark != null) Image(painterResource(mark.logo), mark.displayName, Modifier.logoPlate().width(60.dp).height(18.dp))
|
||||
if (mark != null) Image(cachedPainter(mark.logo), mark.displayName, Modifier.logoPlate().width(60.dp).height(18.dp))
|
||||
else Text(ChannelBrands.displayName(entry.channel), color = ink, fontSize = 11.sp, maxLines = 1)
|
||||
Spacer(Modifier.weight(1f))
|
||||
CatchUpMark()
|
||||
|
||||
@@ -39,6 +39,8 @@ internal object ChannelBrands {
|
||||
201 to ChannelBranding("orbit-terra", "Orbit Terra", R.drawable.orbit_terra_epg, R.drawable.orbit_terra_background, R.drawable.orbit_terra_bug, ChannelCategory.Documentaries),
|
||||
106 to ChannelBranding("paradox", "Orbit Paradox", R.drawable.paradox_epg, R.drawable.paradox_background, R.drawable.paradox_bug, ChannelCategory.Entertainment))
|
||||
fun forNumber(number: Int): ChannelBranding? = brands[number]
|
||||
/** Every channel's guide logo, to decode ahead. */
|
||||
fun allLogos(): List<Int> = brands.values.map { it.logo }.distinct()
|
||||
/** Saved channels keep their original names; what the viewer sees comes from the brand. */
|
||||
fun displayName(channel: SampleChannel) = brands[channel.number]?.displayName ?: channel.name
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.tv.material3.Text
|
||||
@@ -18,11 +17,11 @@ internal fun ChannelTuningBackdrop(number: Int, modifier: Modifier = Modifier, a
|
||||
Box(modifier.fillMaxSize().background(Navy)) {
|
||||
artwork()
|
||||
if (branding != null) {
|
||||
Image(painterResource(branding.logo), null,
|
||||
Image(cachedPainter(branding.logo), null,
|
||||
Modifier.align(Alignment.TopStart).padding(start = 40.dp, top = 32.dp).logoPlate().width(200.dp).height(62.dp))
|
||||
}
|
||||
if (number == TOTS_NUMBER && totsMood(System.currentTimeMillis()).evening)
|
||||
Image(painterResource(R.drawable.orbit_tots_sleepy), null, Modifier.align(Alignment.Center).size(180.dp))
|
||||
Image(cachedPainter(R.drawable.orbit_tots_sleepy), null, Modifier.align(Alignment.Center).size(180.dp))
|
||||
ClassicTuningNumber(number, Modifier.align(Alignment.TopEnd).padding(top = 32.dp, end = 44.dp))
|
||||
Column(Modifier.align(Alignment.BottomStart).padding(start = 40.dp, bottom = 36.dp).background(Navy.copy(alpha = .78f)).padding(horizontal = 12.dp, vertical = 6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
Text("Tuning…", color = Muted, fontSize = 17.sp)
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.Locale
|
||||
/** First visual pass: the icon row previews the future scheduled-channel controls. */
|
||||
@Composable
|
||||
internal fun ClassicProgrammeStrip(item: SampleItem, playing: Boolean, modifier: Modifier = Modifier, scheduled: ScheduledPlayback? = null) {
|
||||
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
LaunchedEffect(Unit) { while (true) { delay(1000); now = System.currentTimeMillis() } }
|
||||
// Moves on as the minute turns: nothing here shows seconds.
|
||||
val now by rememberMinuteClock()
|
||||
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) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
@@ -342,8 +341,8 @@ internal fun DriveInReminderCard(reminder: DriveInReminder, nowMs: Long, onGo: (
|
||||
@Composable
|
||||
internal fun DriveInScreen(session: EmbySampleSession, plan: ChannelPlan?, visit: Int, modifier: Modifier, active: Boolean, tickets: Map<Long, Int>,
|
||||
onTicket: (DriveInBill) -> Unit, onHandBack: (DriveInBill) -> Unit, onWatch: () -> Unit) {
|
||||
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
LaunchedEffect(Unit) { while (true) { delay(1000); if (!FullScreen.active) now = System.currentTimeMillis() } }
|
||||
// Moves on as the minute turns: nothing here shows seconds.
|
||||
val now by rememberMinuteClock()
|
||||
val minute = now / 60_000
|
||||
val bills = remember(plan, minute, AfterDarkLock.locked) { plan?.let { driveInBills(it).filter { bill -> bill.endMs > now && !lockedOut(bill) } }.orEmpty().take(DRIVE_IN_LISTED) }
|
||||
var chosen by remember(visit) { mutableStateOf<Long?>(null) }
|
||||
@@ -380,8 +379,8 @@ internal fun DriveInScreen(session: EmbySampleSession, plan: ChannelPlan?, visit
|
||||
Column(Modifier.padding(start = 36.dp, top = 78.dp).width(540.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
// A booked event with an approved takeover shows its board; everything else, the Drive-In's own mark.
|
||||
val takeover = selected?.presentation?.let { DriveInTakeovers[it] }
|
||||
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.logoPlate().width(110.dp).height(34.dp), alignment = Alignment.CenterStart)
|
||||
if (takeover != null) Image(cachedPainter(takeover), selected.title, Modifier.width(160.dp).height(50.dp), alignment = Alignment.CenterStart)
|
||||
else Image(cachedPainter(R.drawable.orbit_drive_in_epg), "Orbit Drive-In", Modifier.logoPlate().width(110.dp).height(34.dp), alignment = Alignment.CenterStart)
|
||||
if (selected == null) {
|
||||
Text("Tonight's bill is on its way.", color = Ink, fontFamily = Barlow, fontSize = 20.sp)
|
||||
return@Column
|
||||
@@ -393,7 +392,7 @@ internal fun DriveInScreen(session: EmbySampleSession, plan: ChannelPlan?, visit
|
||||
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))
|
||||
Image(cachedPainter(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 Ink, fontFamily = Barlow, fontWeight = FontWeight.SemiBold, fontSize = 15.sp)
|
||||
|
||||
@@ -62,9 +62,9 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI
|
||||
}
|
||||
/** The sign-in headers for this kind of server. */
|
||||
internal fun authHeaders(token: String?): Map<String, String> = when (kind) {
|
||||
ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.61\"") +
|
||||
ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.62\"") +
|
||||
(token?.let { mapOf("X-Emby-Token" to it) } ?: emptyMap())
|
||||
ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.61\"" +
|
||||
ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.62\"" +
|
||||
(token?.let { ", Token=\"$it\"" } ?: ""))
|
||||
}
|
||||
/** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */
|
||||
|
||||
@@ -484,7 +484,10 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
onDriveIn()
|
||||
})
|
||||
}
|
||||
val ready = !busy && !restoring && now >= nextAttemptAt && username.isNotBlank() && password.text.isNotEmpty()
|
||||
// Read through derived state, so the second-by-second clock only matters when the answer changes (Paul, 6 November
|
||||
// 2026: this whole screen was rebuilding every second).
|
||||
val ready by remember { derivedStateOf { !busy && !restoring && now >= nextAttemptAt && username.isNotBlank() && password.text.isNotEmpty() } }
|
||||
val waiting by remember { derivedStateOf { now < nextAttemptAt } }
|
||||
val liveSession = session
|
||||
fun rememberUnplayable(itemId: String) {
|
||||
val active = session ?: return
|
||||
@@ -770,7 +773,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
finally { busy = false }
|
||||
}
|
||||
}
|
||||
SignInForm(modifier, serverText, { serverText = it }, username, { username = it }, password, busy, restoring, ready, now < nextAttemptAt, message,
|
||||
SignInForm(modifier, serverText, { serverText = it }, username, { username = it }, password, busy, restoring, ready, waiting, message,
|
||||
pendingSaved?.identity?.token != null, keyboard, focus, passwordFocus, submitFocus, ::signIn, { restoreAttempt++ }, { closeSession(signOut = true) })
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
|
||||
import androidx.media3.ui.PlayerView
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.tv.material3.Text
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
@@ -486,7 +485,7 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl
|
||||
if (takeoverNow != null && logoSetting && ready && !infoVisible && failure == null && squeeze == 0f)
|
||||
TakeoverMark(takeoverNow, Modifier.align(Alignment.BottomStart).padding(start = 40.dp, bottom = 28.dp).alpha(.85f), height = 26.dp, textSize = 20.sp)
|
||||
else if (bug != null && ready && !infoVisible && failure == null && squeeze == 0f)
|
||||
Image(painterResource(bug), null, Modifier.align(Alignment.BottomStart).padding(start = 40.dp, bottom = 28.dp).width(108.dp).height(36.dp), alpha = .8f)
|
||||
Image(cachedPainter(bug), null, Modifier.align(Alignment.BottomStart).padding(start = 40.dp, bottom = 28.dp).width(108.dp).height(36.dp), alpha = .8f)
|
||||
if (infoVisible && failure == null && ready && squeeze == 0f) ClassicProgrammeStrip(plan.item, playing,
|
||||
Modifier.align(Alignment.BottomCenter).fillMaxWidth(.86f).padding(bottom = 26.dp), scheduled = scheduled)
|
||||
ident?.invoke()
|
||||
|
||||
@@ -17,7 +17,6 @@ import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -124,8 +123,8 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
|
||||
/** OK on a finished programme that can be caught up. */
|
||||
onCatchUp: (CatchUpEntry) -> Unit = {}) {
|
||||
val title = category.label
|
||||
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
LaunchedEffect(Unit) { while (true) { delay(1000); if (!FullScreen.active) now = System.currentTimeMillis() } }
|
||||
// Moves on as the minute turns: nothing here shows seconds.
|
||||
val now by rememberMinuteClock()
|
||||
var row by remember(category) { mutableIntStateOf(channels.indexOfFirst { it.number == selectedNumber }.coerceAtLeast(0)) }
|
||||
var cursor by remember { mutableLongStateOf(now) }
|
||||
var slotsAhead by remember { mutableIntStateOf(0) }
|
||||
@@ -164,7 +163,7 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
|
||||
val branding = ChannelBrands.forNumber(channel.number)
|
||||
// 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.logoPlate().width(96.dp).height(30.dp))
|
||||
if (branding != null) Image(cachedPainter(branding.logo), branding.displayName, Modifier.logoPlate().width(96.dp).height(30.dp))
|
||||
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 guideTitle(channel.number, focused)
|
||||
Text(focusedName, color = Ink, fontFamily = Anton, fontSize = 20.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
@@ -228,7 +227,7 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
|
||||
Row(Modifier.width(130.dp).fillMaxHeight().background(if (index == row) Blue else Panel, androidx.compose.foundation.shape.RoundedCornerShape(4.dp)).padding(start = 6.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
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.logoPlate().width(88.dp).height(28.dp))
|
||||
else if (mark != null) Image(cachedPainter(mark.logo), mark.displayName, Modifier.logoPlate().width(88.dp).height(28.dp))
|
||||
else Text(ChannelBrands.displayName(line), color = Ink, fontSize = 13.sp, maxLines = 1)
|
||||
}
|
||||
BoxWithConstraints(Modifier.weight(1f).fillMaxHeight()) {
|
||||
|
||||
@@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
@@ -72,8 +71,8 @@ internal fun GuidePicture(session: EmbySampleSession, channel: SampleChannel, li
|
||||
lifecycle.addObserver(observer)
|
||||
onDispose { lifecycle.removeObserver(observer) }
|
||||
}
|
||||
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
LaunchedEffect(Unit) { while (true) { delay(1000); if (!FullScreen.active) now = System.currentTimeMillis() } }
|
||||
// Moves on as the minute turns: nothing here shows seconds.
|
||||
val now by rememberMinuteClock()
|
||||
val current = channel.at(now)
|
||||
var ready by remember(channel.number, current.startMs, live, foreground) { mutableStateOf(false) }
|
||||
// A file that can't play here leaves the artwork up until the next programme.
|
||||
@@ -85,7 +84,7 @@ internal fun GuidePicture(session: EmbySampleSession, channel: SampleChannel, li
|
||||
val branding = ChannelBrands.forNumber(channel.number)
|
||||
if (!ready) Box(Modifier.matchParentSize().background(Panel)) {
|
||||
ProgrammeArtwork(session, channel, current)
|
||||
if (branding != null) Image(painterResource(branding.logo), branding.displayName, Modifier.align(androidx.compose.ui.Alignment.Center).logoPlate().width(150.dp).height(47.dp))
|
||||
if (branding != null) Image(cachedPainter(branding.logo), branding.displayName, Modifier.align(androidx.compose.ui.Alignment.Center).logoPlate().width(150.dp).height(47.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
@@ -82,7 +81,7 @@ internal fun HomeScreen(channels: List<SampleChannel>, modifier: Modifier = Modi
|
||||
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 = ColorFilter.tint(if (focused) OnAccent else Ink))
|
||||
Image(cachedPainter(category.icon), null, Modifier.size(18.dp), colorFilter = ColorFilter.tint(if (focused) OnAccent else Ink))
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -103,7 +102,7 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
|
||||
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())
|
||||
if (mood != null && !settings.idents) Image(cachedPainter(mood.still), null, Modifier.fillMaxSize())
|
||||
// Every third Tots changeover, a drawn bumper with the cast instead of the filmed ident.
|
||||
else if (mood != null && !early && block == null && totsBumper(next.startMs)) TotsBumper(mood)
|
||||
else if (video != null && !(early && !settings.idents)) {
|
||||
@@ -130,7 +129,7 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
|
||||
} else {
|
||||
ProgrammeArtwork(session, channel, next)
|
||||
ChannelBrands.forNumber(channel.number)?.let { brand ->
|
||||
Image(painterResource(brand.logo), brand.displayName, Modifier.align(Alignment.Center).width(400.dp).height(125.dp))
|
||||
Image(cachedPainter(brand.logo), brand.displayName, Modifier.align(Alignment.Center).width(400.dp).height(125.dp))
|
||||
}
|
||||
}
|
||||
// A booked event's own lower third says what's next instead.
|
||||
|
||||
@@ -21,7 +21,6 @@ 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
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
@@ -60,6 +59,8 @@ class MainActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
Motion.load(OrbitSettings(this))
|
||||
// The guide's logos, decoded ahead on a background thread so the guide opens with them ready.
|
||||
Thread({ Pictures.warmLogos(resources) }, "orbit-logos").apply { priority = Thread.MIN_PRIORITY }.start()
|
||||
if (intent?.getBooleanExtra("orbit_intro_test", false) == true) IntroTrial.nextTune = true
|
||||
intent?.getStringExtra("orbit_inspect_series")?.take(120)?.let { SeriesInspection.title = it }
|
||||
if (intent?.getBooleanExtra("orbit_read_evidence", false) == true) EvidenceRequest.pending = true
|
||||
@@ -115,8 +116,6 @@ private fun NavItem(label: String, selected: Boolean, focus: FocusRequester?, be
|
||||
|
||||
@Composable
|
||||
private fun OrbitApp() {
|
||||
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
LaunchedEffect(Unit) { while (true) { delay(1000); if (!FullScreen.active) now = System.currentTimeMillis() } }
|
||||
var realChannelAvailable by remember { mutableStateOf(false) }
|
||||
var section by remember { mutableStateOf("Home") }
|
||||
var restoreChecked by remember { mutableStateOf(false) }
|
||||
@@ -213,18 +212,15 @@ private fun OrbitApp() {
|
||||
if (kidsArcade) NavItem("Arcade", section == "Arcade", null, below) { section = "Arcade" }
|
||||
} }
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Image(painterResource(R.drawable.orbit_logo), "Orbit", Modifier.logoPlate().width(144.dp).height(36.dp))
|
||||
Image(cachedPainter(R.drawable.orbit_logo), "Orbit", Modifier.logoPlate().width(144.dp).height(36.dp))
|
||||
Spacer(Modifier.weight(1f))
|
||||
Column(horizontalAlignment = Alignment.End) {
|
||||
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)
|
||||
}
|
||||
TopBarClock()
|
||||
// Who's watching, as a little picture: OK goes back to Who's watching? to switch.
|
||||
if (realChannelAvailable && profile != null) HomeCard(Modifier.size(38.dp, 32.dp).focusProperties { if (section == "Drive-In") down = driveInFocus }, onClick = { section = "Home"; Profiles.current = null }) { focused ->
|
||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { ProfileAvatar(profile.picture, 28.dp, ringed = false) }
|
||||
}
|
||||
if (realChannelAvailable && !Profiles.kids) HomeCard(Modifier.size(38.dp, 32.dp).focusProperties { if (section == "Drive-In") down = driveInFocus }, onClick = { section = "Connect Emby" }) { focused ->
|
||||
Image(painterResource(R.drawable.orbit_icon_gear), "Settings", Modifier.fillMaxSize().padding(5.dp), colorFilter = ColorFilter.tint(if (focused) OnAccent else Ink))
|
||||
Image(cachedPainter(R.drawable.orbit_icon_gear), "Settings", Modifier.fillMaxSize().padding(5.dp), colorFilter = ColorFilter.tint(if (focused) OnAccent else Ink))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,3 +233,13 @@ private fun OrbitApp() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The top bar's clock, on its own so only it changes as the minute turns, not the whole app around it. */
|
||||
@Composable
|
||||
private fun TopBarClock() {
|
||||
val now by rememberMinuteClock()
|
||||
Column(horizontalAlignment = Alignment.End) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
@@ -70,7 +69,7 @@ internal fun MomentClip(moment: Moment, modifier: Modifier = Modifier, loop: Boo
|
||||
// A press skips; the lift of the press that opened the moment doesn't.
|
||||
if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN) finish(); true }.focusable())) {
|
||||
if (calm) {
|
||||
Image(painterResource(moment.still), null, Modifier.fillMaxSize())
|
||||
Image(cachedPainter(moment.still), null, Modifier.fillMaxSize())
|
||||
if (!loop) LaunchedEffect(Unit) { delay(MOMENT_STILL_MS); finish() }
|
||||
} else {
|
||||
val player = remember {
|
||||
|
||||
@@ -24,7 +24,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.drawscope.rotate
|
||||
import androidx.compose.ui.graphics.drawscope.withTransform
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -272,7 +271,7 @@ 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.logoPlate().width(84.dp).height(26.dp)) else Text(programming.name, color = Ink, fontSize = 13.sp)
|
||||
if (brand != null) Image(cachedPainter(brand.logo), brand.displayName, Modifier.logoPlate().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) 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)
|
||||
@@ -325,7 +324,7 @@ private fun ChannelsStep(onNext: () -> Unit) {
|
||||
Row(Modifier.fillMaxWidth().height(40.dp).background(if (busy) Navy else Panel, RoundedCornerShape(8.dp)).border(if (busy) 2.dp else 0.dp, if (busy) Yellow else Color.Transparent, RoundedCornerShape(8.dp))
|
||||
.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.logoPlate().width(80.dp).height(24.dp))
|
||||
if (brand != null) Image(cachedPainter(brand.logo), brand.displayName, Modifier.logoPlate().width(80.dp).height(24.dp))
|
||||
Text(brand?.displayName ?: "$number", color = Ink, fontSize = 14.sp, modifier = Modifier.weight(1f))
|
||||
Text(when {
|
||||
count == null && busy -> "Matching…"
|
||||
|
||||
@@ -31,7 +31,6 @@ import androidx.compose.ui.graphics.drawscope.withTransform
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalWindowInfo
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.util.LruCache
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.graphics.painter.BitmapPainter
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.imageResource
|
||||
|
||||
/**
|
||||
* Orbit's own pictures (logos, icons, backgrounds), decoded once and kept (Paul, 6 November 2026: screens loaded "partly
|
||||
* then fully" and stuttered). Compose's painterResource decodes a picture again each time a screen shows it, on the
|
||||
* thread that draws the screen; the guide alone decoded every channel's logo each time it opened. Up to 64 MB is kept,
|
||||
* the least recently shown going first.
|
||||
*/
|
||||
internal object Pictures {
|
||||
private val cache = object : LruCache<Int, ImageBitmap>(64 * 1024 * 1024) {
|
||||
override fun sizeOf(key: Int, value: ImageBitmap) = value.width * value.height * 4
|
||||
}
|
||||
|
||||
fun get(resources: Resources, id: Int): ImageBitmap = cache.get(id) ?: ImageBitmap.imageResource(resources, id).also { cache.put(id, it) }
|
||||
|
||||
/** Decodes every channel's guide logo ahead, off the drawing thread, so the guide opens with them ready. */
|
||||
fun warmLogos(resources: Resources) {
|
||||
ChannelBrands.allLogos().forEach { runCatching { get(resources, it) } }
|
||||
}
|
||||
}
|
||||
|
||||
/** A drop-in for painterResource, for Orbit's raster pictures. */
|
||||
@Composable
|
||||
internal fun cachedPainter(id: Int): Painter {
|
||||
val resources = LocalContext.current.resources
|
||||
return remember(id) { BitmapPainter(Pictures.get(resources, id)) }
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.drawscope.DrawScope
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -119,7 +118,7 @@ internal fun ProfileAvatar(picture: String, diameter: Dp, modifier: Modifier = M
|
||||
Box(modifier.size(diameter).then(if (ringed) Modifier.border(4.dp, Yellow, CircleShape) else Modifier).padding(if (ringed) 6.dp else 0.dp)
|
||||
.clip(CircleShape).background(sil?.copy(alpha = .35f)?.compositeOverNavy() ?: PictureBacks[picture] ?: Panel), contentAlignment = Alignment.Center) {
|
||||
val image = PictureImages[picture]
|
||||
if (image != null) Image(painterResource(image), pictureName(picture), Modifier.fillMaxSize())
|
||||
if (image != null) Image(cachedPainter(image), pictureName(picture), Modifier.fillMaxSize())
|
||||
else Canvas(Modifier.fillMaxSize()) {
|
||||
val r = size.minDimension / 2
|
||||
when (picture) {
|
||||
@@ -168,7 +167,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.logoPlate().width(150.dp).height(38.dp))
|
||||
Image(cachedPainter(R.drawable.orbit_logo), "Orbit", Modifier.logoPlate().width(150.dp).height(38.dp))
|
||||
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.
|
||||
@@ -263,7 +262,7 @@ 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.logoPlate().width(84.dp).height(26.dp)) else Text(programming.name, color = Ink, fontSize = 13.sp)
|
||||
if (brand != null) Image(cachedPainter(brand.logo), brand.displayName, Modifier.logoPlate().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) 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)
|
||||
|
||||
@@ -15,7 +15,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -86,12 +85,12 @@ internal fun PromoOverlay(session: EmbySampleSession, item: WhatsOnItem) {
|
||||
Box(Modifier.fillMaxSize().background(Navy)) {
|
||||
StarrySky()
|
||||
Column(Modifier.align(Alignment.Center).padding(top = 10.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
ChannelBrands.forNumber(item.channel)?.let { Image(painterResource(it.logo), it.displayName, Modifier.logoPlate().width(150.dp).height(46.dp)) }
|
||||
ChannelBrands.forNumber(item.channel)?.let { Image(cachedPainter(it.logo), it.displayName, Modifier.logoPlate().width(150.dp).height(46.dp)) }
|
||||
Text(promoHeadline(item, now), color = Yellow, fontFamily = Anton, fontSize = 34.sp)
|
||||
Box(Modifier.width(500.dp).height(190.dp).clip(RoundedCornerShape(12.dp)).background(Panel)) {
|
||||
if (picture != null) Image(picture.asImageBitmap(), null, Modifier.fillMaxSize(), contentScale = ContentScale.Crop)
|
||||
// No picture at all: the channel's logo, large and soft, rather than an empty panel.
|
||||
else ChannelBrands.forNumber(item.channel)?.let { Image(painterResource(it.logo), null, Modifier.align(Alignment.Center).width(260.dp).height(80.dp).alpha(.35f)) }
|
||||
else ChannelBrands.forNumber(item.channel)?.let { Image(cachedPainter(it.logo), null, Modifier.align(Alignment.Center).width(260.dp).height(80.dp).alpha(.35f)) }
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,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.61")
|
||||
next.setRequestProperty("User-Agent", "OrbitTV/0.108.62")
|
||||
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()) {
|
||||
|
||||
@@ -31,7 +31,6 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.input.key.type
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -166,7 +165,7 @@ private fun RailItem(section: SettingsSection, selected: Boolean, modifier: Modi
|
||||
}.onFocusChanged { focused = it.isFocused; if (it.isFocused) onSelect() }.clip(RailCorner)
|
||||
.background(if (focused) Yellow else if (selected) Blue else Panel).clickable(onClick = onSelect).padding(horizontal = 10.dp),
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Image(painterResource(section.icon), null, Modifier.size(26.dp), colorFilter = ColorFilter.tint(if (focused) OnAccent else Ink))
|
||||
Image(cachedPainter(section.icon), null, Modifier.size(26.dp), colorFilter = ColorFilter.tint(if (focused) OnAccent else Ink))
|
||||
Column {
|
||||
Text(section.label, color = if (focused) OnAccent else Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1)
|
||||
Text(section.line, color = if (focused) OnAccent.copy(alpha = .75f) else Muted, fontSize = 10.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
@@ -231,7 +230,7 @@ private fun ChannelsDetail(busy: Boolean, message: String?, isOn: (Int) -> Boole
|
||||
Text(channelBlock(programming.number), Modifier.padding(top = 6.dp), color = Muted, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
|
||||
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.logoPlate().width(88.dp).height(28.dp))
|
||||
if (brand != null) Image(cachedPainter(brand.logo), brand.displayName, Modifier.logoPlate().width(88.dp).height(28.dp))
|
||||
Text(brand?.displayName ?: programming.name, Modifier.weight(1f), color = Ink, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
if (programming.suggestionRules.isNotEmpty()) OrbitButton("Titles", enabled = !busy, onClick = { onSuggestions(programming) })
|
||||
CustomChannels.of(programming.number)?.let { yours -> OrbitButton("Edit", enabled = !busy, onClick = { onEdit(yours) }) }
|
||||
|
||||
@@ -13,7 +13,6 @@ import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -61,7 +60,7 @@ internal fun SqueezePanel(session: EmbySampleSession, channel: SampleChannel, cu
|
||||
val (name, detail) = guideTitleParts(next.media.item.title)
|
||||
val seconds = ((next.startMs - nowMs) / 1000).coerceAtLeast(0)
|
||||
Box(Modifier.fillMaxSize().graphicsLayer { alpha = shown }) {
|
||||
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.padding(start = 36.dp, top = 14.dp).logoPlate().width(120.dp).height(38.dp))
|
||||
if (brand != null) Image(cachedPainter(brand.logo), brand.displayName, Modifier.padding(start = 36.dp, top = 14.dp).logoPlate().width(120.dp).height(38.dp))
|
||||
// Beside the picture: what's next.
|
||||
Column(Modifier.align(Alignment.TopEnd).padding(top = 60.dp, end = 36.dp).width(360.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
Text(if (keep) "KEEP WATCHING" else "NEXT ON ${(brand?.displayName ?: channel.name).removePrefix("Orbit ").uppercase()}", color = Yellow, fontFamily = Anton, fontSize = 22.sp, maxLines = 1)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.mutableLongStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
/**
|
||||
* The time for a screen that shows hours and minutes, moving on as each minute turns rather than every second (Paul,
|
||||
* 6 November 2026: screens rebuilt themselves every second for a clock that only changes once a minute, and the box
|
||||
* stuttered). Full screen pauses it, as before.
|
||||
*/
|
||||
@Composable
|
||||
internal fun rememberMinuteClock(): State<Long> {
|
||||
val now = remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
LaunchedEffect(Unit) {
|
||||
while (true) {
|
||||
val at = System.currentTimeMillis()
|
||||
delay(MINUTE_MS - at % MINUTE_MS + 50)
|
||||
if (!FullScreen.active) now.longValue = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
return now
|
||||
}
|
||||
|
||||
private const val MINUTE_MS = 60_000L
|
||||
@@ -19,7 +19,6 @@ import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
@@ -54,8 +53,8 @@ private fun Tag(text: String, colour: Color = tagColour(text), size: Int = 10) {
|
||||
@Composable
|
||||
private fun Logo(channel: Int, width: Int, height: Int) {
|
||||
val brand = ChannelBrands.forNumber(channel)
|
||||
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.logoPlate().width(width.dp).height(height.dp), alignment = Alignment.CenterStart)
|
||||
else if (channel == DRIVE_IN_NUMBER) Image(painterResource(R.drawable.orbit_drive_in_epg), "Orbit Drive-In", Modifier.logoPlate().width(width.dp).height(height.dp), alignment = Alignment.CenterStart)
|
||||
if (brand != null) Image(cachedPainter(brand.logo), brand.displayName, Modifier.logoPlate().width(width.dp).height(height.dp), alignment = Alignment.CenterStart)
|
||||
else if (channel == DRIVE_IN_NUMBER) Image(cachedPainter(R.drawable.orbit_drive_in_epg), "Orbit Drive-In", Modifier.logoPlate().width(width.dp).height(height.dp), alignment = Alignment.CenterStart)
|
||||
}
|
||||
|
||||
private fun dayAndTime(startMs: Long, nowMs: Long): String {
|
||||
@@ -80,8 +79,8 @@ private fun FocusCard(modifier: Modifier, focus: FocusRequester? = null, onClick
|
||||
@Composable
|
||||
internal fun WhatsOnScreen(session: EmbySampleSession, plans: Map<Int, ChannelPlan>, driveIn: ChannelPlan?, modifier: Modifier, reminders: List<ProgrammeReminder>,
|
||||
onWatch: (Int) -> Unit, onDriveIn: () -> Unit, onRemind: (WhatsOnItem) -> Unit, onBack: () -> Unit) {
|
||||
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
LaunchedEffect(Unit) { while (true) { delay(1000); if (!FullScreen.active) now = System.currentTimeMillis() } }
|
||||
// Moves on as the minute turns: nothing here shows seconds.
|
||||
val now by rememberMinuteClock()
|
||||
val minute = now / 60_000
|
||||
val page = remember(plans, driveIn, minute, AfterDarkLock.locked) { whatsOnPage(plans, driveIn, now) }
|
||||
var open by remember { mutableStateOf<WhatsOnItem?>(null) }
|
||||
|
||||
Reference in New Issue
Block a user