Watching bar: Up next shows what's queued from the phone, with its picture
Catch Up or Live, the title, the channel and how many more, in place of the channel's own next while something is queued. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,9 @@ import java.util.Locale
|
||||
* the subtitles and sound panel open ([panelOpen]) it stays up and its buttons are the panel's.
|
||||
*/
|
||||
@Composable
|
||||
internal fun ClassicProgrammeStrip(item: SampleItem, playing: Boolean, modifier: Modifier = Modifier, scheduled: ScheduledPlayback? = null, panelOpen: Boolean = false) {
|
||||
internal fun ClassicProgrammeStrip(item: SampleItem, playing: Boolean, modifier: Modifier = Modifier, scheduled: ScheduledPlayback? = null, panelOpen: Boolean = false,
|
||||
/** The picture for what's queued from the phone, shown in Up next. */
|
||||
queuedArt: (@Composable (Queued, Modifier) -> Unit)? = null) {
|
||||
// Moves on as the minute turns: nothing here shows seconds.
|
||||
val now by rememberMinuteClock()
|
||||
val card = RoundedCornerShape(8.dp)
|
||||
@@ -59,7 +61,15 @@ internal fun ClassicProgrammeStrip(item: SampleItem, playing: Boolean, modifier:
|
||||
Box(Modifier.fillMaxWidth((into / length).coerceIn(0f, 1f)).fillMaxHeight().background(Yellow, RoundedCornerShape(2.dp)))
|
||||
}
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
// Queued from the phone (Paul, 6 November 2026): Up next shows what will play instead of the channel's next.
|
||||
val queued = OrbitCompanion.queue.firstOrNull()
|
||||
if (scheduled != null && queued != null) Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text("UP NEXT ", color = Yellow, fontWeight = FontWeight.Bold, fontSize = 13.sp)
|
||||
queuedArt?.invoke(queued, Modifier.padding(end = 10.dp).size(48.dp, 27.dp).clip(RoundedCornerShape(4.dp)))
|
||||
Text(if (queued.catchUpStartMs != null) "Catch Up · " else "Live · ", color = Muted, fontWeight = FontWeight.Bold, fontSize = 13.sp)
|
||||
Text(queued.title + (queued.sub?.let { " · $it" }.orEmpty()), Modifier.weight(1f, fill = false), color = Ink, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(" ${queued.number} ${queued.channel}" + if (OrbitCompanion.queue.size > 1) " · +${OrbitCompanion.queue.size - 1} more" else "", color = Muted, fontSize = 13.sp, maxLines = 1)
|
||||
} else 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())
|
||||
|
||||
@@ -502,7 +502,8 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl
|
||||
TrackPanel(rows, trackCursor, Modifier.align(Alignment.BottomEnd), maxRows = fits)
|
||||
}
|
||||
}
|
||||
if (barUp) ClassicProgrammeStrip(plan.item, playing, Modifier.fillMaxWidth(), scheduled = scheduled, panelOpen = trackMenu != null)
|
||||
if (barUp) ClassicProgrammeStrip(plan.item, playing, Modifier.fillMaxWidth(), scheduled = scheduled, panelOpen = trackMenu != null,
|
||||
queuedArt = { q, m -> QueuedArtwork(session, q.itemId, q.seriesId, m) })
|
||||
}
|
||||
ident?.invoke()
|
||||
if (window == null) intro?.let { IntroOverlay(it) }
|
||||
|
||||
@@ -48,7 +48,9 @@ internal class CompanionScreen(
|
||||
*/
|
||||
internal class Queued(val number: Int, val channel: String, val title: String, val sub: String?,
|
||||
/** A Catch Up programme's start; null to switch to the channel live. */
|
||||
val catchUpStartMs: Long?)
|
||||
val catchUpStartMs: Long?,
|
||||
/** For its picture in the watching bar's Up next. */
|
||||
val itemId: String = "", val seriesId: String? = null)
|
||||
|
||||
internal object OrbitCompanion {
|
||||
/** The buttons the phone may press, by the name the page uses. */
|
||||
@@ -148,13 +150,16 @@ internal object OrbitCompanion {
|
||||
if (queue.size >= QUEUE_MAX) return null
|
||||
val item = if (catchUpStartMs != null) {
|
||||
val e = catchUpEntry(screen, number, catchUpStartMs, nowMs) ?: return null
|
||||
guideTitleParts(e.show.media.item.title).let { (t, sub) -> Queued(number, e.channel.name, t, sub, catchUpStartMs) }
|
||||
guideTitleParts(e.show.media.item.title).let { (t, sub) -> Queued(number, ChannelBrands.displayName(e.channel), t, sub, catchUpStartMs,
|
||||
e.show.media.item.id, (e.channel as? ScheduledChannel)?.seriesIdAt(e.show.startMs)) }
|
||||
} else {
|
||||
val channel = screen.channels().firstOrNull { it.number == number } ?: return null
|
||||
// What that channel will be showing when the programme on the TV now ends.
|
||||
val tv = screen.channels().firstOrNull { it.number == screen.selected() }
|
||||
val at = tv?.at(nowMs + screen.offset())?.endMs?.minus(screen.offset()) ?: nowMs
|
||||
guideTitleParts(channel.at(at).media.item.title).let { (t, sub) -> Queued(number, channel.name, t, sub, null) }
|
||||
val then = channel.at(at)
|
||||
guideTitleParts(then.media.item.title).let { (t, sub) -> Queued(number, ChannelBrands.displayName(channel), t, sub, null,
|
||||
then.media.item.id, (channel as? ScheduledChannel)?.seriesIdAt(then.startMs)) }
|
||||
}
|
||||
queue = queue + item
|
||||
return item
|
||||
|
||||
@@ -77,3 +77,15 @@ internal fun ProgrammeArtwork(session: EmbySampleSession, channel: SampleChannel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A small picture of what's queued next (Up next in the watching bar), undimmed; nothing while it loads or if there isn't one. */
|
||||
@Composable
|
||||
internal fun QueuedArtwork(session: EmbySampleSession, itemId: String, seriesId: String?, modifier: Modifier = Modifier) {
|
||||
val context = LocalContext.current
|
||||
val picture by produceState<ImageBitmap?>(null, itemId, seriesId) {
|
||||
value = if (itemId.isEmpty()) null else withContext(Dispatchers.IO) {
|
||||
runCatching { loadArtwork(ArtworkCache(Workspaces.current(context).artworkDir), itemId, seriesId, session::fetchArtwork)?.let { BitmapFactory.decodeByteArray(it, 0, it.size)?.asImageBitmap() } }.getOrNull()
|
||||
}
|
||||
}
|
||||
picture?.let { Image(it, null, modifier, contentScale = ContentScale.Crop) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user