Orbit Simple's list guide and Retro Cable's two-tone guide rows
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -881,6 +881,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
onWatch = { tune(it, 0) }, onDriveIn = onDriveIn, onBack = onHome,
|
||||
onRemind = { item -> saveReminders(liveReminders(reminders, System.currentTimeMillis()) + ProgrammeReminder(item.channel, item.startMs, item.title))
|
||||
if (item.driveIn == null) Taste.record(TasteKind.Saved, item.entry.media.item.id, item.entry.seriesId, item.entry.media.item.title, item.channel, "reminder") })
|
||||
OrbitLayouts.current == OrbitLayout.Simple -> SimpleGuide(availableChannels, selectedNumber, modifier, onWatch = { tune(it, 0) }, onBack = { guideCategory = ChannelCategory.All; onHome() })
|
||||
else -> GuideGrid(channelsIn(guideCategory, availableChannels).ifEmpty { availableChannels }, selectedNumber, modifier, guideCategory, homeCategories(availableChannels.map { it.number }), picture,
|
||||
onCategory = { guideCategory = it }, onWatch = ::tune, onText = { orbiFaxFromTv = false }, onBack = { guideCategory = ChannelCategory.All; onHome() }, onCatchUp = { catchUpOpen = it },
|
||||
onPicture = { tune(selectedNumber, 0) }, onRest = { rested -> scope.launch { TuneAhead.warm(liveSession, rested) } },
|
||||
|
||||
@@ -292,7 +292,7 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
|
||||
rowViews.forEachIndexed { offset, view ->
|
||||
val index = firstRow + offset
|
||||
// Only the row the cursor leaves and the one it reaches change their inputs, so only they are redrawn.
|
||||
GuideRowLine(view, index == row, if (gridFocused && index == row) focused.startMs else null, nowFraction, cellsWidth)
|
||||
GuideRowLine(view, index == row, if (gridFocused && index == row) focused.startMs else null, nowFraction, cellsWidth, alternate = index % 2 == 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,14 +305,18 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
|
||||
|
||||
/** One guide row (9 November 2026): skipped by Compose unless its own inputs change. */
|
||||
@Composable
|
||||
private fun GuideRowLine(view: GuideRowView, selected: Boolean, focusStart: Long?, nowFraction: Float?, cellsWidth: androidx.compose.ui.unit.Dp) {
|
||||
private fun GuideRowLine(view: GuideRowView, selected: Boolean, focusStart: Long?, nowFraction: Float?, cellsWidth: androidx.compose.ui.unit.Dp, alternate: Boolean = false) {
|
||||
val line = view.line
|
||||
// Retro Cable (12 November 2026): rows alternate two tones so the eye can follow a line across, as on an old cable guide.
|
||||
val cable = OrbitLayouts.current == OrbitLayout.RetroCable
|
||||
val rowTone = if (cable && alternate) androidx.compose.ui.graphics.lerp(Panel, Blue, .45f) else Panel
|
||||
val laterTone = if (cable) rowTone else GuideLater
|
||||
Row(Modifier.fillMaxWidth().height(38.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
val mark = view.mark
|
||||
// A takeover on at the guide's time wears its own mark (Paul, 6 November 2026).
|
||||
val takeover = view.takeover
|
||||
Row(Modifier.width(130.dp).fillMaxHeight().background(if (selected) 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)
|
||||
Row(Modifier.width(130.dp).fillMaxHeight().background(if (selected) Blue else rowTone, androidx.compose.foundation.shape.RoundedCornerShape(4.dp)).padding(start = 6.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(line.number.toString(), Modifier.width(30.dp), color = if (cable) Mint else 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(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)
|
||||
@@ -328,7 +332,7 @@ private fun GuideRowLine(view: GuideRowView, selected: Boolean, focusStart: Long
|
||||
// Runs along the foot of what's on now, so the time reads down the rows without crossing a title.
|
||||
val elapsed = if (onNow && nowFraction != null) (maxWidth * (nowFraction - cell.startFraction)).coerceIn(0.dp, cellWidth.coerceAtLeast(0.dp)) else 0.dp
|
||||
Box(Modifier.offset(x = maxWidth * cell.startFraction).width(cellWidth.coerceAtLeast(1.dp)).fillMaxHeight()
|
||||
.background(if (isFocus) Navy else if (past) catchUpDim() else if (onNow) Panel else GuideLater, androidx.compose.foundation.shape.RoundedCornerShape(4.dp))
|
||||
.background(if (isFocus) Navy else if (past) catchUpDim() else if (onNow) rowTone else laterTone, androidx.compose.foundation.shape.RoundedCornerShape(4.dp))
|
||||
// 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 = cellView.runsOn
|
||||
|
||||
@@ -292,6 +292,38 @@ private fun KidsHome(h: LayoutHome, modifier: Modifier) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- Orbit Simple's guide ----------
|
||||
|
||||
/**
|
||||
* Orbit Simple's TV Guide: a list, not a grid. Each channel is one big row with what's on and the time left; the focused row
|
||||
* opens to show what's next and what OK does. Up and Down only.
|
||||
*/
|
||||
@Composable
|
||||
internal fun SimpleGuide(channels: List<SampleChannel>, selectedNumber: Int, modifier: Modifier, onWatch: (Int) -> Unit, onBack: () -> Unit) {
|
||||
androidx.activity.compose.BackHandler(onBack = onBack)
|
||||
val first = firstFocus()
|
||||
androidx.compose.foundation.lazy.LazyColumn(modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
itemsIndexed(channels, key = { _, c -> c.number }) { i, c ->
|
||||
LayoutCard(Modifier.fillMaxWidth(), if (c.number == selectedNumber || (i == 0 && channels.none { it.number == selectedNumber })) first else null,
|
||||
onClick = { onWatch(c.number) }, shape = RoundedCornerShape(12.dp)) { f ->
|
||||
Row(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp), horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.Top) {
|
||||
Text("${c.number}", color = if (f) OnAccent else Ink, fontFamily = BarlowCondensed, fontSize = 26.sp)
|
||||
ChannelLogo(c.number, Modifier.width(110.dp).height(40.dp))
|
||||
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||
val show = nowAt(c)
|
||||
Text(show?.let { guideTitle(c.number, it).first } ?: c.name, color = if (f) OnAccent else Ink, fontSize = 22.sp, fontWeight = FontWeight.Bold, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
if (show != null) Text(leftLabel(show.endMs - System.currentTimeMillis()), color = if (f) OnAccent else Muted, fontSize = 16.sp)
|
||||
if (f && show != null) runCatching { c.at(show.endMs + 1) }.getOrNull()?.let { next ->
|
||||
Text("Next: ${guideTitle(c.number, next).first}", color = OnAccent, fontSize = 17.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text("OK: watch now", color = OnAccent, fontSize = 15.sp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The layouts as a list, for Settings › On screen. */
|
||||
@Composable
|
||||
internal fun LayoutPicker(context: Context = androidx.compose.ui.platform.LocalContext.current) {
|
||||
|
||||
Reference in New Issue
Block a user