Bring back the now marker without crossing titles, new icons and app icon (0.65.0)
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m51s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m23s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-02 11:19:07 +00:00
co-authored by Claude Opus 5.5
parent 93fe749b63
commit 5257ffdad8
20 changed files with 85 additions and 11 deletions
@@ -66,7 +66,7 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI
connection.connectTimeout = 10_000
connection.readTimeout = request.readTimeoutMs ?: if (request.path == "/Sessions/Logout") 5_000 else 15_000
connection.setRequestProperty("Accept", "application/json")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.64.0\"")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.65.0\"")
request.token?.let { connection.setRequestProperty("X-Emby-Token", it) }
if (request.method == "POST") {
val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8)
@@ -71,6 +71,10 @@ internal fun guideWatchableCells(cells: List<GuideCell>, nowMs: Long): List<Guid
return listOf(first.copy(startFraction = 0f, widthFraction = first.startFraction + first.widthFraction)) + left.drop(1)
}
/** Where now sits across the window, or null when the guide has moved on to later times. */
internal fun guideNowFraction(nowMs: Long, windowStart: Long, windowEnd: Long): Float? =
if (nowMs < windowStart || nowMs >= windowEnd) null else (nowMs - windowStart).toFloat() / (windowEnd - windowStart)
/** Below this a title can't fit, so the block shows it's cut short rather than sitting empty. */
private val GuideTitleMinWidth = 34.dp
@@ -108,6 +112,7 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
BackHandler(onBack = onBack)
val windowStart = guideWindowStart(now, slotsAhead)
val windowEnd = windowStart + GUIDE_SLOTS * GUIDE_SLOT_MS
val nowFraction = guideNowFraction(now, windowStart, windowEnd)
val channel = channels[row.coerceIn(channels.indices)]
val focused = channel.at(maxOf(cursor, now))
fun keepCursorInWindow(time: Long) {
@@ -136,8 +141,11 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
}
Row(Modifier.fillMaxWidth().height(20.dp).background(Panel), verticalAlignment = Alignment.CenterVertically) {
Text(guideDayPrefix(windowStart, now).trim().ifEmpty { "$title, today" }, Modifier.width(136.dp).padding(start = 8.dp), color = Color.White, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
Row(Modifier.weight(1f)) {
repeat(GUIDE_SLOTS) { Text(clock(windowStart + it * GUIDE_SLOT_MS), Modifier.weight(1f).padding(start = 4.dp), color = Color.White, fontSize = 12.sp, fontWeight = FontWeight.SemiBold) }
BoxWithConstraints(Modifier.weight(1f).fillMaxHeight()) {
Row(Modifier.fillMaxSize(), verticalAlignment = Alignment.CenterVertically) {
repeat(GUIDE_SLOTS) { Text(clock(windowStart + it * GUIDE_SLOT_MS), Modifier.weight(1f).padding(start = 4.dp), color = Color.White, fontSize = 12.sp, fontWeight = FontWeight.SemiBold) }
}
if (nowFraction != null) Box(Modifier.align(Alignment.BottomStart).offset(x = maxWidth * nowFraction - 1.dp).size(2.dp, 5.dp).background(Color.White))
}
}
BoxWithConstraints(Modifier.fillMaxWidth().weight(1f)) {
@@ -180,11 +188,14 @@ internal fun GuideGrid(channels: List<SampleChannel>, selectedNumber: Int, modif
val isFocus = gridFocused && index == row && cell.show.startMs == focused.startMs
val onNow = cell.show.startMs <= now
val cellWidth = maxWidth * cell.widthFraction - 3.dp
// 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) Yellow else if (onNow) Blue else Panel).padding(horizontal = 6.dp), contentAlignment = Alignment.CenterStart) {
.background(if (isFocus) Yellow else if (onNow) Blue else Panel), contentAlignment = Alignment.CenterStart) {
val runsOn = cell.show.endMs > windowEnd
val ink = if (isFocus) Navy else Color.White
Row(verticalAlignment = Alignment.CenterVertically) {
if (elapsed > 0.dp) Box(Modifier.align(Alignment.BottomStart).width(elapsed).height(3.dp).background(ink))
Row(Modifier.padding(horizontal = 6.dp), verticalAlignment = Alignment.CenterVertically) {
Text(if (cellWidth >= GuideTitleMinWidth) guideTitleParts(cell.show.media.item.title).first else "…", Modifier.weight(1f, fill = false), color = ink, fontSize = 13.sp,
fontWeight = if (isFocus || onNow) FontWeight.SemiBold else FontWeight.Normal, maxLines = 1, overflow = TextOverflow.Ellipsis)
if (runsOn && cellWidth >= GuideTitleMinWidth) Text(" ►", color = ink, fontSize = 9.sp)
@@ -27,7 +27,7 @@ internal enum class ChannelCategory(val label: String, val icon: Int) {
Entertainment("Entertainment", R.drawable.orbit_icon_entertainment),
Movies("Movies", R.drawable.orbit_icon_movies),
Comedy("Comedy", R.drawable.orbit_icon_comedy),
Cartoons("Cartoons", R.drawable.orbit_icon_kids),
Cartoons("Cartoons", R.drawable.orbit_icon_cartoons),
Kids("Kids", R.drawable.orbit_icon_kids),
Documentaries("Documentaries", R.drawable.orbit_icon_documentaries),
Sport("Sport", R.drawable.orbit_icon_sport)
@@ -33,7 +33,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.64.0")
next.setRequestProperty("User-Agent", "OrbitTV/0.65.0")
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()) {