0.129 P1/P2: no repeat asks for missing pictures; High Scores, Arcade and Settings pages scroll and keep Back

- A show with no picture is asked for once per 6 hours, not up to 4 times per programme shown
- Picture requests are counted only when a request is made
- Top 10 and a game's settings sheet close with Back (their own window swallowed it)
- Arcade pages' footer says Back goes to Play Games
- Arcade menu items wrap at larger text sizes; High Scores drops the Played column on narrow screens
- Family home, a person's page, PIN and Account scroll; Down at the foot of a Settings section stays put

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 20:20:39 +00:00
co-authored by Claude Opus 5.5
parent 5842d28235
commit f2bf735c72
22 changed files with 75 additions and 28 deletions
@@ -70,11 +70,12 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI
/** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */
fun fetchImage(path: String, token: String): ByteArray? {
require(path.startsWith("/") && !path.startsWith("//"))
return fetchImageOnce(path, token).also { ServerRequests.count(RequestKind.Images, it != null) }
}
private fun fetchImageOnce(path: String, token: String): ByteArray? {
if (runCatching { EmbyServer.checkHomeConnection(origin) }.isFailure) return null
val prefix = runCatching { kind.prefix }.getOrNull() ?: return null
// Counted only once a request is really made.
return fetchImageOnce(prefix, path, token).also { ServerRequests.count(RequestKind.Images, it != null) }
}
private fun fetchImageOnce(prefix: String, path: String, token: String): ByteArray? {
val connection = URL("$origin$prefix$path").openConnection() as HttpURLConnection
try {
connection.instanceFollowRedirects = false
@@ -3,6 +3,7 @@ package tv.orbit.classic
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
@@ -60,7 +61,7 @@ internal fun FamilySettings(firstSwitch: FocusRequester, bedtime: @Composable ()
is FamilyPage.ArcadeKids -> ArcadeForKids(p.id, onBack = { page = FamilyPage.Person(p.id) }, modifier)
is FamilyPage.Add -> AddSomeone(p, onStep = { page = it }, onDone = { id -> page = FamilyPage.Person(id) }, onCancel = { page = FamilyPage.Home }, onChannels = { kidsChannelsFor = it }, modifier)
is FamilyPage.Picture -> PicturePicker(p.id, onDone = { page = FamilyPage.Person(p.id) }, modifier)
FamilyPage.Lock -> Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
FamilyPage.Lock -> Column(modifier.verticalScroll(androidx.compose.foundation.rememberScrollState()), verticalArrangement = Arrangement.spacedBy(8.dp)) {
BackHandler { page = FamilyPage.Home }
LockDetail(firstSwitch, Modifier.fillMaxWidth())
}
@@ -70,7 +71,8 @@ internal fun FamilySettings(firstSwitch: FocusRequester, bedtime: @Composable ()
@Composable
private fun FamilyHome(firstSwitch: FocusRequester, onOpen: (String) -> Unit, onAdd: () -> Unit, onLock: () -> Unit, bedtime: @Composable () -> Unit, modifier: Modifier) {
Column(modifier, verticalArrangement = Arrangement.spacedBy(10.dp)) {
// Scrolls (0.129): with a larger display size the Wind Down card was below the screen, out of the remote's reach.
Column(modifier.verticalScroll(androidx.compose.foundation.rememberScrollState()), verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text("WHO WATCHES", color = Muted, fontSize = 11.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.sp)
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Profiles.all.forEachIndexed { i, p -> PersonCard(p, if (i == 0) Modifier.focusRequester(firstSwitch) else Modifier) { onOpen(p.id) } }
@@ -157,7 +159,8 @@ private fun PersonPage(id: String, onBack: () -> Unit, onPicture: () -> Unit, on
ClassChip(p.kind)
note?.let { Text(it, color = Yellow, fontSize = 12.sp) }
}
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(6.dp)) {
// A Kids profile has eight rows; they scroll rather than run off the screen (0.129).
Column(Modifier.weight(1f).verticalScroll(androidx.compose.foundation.rememberScrollState()), verticalArrangement = Arrangement.spacedBy(6.dp)) {
if (renaming) NameField(p.name, onDone = { Profiles.update(context, p.copy(name = cleanProfileName(it))); renaming = false; note = "Renamed." }, onCancel = { renaming = false })
else PersonRow("Name", p.name, "Rename", Modifier.focusRequester(first)) { renaming = true }
PersonRow("Picture", pictureName(p.picture), "Change") { onPicture() }
@@ -16,6 +16,8 @@ import kotlinx.coroutines.withContext
import java.io.File
private const val ARTWORK_KEEP_FILES = 150
/** How long a show with no picture is left before asking again: a picture added on the server shows up the same day. */
internal const val MISSING_RETRY_MS = 6 * 60 * 60_000L
/** Where a programme's picture may be: its show's wide artwork first, as that suits a full screen, then its own. */
internal fun artworkPaths(itemId: String, seriesId: String?): List<String> =
@@ -37,6 +39,13 @@ internal class ArtworkCache(private val directory: File) {
temporary.renameTo(file(key))
trim()
}
/**
* A show with no picture at all (0.129): without this, every programme of it asked the server up to four times, each time it
* was shown (found on the emulator: 120 picture requests in four minutes). It is now asked again after [MISSING_RETRY_MS].
*/
fun knownMissing(key: String, nowMs: Long = System.currentTimeMillis()): Boolean =
File(directory, "$key.none").let { it.isFile && nowMs - it.lastModified() < MISSING_RETRY_MS }
fun markMissing(key: String) { runCatching { directory.mkdirs(); File(directory, "$key.none").writeText("") } }
private fun trim() {
directory.listFiles()?.sortedByDescending { it.lastModified() }?.drop(ARTWORK_KEEP_FILES)?.forEach { it.delete() }
}
@@ -47,12 +56,14 @@ internal fun loadArtwork(cache: ArtworkCache, itemId: String, seriesId: String?,
if (!EmbyClient.validId(itemId)) return null
val key = (seriesId ?: itemId).takeIf { EmbyClient.validId(it) } ?: itemId
cache.get(key)?.let { return it }
if (cache.knownMissing(key)) return null
for (path in artworkPaths(itemId, seriesId)) {
val bytes = runCatching { fetch(path) }.getOrNull() ?: continue
if (bytes.isEmpty()) continue
runCatching { cache.put(key, bytes) }
return bytes
}
cache.markMissing(key)
return null
}
@@ -499,7 +499,8 @@ private fun AccountDetail(server: String, titles: Long?, onSignOut: () -> Unit,
val version = remember { runCatching { context.packageManager.getPackageInfo(context.packageName, 0).versionName }.getOrNull().orEmpty() }
var confirming by remember { mutableStateOf(false) }
var removing by remember { mutableStateOf(false) }
Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
// Scrolls (0.129): with the requests line added, the Welcome tour and the version were squeezed off the foot of the screen.
Column(modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(8.dp)) {
SettingLine("Connected", server + (titles?.let { ", $it titles available" }.orEmpty())) {}
Text("Your password is never saved. This box only keeps a sign-in token, in encrypted storage.", color = Muted, fontSize = 13.sp)
if (confirming) {
@@ -571,7 +572,11 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio
}) { onSection(item) }
}
}
val detail = Modifier.weight(1f).fillMaxHeight()
// Down at the foot of a section stays put (0.129, found on the emulator: Down from Family's last item reached Account
// in the list beside it, which opened Account). Left still goes back to the list, Up to what's above.
val detail = Modifier.weight(1f).fillMaxHeight().focusProperties {
onExit = { if (requestedFocusDirection == androidx.compose.ui.focus.FocusDirection.Down) cancelFocusChange() }
}.focusGroup()
when (section) {
SettingsSection.Channels -> when {
making != null && maker != null -> making?.let { (_, editing) -> SettingsSubPage(null, null, detail) {
@@ -215,8 +215,9 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit, onExi
KeyFooter(when (page) {
ArcadePage.Play -> listOf(Control("◀▶▲▼", "Browse"), Control("OK", "Play"), Control("Menu", "Game settings"), Control("Back", "Orbit TV"))
ArcadePage.HighScores -> listOfNotNull(Control("▲▼", "Choose a game"), Control("◀▶", "BumbleHive Normal / Hard").takeIf { visible.any { it.id == ArcadeGames.Hive.id } },
Control("OK", "See top 10"), Control("Back", "Orbit TV"))
else -> listOf(Control("▲▼", "Choose"), Control("OK", "Select"), Control("Back", "Orbit TV"))
Control("OK", "See top 10"), Control("Back", "Play Games"))
// Back on these pages goes to Play Games, not Orbit TV (0.129: the footer said Orbit TV).
else -> listOf(Control("▲▼", "Choose"), Control("OK", "Select"), Control("Back", "Play Games"))
}, note = if (profile.kind == ProfileKind.Kids && page == ArcadePage.Play) "Kids profile: only Kids games are shown" else null)
}
settingsFor?.let { game -> GameSettingsSheet(game, data.game(game.id), repo::legacyFlag,
@@ -256,7 +257,8 @@ private fun MenuItem(title: String, icon: String, selected: Boolean, modifier: M
if (selected) Box(Modifier.width(3.dp).height(18.dp).background(ArcadeColours.Cyan, RoundedCornerShape(2.dp)))
Text(icon, color = ArcadeColours.Ink, fontSize = 13.sp, modifier = Modifier.width(18.dp))
Column {
Text(title, color = ArcadeColours.Ink, fontSize = 14.sp, fontWeight = if (selected) FontWeight.SemiBold else FontWeight.Normal, maxLines = 1)
// Two lines with larger text (0.129): one line cut "High Scores" to "High" at 130% text size.
Text(title, color = ArcadeColours.Ink, fontSize = 14.sp, fontWeight = if (selected) FontWeight.SemiBold else FontWeight.Normal, maxLines = 2, lineHeight = 16.sp)
if (caption != null) Text(caption, color = ArcadeColours.Muted, fontSize = 11.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
@@ -453,7 +455,8 @@ private fun GameSettingsSheet(game: ArcadeGame, record: GameRecord, legacy: (Str
LaunchedEffect(Unit) { runCatching { first.requestFocus() } }
androidx.activity.compose.BackHandler(onBack = onClose)
ArcadeScrim {
Column(Modifier.width(380.dp).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp),
// Back caught here too (0.129): the sheet is its own window, so a BackHandler outside it never heard Back.
Column(Modifier.width(380.dp).onBackKey(action = onClose).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text("${game.title.uppercase()} SETTINGS", color = ArcadeColours.Ink, fontFamily = Anton, fontSize = 22.sp)
Text("Saved for whoever's playing, on this TV.", color = ArcadeColours.Muted, fontSize = 12.sp)
@@ -3,6 +3,8 @@ package tv.orbit.classic.arcade
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
@@ -44,6 +46,9 @@ internal fun HighScoresPage(profile: Profile, visible: List<ArcadeGame>, data: A
// A game with modes (BumbleHive Hard, Star Chase Signal Run…) shows one table at a time, switched with ◀▶ on its row.
var tableIx by remember { mutableStateOf(emptyMap<String, Int>()) }
val now = remember { System.currentTimeMillis() }
// On a narrower screen (a larger display size, or a box set to fewer dots per inch), the Played column gives its room to the
// game's name (0.129: names were cut to "Sta…" beside their Classic switch). When each was played is still in the Top 10.
val showPlayed = androidx.compose.ui.platform.LocalConfiguration.current.screenWidthDp >= ScoreColumns.FULL_WIDTH_DP
// The house board (Paul, 9 November 2026): everyone's scores, from every room, each kept on their own profile.
PageTitle("HIGH SCORES", "${profile.name} · the whole house, every room")
// One table (0.129): the household records were a second column beside it, with a taller heading, so its lines sat out of
@@ -53,15 +58,19 @@ internal fun HighScoresPage(profile: Profile, visible: List<ArcadeGame>, data: A
Row(Modifier.fillMaxWidth().height(rowHeight).padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) {
Spacer(Modifier.width(ScoreColumns.icon))
Text("Game", Modifier.weight(1f), color = ArcadeColours.Muted, fontSize = 12.sp)
ScoreColumns.headings.forEach { (t, w) -> Text(t, Modifier.width(w), color = if (t == ScoreColumns.HOUSEHOLD) ArcadeColours.Cyan else ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1, textAlign = androidx.compose.ui.text.style.TextAlign.End) }
ScoreColumns.headings.filter { showPlayed || it.first != ScoreColumns.PLAYED }.forEach { (t, w) -> Text(t, Modifier.width(w), color = if (t == ScoreColumns.HOUSEHOLD) ArcadeColours.Cyan else ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1, textAlign = androidx.compose.ui.text.style.TextAlign.End) }
}
visible.forEach { g ->
val defs = scoreTableDefs(g.id, g.scoreKind)
val ix = tableIx[g.id] ?: 0
ScoreRow(g, defs[ix], data.game(defs[ix].id), now, houseTop(house, profile.id, defs[ix]).firstOrNull(), householdLine(g, household), tableLabel = scoreTableLabel(g, ix), highlighted = ix > 0,
onSide = if (defs.size > 1) { side -> tableIx = tableIx + (g.id to Math.floorMod(ix + side, defs.size)) } else null) { topTen = g }
// The rows scroll under the fixed heading (0.129: the last games were cut off at the foot of the TV, out of reach).
// Moving the remote onto a row brings it fully into view; the note sits at the end of the list.
Column(Modifier.weight(1f).verticalScroll(rememberScrollState()).padding(bottom = 6.dp)) {
visible.forEach { g ->
val defs = scoreTableDefs(g.id, g.scoreKind)
val ix = tableIx[g.id] ?: 0
ScoreRow(g, defs[ix], data.game(defs[ix].id), now, houseTop(house, profile.id, defs[ix]).firstOrNull(), householdLine(g, household), tableLabel = scoreTableLabel(g, ix), highlighted = ix > 0, showPlayed = showPlayed,
onSide = if (defs.size > 1) { side -> tableIx = tableIx + (g.id to Math.floorMod(ix + side, defs.size)) } else null) { topTen = g }
}
Text("🔒 Household records are from before profiles, and read-only.", Modifier.padding(start = 8.dp, top = 6.dp), color = ArcadeColours.Muted, fontSize = 11.sp)
}
Text("🔒 Household records are from before profiles, and read-only.", Modifier.padding(start = 8.dp, top = 6.dp), color = ArcadeColours.Muted, fontSize = 11.sp)
}
topTen?.let { g -> val ix = tableIx[g.id] ?: 0; val def = scoreTableDefs(g.id, g.scoreKind)[ix]; TopTen(g, def, houseTop(house, profile.id, def), now, title = scoreTableTitle(g, ix), onClose = { topTen = null }) }
}
@@ -91,15 +100,18 @@ private val rowHeight = 22.dp
/** The High Scores table's columns, shared by its heading and every row, so nothing can drift out of line. */
internal object ScoreColumns {
const val HOUSEHOLD = "Household"
const val PLAYED = "Played"
/** Screens at least this wide (in dp) show every column; a TV at its usual size is 960. */
const val FULL_WIDTH_DP = 900
val icon = 22.dp
val best = 90.dp; val house = 150.dp; val played = 72.dp; val household = 110.dp
val headings = listOf("Your best" to best, "House best" to house, "Played" to played, HOUSEHOLD to household)
val headings = listOf("Your best" to best, "House best" to house, PLAYED to played, HOUSEHOLD to household)
}
/** Figures all the same width, so 980 and 12,480 line up on the right. */
private val Figures = androidx.compose.ui.text.TextStyle(fontFeatureSettings = "tnum")
@Composable
private fun ScoreRow(game: ArcadeGame, table: ScoreTable, record: GameRecord, now: Long, houseBest: HouseRun?, householdRecord: String?, tableLabel: String? = null, highlighted: Boolean = false, onSide: ((Int) -> Unit)? = null, onOpen: () -> Unit) {
private fun ScoreRow(game: ArcadeGame, table: ScoreTable, record: GameRecord, now: Long, houseBest: HouseRun?, householdRecord: String?, tableLabel: String? = null, highlighted: Boolean = false, showPlayed: Boolean = true, onSide: ((Int) -> Unit)? = null, onOpen: () -> Unit) {
var focused by remember { mutableStateOf(false) }
val corner = RoundedCornerShape(6.dp)
val runs = rankRuns(record.runs, table.kind)
@@ -122,12 +134,12 @@ private fun ScoreRow(game: ArcadeGame, table: ScoreTable, record: GameRecord, no
val best = bestOf(record, table.kind).takeIf { it > 0 }?.let(table.format)
val house = houseBest?.let { "${houseScore(table, it)} · ${if (it.mine) "You" else it.who}" }
val end = androidx.compose.ui.text.style.TextAlign.End
if (best == null && house == null) Text(if (game.launchable) "Not played yet" else "Coming soon", Modifier.width(ScoreColumns.best + ScoreColumns.house + ScoreColumns.played),
if (best == null && house == null) Text(if (game.launchable) "Not played yet" else "Coming soon", Modifier.width(ScoreColumns.best + ScoreColumns.house + if (showPlayed) ScoreColumns.played else 0.dp),
color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1, textAlign = end)
else {
Text(best ?: "—", Modifier.width(ScoreColumns.best), color = if (best == null) ArcadeColours.Muted else ArcadeColours.Ink, fontSize = 13.sp, fontWeight = FontWeight.Bold, maxLines = 1, textAlign = end, style = Figures)
Text(house.orEmpty(), Modifier.width(ScoreColumns.house), color = if (houseBest?.mine == true) ArcadeColours.Yellow else ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, textAlign = end, style = Figures)
Text(playedLabel(record.lastPlayedMs, now), Modifier.width(ScoreColumns.played), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1, textAlign = end)
if (showPlayed) Text(playedLabel(record.lastPlayedMs, now), Modifier.width(ScoreColumns.played), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1, textAlign = end)
}
Text(householdRecord ?: "—", Modifier.width(ScoreColumns.household), color = if (householdRecord == null) ArcadeColours.Muted else ArcadeColours.Ink, fontSize = 13.sp,
fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, textAlign = end, style = Figures)
@@ -140,7 +152,8 @@ private fun TopTen(game: ArcadeGame, table: ScoreTable, entries: List<HouseRun>,
LaunchedEffect(Unit) { runCatching { close.requestFocus() } }
BackHandler(onBack = onClose)
ArcadeScrim {
Column(Modifier.width(360.dp).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp),
// Back caught here too (0.129, found on the emulator): the Top 10 is its own window, so the page's BackHandler never heard it.
Column(Modifier.width(360.dp).onBackKey(action = onClose).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(title, color = ArcadeColours.Ink, fontFamily = Anton, fontSize = 22.sp)
Text("The whole house, every room", color = ArcadeColours.Muted, fontSize = 12.sp)
@@ -188,7 +201,8 @@ internal fun HowToPage(visible: List<ArcadeGame>) {
var shown by remember { mutableStateOf(visible.firstOrNull { it.launchable }) }
PageTitle("HOW TO PLAY", "Every game's keys on the remote")
Row(Modifier.fillMaxSize(), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Column(Modifier.width(220.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
// Scrolls (0.129): with every game listed, the last were below the foot of the screen.
Column(Modifier.width(220.dp).fillMaxHeight().verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(4.dp)) {
visible.filter { it.launchable }.forEach { g ->
ArcadeButton(g.title, Modifier.fillMaxWidth().onFocusChanged { if (it.isFocused) shown = g }, height = 26.dp, onClick = { open = g })
}
@@ -248,7 +262,7 @@ internal fun ArcadeSettingsPage(profile: Profile, data: ArcadeProfileData, onCha
val audio = AudioPrefs.of(data.settings)
PageTitle("ARCADE SETTINGS", "For ${profile.name}, every game in the Arcade")
Row(Modifier.fillMaxSize(), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Column(Modifier.weight(1f).fillMaxHeight().verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(8.dp)) {
SettingsCard("Audio", "🔊") {
ToggleRow("Music", audio.music) { onChange("music", !audio.music) }
ToggleRow("Effects", audio.effects) { onChange("effects", !audio.effects) }
@@ -266,7 +280,7 @@ internal fun ArcadeSettingsPage(profile: Profile, data: ArcadeProfileData, onCha
ArcadeButton("Restart, reset or clear", Modifier.fillMaxWidth(), detail = "4 choices ›", height = 26.dp, onClick = onReset)
}
}
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Column(Modifier.weight(1f).fillMaxHeight().verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(8.dp)) {
SettingsCard("Gameplay", "🎮") {
val difficulty = difficultyFor(data, profile.kind)
// OK steps through Gentle, Normal and Tricky; all three are shown, the chosen one lit.
@@ -332,7 +346,7 @@ internal fun ResetPage(profile: Profile, visible: List<ArcadeGame>, data: Arcade
if (game == null) {
val first = remember { FocusRequester() }
LaunchedEffect(Unit) { runCatching { first.requestFocus() } }
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Column(Modifier.fillMaxHeight().verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text("Choose a game", color = ArcadeColours.Muted, fontSize = 13.sp)
games.chunked(2).forEachIndexed { r, pair ->
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
@@ -44,6 +44,16 @@ class ProgrammeArtworkTest {
assertEquals(1, fetches)
}
@Test fun aShowWithNoPictureIsNotAskedForAgainAndAgain() {
val cache = cache()
var fetches = 0
repeat(5) { i -> assertNull(loadArtwork(cache, "ep$i", "show") { fetches++; null }) }
// The first programme tries its four places; the rest of the show's programmes ask nothing.
assertEquals(4, fetches)
assertTrue(cache.knownMissing("show"))
assertFalse(cache.knownMissing("show", System.currentTimeMillis() + MISSING_RETRY_MS + 1))
}
@Test fun theCacheStaysBounded() {
val dir = folder.newFolder(); val cache = ArtworkCache(dir)
repeat(160) { cache.put("k$it", png) }
Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB