diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index d74dee56..b1d93464 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -9,8 +9,8 @@ android { applicationId = "tv.orbit.classic" minSdk = 26 targetSdk = 36 - versionCode = 231 - versionName = "0.108.71-new-channels" + versionCode = 232 + versionName = "0.108.72-watching-bar" } buildFeatures { compose = true } // The finished build for the TVs (Paul, 6 November 2026: the test build stuttered on the box). Not debuggable, so diff --git a/android/app/src/main/java/tv/orbit/classic/ClassicProgrammeStrip.kt b/android/app/src/main/java/tv/orbit/classic/ClassicProgrammeStrip.kt index 7dbda74f..7d8ad8b7 100644 --- a/android/app/src/main/java/tv/orbit/classic/ClassicProgrammeStrip.kt +++ b/android/app/src/main/java/tv/orbit/classic/ClassicProgrammeStrip.kt @@ -3,6 +3,8 @@ package tv.orbit.classic import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.ui.draw.clip import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -17,27 +19,43 @@ import java.text.SimpleDateFormat import java.util.Date import java.util.Locale -/** First visual pass: the icon row previews the future scheduled-channel controls. */ +/** + * The programme bar OK brings up (redesigned 6 November 2026, design/watching): one rounded card drawn only from the look's + * tokens, so it matches every theme. Channel and time, NOW with the title and how far through, NEXT, then the buttons. With + * 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) { +internal fun ClassicProgrammeStrip(item: SampleItem, playing: Boolean, modifier: Modifier = Modifier, scheduled: ScheduledPlayback? = null, panelOpen: Boolean = false) { // 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) { - 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 = NightNavy, fontSize = 13.sp) - } - Column(Modifier.fillMaxWidth().background(Blue).padding(horizontal = 14.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(3.dp)) { + val card = RoundedCornerShape(8.dp) + Column(modifier.clip(card).background(Deep.copy(alpha = .94f)).border(1.dp, Blue, card)) { + Column(Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp, top = 10.dp, bottom = 8.dp), verticalArrangement = Arrangement.spacedBy(5.dp)) { + Row(verticalAlignment = Alignment.CenterVertically) { + if (scheduled != null) Text(scheduled.channel.number.toString(), color = Yellow, fontWeight = FontWeight.Bold, fontSize = 16.sp) + Text((if (scheduled != null) " " else "") + (scheduled?.let { "${ChannelBrands.displayName(it.channel)}${if (it.catchingUp()) " · Catch Up" else if (it.clockOffsetMs != 0L) " · Transition check" else ""}" } ?: "Orbit Preview"), + color = Ink, fontWeight = FontWeight.Bold, fontSize = 16.sp, maxLines = 1) + Spacer(Modifier.weight(1f)) + Text(SimpleDateFormat("HH:mm EEE d MMM", Locale.UK).format(Date(now)), color = Muted, fontSize = 13.sp) + } 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, Modifier.weight(1f, fill = false), color = Ink, fontWeight = FontWeight.Bold, fontSize = 20.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) + Text(if (catching) (if (playing) "FROM START" else "PAUSED") else if (playing || scheduled != null) "NOW" else "PAUSED", + Modifier.background(Yellow, RoundedCornerShape(4.dp)).padding(horizontal = 7.dp, vertical = 2.dp), color = OnAccent, fontWeight = FontWeight.Bold, fontSize = 13.sp) + Text(" " + item.title, Modifier.weight(1f, fill = false), color = Ink, fontWeight = FontWeight.Bold, fontSize = 20.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) // A short in a slot says where it sits: "Cartoon Shorts · 3 of 6" (Paul, 6 November 2026). scheduled?.let { shortsLine(it.channel, it.programme) }?.let { line -> Text(" $line", color = Muted, fontWeight = FontWeight.SemiBold, fontSize = 14.sp, maxLines = 1) } + Spacer(Modifier.weight(1f)) + scheduled?.takeIf { !it.catchingUp() }?.let { Text("${clock(it.programme.startMs)} to ${clock(it.next.startMs)}", color = Muted, fontSize = 13.sp) } + } + // How far through: the accent along a track of the raised colour. + scheduled?.let { s -> + val into = s.programme.offsetAt(s.nowMs()).toFloat(); val length = s.programme.media.durationMs.coerceAtLeast(1).toFloat() + Box(Modifier.fillMaxWidth().height(4.dp).background(Blue, RoundedCornerShape(2.dp))) { + Box(Modifier.fillMaxWidth((into / length).coerceIn(0f, 1f)).fillMaxHeight().background(Yellow, RoundedCornerShape(2.dp))) + } } Row(verticalAlignment = Alignment.CenterVertically) { if (scheduled != null && scheduled.catchingUp()) { @@ -47,33 +65,36 @@ internal fun ClassicProgrammeStrip(item: SampleItem, playing: Boolean, modifier: 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(if (scheduled == null) "INFO " else "NEXT ", 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 = Ink, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) + color = Muted, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis) } } - Row(Modifier.fillMaxWidth().background(paper).padding(horizontal = 14.dp, vertical = 5.dp), - horizontalArrangement = Arrangement.spacedBy(30.dp), verticalAlignment = Alignment.CenterVertically) { - if (scheduled != null && scheduled.catchingUp()) { - Legend("◄ ►", "Skip 30 s"); Legend("OK", "Pause"); Legend("▲ ▼", "Back to live"); Legend("↶", "Leave Catch Up") - return@Row - } - Legend("▲ ▼", "Channel") - Legend("↶", "TV guide") - if (scheduled != null) { - Legend("◄", "Last channel") - Legend("►", "Subtitles, audio, sleep") - Legend("Hold OK", "Number") + Row(Modifier.fillMaxWidth().background(Panel).padding(horizontal = 16.dp, vertical = 6.dp), + horizontalArrangement = Arrangement.spacedBy(22.dp), verticalAlignment = Alignment.CenterVertically) { + when { + panelOpen -> { Legend("▲ ▼", "Move"); Legend("OK", "Choose"); Legend("↶", "Close") } + scheduled != null && scheduled.catchingUp() -> { Legend("◄ ►", "Skip 30 s"); Legend("OK", "Pause"); Legend("▲ ▼", "Back to live"); Legend("↶", "Leave Catch Up") } + else -> { + Legend("▲ ▼", "Channel") + Legend("↶", "TV guide") + if (scheduled != null) { + Legend("◄", "Last channel") + Legend("►", "Subtitles, sound, sleep") + Legend("Hold OK", "Number") + } + } } } } } +/** A remote button, as a small key in the raised colour, and what it does. */ @Composable private fun Legend(icon: String, label: String) { - Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { - Text(icon, color = NightNavy, fontSize = 16.sp, fontWeight = FontWeight.Bold) - Text(label, color = NightNavy, fontSize = 14.sp, fontWeight = FontWeight.Bold) + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(7.dp)) { + Text(icon, Modifier.background(Blue, RoundedCornerShape(4.dp)).padding(horizontal = 6.dp, vertical = 1.dp), color = Ink, fontSize = 12.sp, fontWeight = FontWeight.Bold) + Text(label, color = Ink, fontSize = 13.sp, fontWeight = FontWeight.SemiBold) } } diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt index 8f96f72c..7b934313 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt @@ -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 = when (kind) { - ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.71\"") + + ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.72\"") + (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.71\"" + + ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.72\"" + (token?.let { ", Token=\"$it\"" } ?: "")) } /** One picture from the provider, or nothing. Same fixed origin and no redirects, and failures are never shown or logged. */ diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackDialog.kt b/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackDialog.kt index 4156e2f1..d71615b1 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackDialog.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyPlaybackDialog.kt @@ -347,6 +347,8 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl Box(Modifier.fillMaxSize().background(if (squeeze > 0f) Navy else Color.Black)) { val framed = if (squeeze <= 0f) Modifier.fillMaxSize() else Modifier.padding(start = (36 * squeeze).dp, top = (60 * squeeze).dp) .fillMaxWidth(1f - SQUEEZE_SHRINK * squeeze).fillMaxHeight(1f - SQUEEZE_SHRINK * squeeze) + // Subtitles lift clear of the programme bar while it's up, and settle back to the foot of the picture after. + val subtitlesLifted = (infoVisible || trackMenu != null) && ready && squeeze == 0f AndroidView(modifier = framed, factory = { nativeContext -> PlayerView(nativeContext).apply { useController = false @@ -469,7 +471,7 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl isFocusable = true; isFocusableInTouchMode = true post { requestFocus() } } - }, update = { it.player = player }, onRelease = { it.player = null }) + }, update = { it.player = player; it.subtitleView?.setBottomPaddingFraction(if (subtitlesLifted) .32f else androidx.media3.ui.SubtitleView.DEFAULT_BOTTOM_PADDING_FRACTION) }, onRelease = { it.player = null }) if (scheduled != null && !ready && failure == null && foreground) ChannelTuningBackdrop(scheduled.channel.number) { ProgrammeArtwork(session, scheduled.channel, scheduled.programme) } if (scheduled?.catchingUp() == true && ready && failure == null) CatchUpBadge(Modifier.align(Alignment.TopStart).padding(top = 28.dp, start = 40.dp)) @@ -486,11 +488,15 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl 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(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) + // The bar and the subtitles and sound panel together (design/watching): the panel docks above the bar's right + // end, so it never hangs over it, and the bar stays while the panel is open. + val barUp = (infoVisible || trackMenu != null) && failure == null && ready && squeeze == 0f + if (barUp || trackMenu != null) Column(Modifier.align(Alignment.BottomCenter).fillMaxWidth(.86f).padding(bottom = 26.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) { + trackMenu?.let { Box(Modifier.fillMaxWidth()) { TrackPanel(it, trackCursor, Modifier.align(Alignment.BottomEnd)) } } + if (barUp) ClassicProgrammeStrip(plan.item, playing, Modifier.fillMaxWidth(), scheduled = scheduled, panelOpen = trackMenu != null) + } 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 = 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. diff --git a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt index 9c750b27..3303bcbb 100644 --- a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt +++ b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt @@ -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.71") + next.setRequestProperty("User-Agent", "OrbitTV/0.108.72") 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()) { diff --git a/android/app/src/main/java/tv/orbit/classic/WatchingControls.kt b/android/app/src/main/java/tv/orbit/classic/WatchingControls.kt index 347f91ae..70619225 100644 --- a/android/app/src/main/java/tv/orbit/classic/WatchingControls.kt +++ b/android/app/src/main/java/tv/orbit/classic/WatchingControls.kt @@ -92,19 +92,22 @@ private const val TRACK_PANEL_ROWS = 12 /** Sits to one side, so the programme keeps playing while you choose. */ @Composable internal fun TrackPanel(rows: List, cursor: Int, modifier: Modifier = Modifier) { - val corner = RoundedCornerShape(6.dp) + // The same card as the programme bar, in the look's own colours (design/watching); the bar below carries the buttons. + val corner = RoundedCornerShape(8.dp) // Subtitles, sound and the sleep timer can be more than the screen holds, so it shows a stretch around the cursor. val first = (cursor - TRACK_PANEL_ROWS / 2).coerceIn(0, (rows.size - TRACK_PANEL_ROWS).coerceAtLeast(0)) - Column(modifier.width(280.dp).background(Navy.copy(alpha = .94f), corner).border(1.dp, Panel, corner).padding(12.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { - if (first > 0) Text("▲ more", color = Muted, fontSize = 11.sp) + Column(modifier.width(300.dp).background(Deep.copy(alpha = .96f), corner).border(1.dp, Blue, corner).padding(10.dp), verticalArrangement = Arrangement.spacedBy(3.dp)) { + if (first > 0) Text("▲ more", color = Muted, fontSize = 11.sp, modifier = Modifier.padding(start = 8.dp)) rows.forEachIndexed { index, row -> if (index < first || index >= first + TRACK_PANEL_ROWS) return@forEachIndexed - 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)) + if (index == first || rows[index - 1].section != row.section) { + if (index != first) Box(Modifier.padding(horizontal = 8.dp, vertical = 4.dp).fillMaxWidth().height(1.dp).background(Blue)) + Text(row.section.uppercase(), color = Muted, fontSize = 12.sp, fontWeight = FontWeight.Bold, letterSpacing = 2.sp, modifier = Modifier.padding(start = 8.dp, top = 2.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), + Text((if (row.selected) "✓ " else " ") + row.label, Modifier.fillMaxWidth().background(if (on) Yellow else Color.Transparent, RoundedCornerShape(6.dp)).padding(horizontal = 10.dp, vertical = 4.dp), 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)) + if (first + TRACK_PANEL_ROWS < rows.size) Text("▼ more", color = Muted, fontSize = 11.sp, modifier = Modifier.padding(start = 8.dp)) } }