${I.back}
diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt
index 31995cb6..b1d3b0c6 100644
--- a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt
+++ b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt
@@ -507,6 +507,9 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
PromoOverlay(active, item)
}
}
+ // The phone shows the reminder too, while the TV does (8 November 2026).
+ LaunchedEffect(programmeReminder) { OrbitCompanion.reminderNow = programmeReminder?.let { r ->
+ org.json.JSONObject().put("title", r.title).put("channel", r.channel).put("startMs", r.startMs).put("started", r.stage >= 2) } }
programmeReminder?.let { due ->
fun answered() { saveReminders(reminders.map { if (it.channel == due.channel && it.startMs == due.startMs) it.copy(stage = due.stage) else it }); programmeReminder = null }
ProgrammeReminderCard(due, System.currentTimeMillis(), onDismiss = ::answered, onWatch = {
@@ -806,7 +809,13 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
if (item.driveIn == null) Taste.record(TasteKind.Saved, item.entry.media.item.id, item.entry.seriesId, item.entry.media.item.title, item.channel, "reminder") })
else -> GuideGrid(channelsIn(guideCategory, availableChannels).ifEmpty { availableChannels }, selectedNumber, modifier, guideCategory, homeCategories(availableChannels.map { it.number }), picture,
onCategory = { guideCategory = it }, onWatch = ::tune, onBack = { guideCategory = ChannelCategory.All; onHome() }, onCatchUp = { catchUpOpen = it },
- onPicture = { tune(selectedNumber, 0) }, onRest = { rested -> scope.launch { TuneAhead.warm(liveSession, rested) } })
+ onPicture = { tune(selectedNumber, 0) }, onRest = { rested -> scope.launch { TuneAhead.warm(liveSession, rested) } },
+ reminders = reminders, onRemind = { number, startMs, title, on ->
+ val kept = liveReminders(reminders, System.currentTimeMillis()).filterNot { it.channel == number && it.startMs == startMs }
+ saveReminders(if (on) kept + ProgrammeReminder(number, startMs, title) else kept)
+ if (on) scheduledChannels[number]?.let { c -> runCatching { c.at(startMs) }.getOrNull()?.let { show ->
+ Taste.record(TasteKind.Saved, show.media.item.id, c.seriesIdAt(startMs), show.media.item.title, number, "reminder") } }
+ })
}
return
}
diff --git a/android/app/src/main/java/tv/orbit/classic/GuideGrid.kt b/android/app/src/main/java/tv/orbit/classic/GuideGrid.kt
index b5750e31..f07f345c 100644
--- a/android/app/src/main/java/tv/orbit/classic/GuideGrid.kt
+++ b/android/app/src/main/java/tv/orbit/classic/GuideGrid.kt
@@ -125,7 +125,11 @@ internal fun GuideGrid(channels: List
, selectedNumber: Int, modif
/** The channel on the row the cursor has rested on for a moment, to get it ready ahead ([TuneAhead]). */
onRest: (SampleChannel) -> Unit = {},
/** OK on a finished programme that can be caught up. */
- onCatchUp: (CatchUpEntry) -> Unit = {}) {
+ onCatchUp: (CatchUpEntry) -> Unit = {},
+ /** Reminders set, so a later programme shows it has one. */
+ reminders: List = emptyList(),
+ /** OK on a later programme: set its reminder, or take it off again (Paul, 8 November 2026). */
+ onRemind: (channel: Int, startMs: Long, title: String, on: Boolean) -> Unit = { _, _, _, _ -> }) {
val title = category.label
// Moves on as the minute turns: nothing here shows seconds.
val now by rememberMinuteClock()
@@ -138,7 +142,6 @@ internal fun GuideGrid(channels: List, selectedNumber: Int, modif
val pictureFocus = remember { FocusRequester() }
var gridFocused by remember { mutableStateOf(true) }
LaunchedEffect(Unit) { gridFocus.requestFocus() }
- BackHandler(onBack = onBack)
val windowStart = guideWindowStart(now, slotsAhead)
val windowEnd = windowStart + GUIDE_SLOTS * GUIDE_SLOT_MS
val nowFraction = guideNowFraction(now, windowStart, windowEnd)
@@ -152,6 +155,13 @@ internal fun GuideGrid(channels: List, selectedNumber: Int, modif
openSlot?.let { (slotChannel, slot) -> ShortsSlotDetails(slotChannel, slot, now, onClose = { openSlot = null },
onCatchUp = { show -> openSlot = null; onCatchUp(catchUpEntry(slotChannel, show)) }, onWatch = { openSlot = null; onWatch(slotChannel.number, 0) }) }
val focusedPast = focused.endMs <= now && catchUpAvailable(channel, focused, now)
+ // Back to now (Paul, 8 November 2026): after browsing later times or other channels, Back first returns to what's on now on
+ // the tuned channel; Back again leaves the guide as before.
+ val focusedLater = focused.startMs > now
+ val reminded = focusedLater && reminders.any { it.channel == channel.number && it.startMs == focused.startMs }
+ val tunedRow = channels.indexOfFirst { it.number == selectedNumber }.coerceAtLeast(0)
+ val awayFromNow = slotsAhead != 0 || focused.startMs > now || row != tunedRow
+ BackHandler { if (awayFromNow) { cursor = now; slotsAhead = 0; row = tunedRow } else onBack() }
fun keepCursorInWindow(time: Long) {
cursor = time
val base = guideWindowStart(now, 0)
@@ -179,6 +189,13 @@ internal fun GuideGrid(channels: List, selectedNumber: Int, modif
if (focusedPast) Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
CatchUpMark(); Text("CATCH UP • OK to watch from the start", color = CatchUpGreen, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
}
+ else if (focusedLater) Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
+ Text(if (reminded) "REMINDER SET • OK to take it off" else "OK Remind me", color = if (reminded) Yellow else Ink, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
+ Text("BACK Back to now", Modifier.background(Yellow, androidx.compose.foundation.shape.RoundedCornerShape(3.dp)).padding(horizontal = 6.dp, vertical = 1.dp),
+ color = OnAccent, fontSize = 12.sp, fontWeight = FontWeight.Bold)
+ }
+ else if (awayFromNow) Text("BACK Back to now", Modifier.background(Yellow, androidx.compose.foundation.shape.RoundedCornerShape(3.dp)).padding(horizontal = 6.dp, vertical = 1.dp),
+ color = OnAccent, fontSize = 12.sp, fontWeight = FontWeight.Bold)
}
// The picture can be chosen: up from the top row reaches it, OK goes full screen on it, down comes back.
var pictureFocused by remember { mutableStateOf(false) }
@@ -225,6 +242,8 @@ internal fun GuideGrid(channels: List, selectedNumber: Int, modif
if (native.repeatCount == 0 && slot != null) openSlot = slot
else if (native.repeatCount == 0 && focusedPast) onCatchUp(catchUpEntry(channel, focused))
else if (native.repeatCount == 0 && focused.startMs <= now) onWatch(channel.number, 0)
+ else if (native.repeatCount == 0 && focusedLater && !kidsAsleep(takeoverOf(channel.number, focused)))
+ onRemind(channel.number, focused.startMs, guideTitle(channel.number, focused).first, !reminded)
true
}
else -> false
diff --git a/android/app/src/main/java/tv/orbit/classic/Idents.kt b/android/app/src/main/java/tv/orbit/classic/Idents.kt
index d972b534..85ebc754 100644
--- a/android/app/src/main/java/tv/orbit/classic/Idents.kt
+++ b/android/app/src/main/java/tv/orbit/classic/Idents.kt
@@ -48,6 +48,14 @@ private val IdentVideos = mapOf(108 to R.raw.ident_108, 109 to R.raw.ident_109,
*/
internal fun identVolume(quiet: Boolean) = if (quiet) .4f else 1f
+/** Late at night: 11pm until 7am by the box's clock (Paul, 8 November 2026: "so a thunderclap on After Dark doesn't wake anyone"). */
+internal fun identLateNight(nowMs: Long, zone: java.time.ZoneId = java.time.ZoneId.systemDefault()): Boolean =
+ java.time.Instant.ofEpochMilli(nowMs).atZone(zone).hour.let { it >= 23 || it < 7 }
+
+/** Whether ident sound plays softly now: always, when set; late at night, unless that's turned off. */
+internal fun identQuietNow(settings: OrbitSettings, nowMs: Long = System.currentTimeMillis()) =
+ settings.identSoundQuiet || (settings.identSoundNightQuiet && identLateNight(nowMs))
+
internal object IdentStings {
private val last = HashMap()
const val GAP_MS = 20 * 60_000L
@@ -142,8 +150,8 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
}
seekTo(startedLateMs.coerceIn(0, identMs))
volume = if (block != null) (if (settings.blockIdentSound) 1f else 0f)
- else if (mood != null && settings.identSound && !settings.reduceMotion && TotsJingle.take(mood, System.currentTimeMillis())) identVolume(settings.identSoundQuiet)
- else if (mood == null && settings.identSound && IdentStings.take(channel.number, System.currentTimeMillis())) identVolume(settings.identSoundQuiet) else 0f
+ else if (mood != null && settings.identSound && !settings.reduceMotion && TotsJingle.take(mood, System.currentTimeMillis())) identVolume(identQuietNow(settings))
+ else if (mood == null && settings.identSound && IdentStings.take(channel.number, System.currentTimeMillis())) identVolume(identQuietNow(settings)) else 0f
addListener(object : androidx.media3.common.Player.Listener {
override fun onPlayerError(error: androidx.media3.common.PlaybackException) {
android.util.Log.w("OrbitSchedule", "ident channel=${channel.number} failed=${error.errorCodeName}"); failed = true
diff --git a/android/app/src/main/java/tv/orbit/classic/OrbitCompanion.kt b/android/app/src/main/java/tv/orbit/classic/OrbitCompanion.kt
index 0779969d..e8a2ce9c 100644
--- a/android/app/src/main/java/tv/orbit/classic/OrbitCompanion.kt
+++ b/android/app/src/main/java/tv/orbit/classic/OrbitCompanion.kt
@@ -124,6 +124,8 @@ internal object OrbitCompanion {
/** What the TV is on: the chosen channel, what it's showing at the TV's clock, and what's next. */
/** Orbit is on the TV's screen; false while the TV shows another app (phones and paired rooms still connect). */
@Volatile var onTv = true
+ /** The programme reminder showing on the TV now, for the phone. */
+ @Volatile var reminderNow: org.json.JSONObject? = null
fun now(screen: CompanionScreen, nowMs: Long): JSONObject {
val reply = JSONObject().put("room", Rooms.name).put("look", look()).put("serverMs", nowMs)
val channel = screen.channels().firstOrNull { it.number == screen.selected() } ?: return reply.put("channel", JSONObject.NULL)
diff --git a/android/app/src/main/java/tv/orbit/classic/PhoneLink.kt b/android/app/src/main/java/tv/orbit/classic/PhoneLink.kt
index 3a473214..35fa5844 100644
--- a/android/app/src/main/java/tv/orbit/classic/PhoneLink.kt
+++ b/android/app/src/main/java/tv/orbit/classic/PhoneLink.kt
@@ -491,7 +491,7 @@ internal object PhoneLink {
fun body() = runCatching { JSONObject(r.body) }.getOrNull() ?: JSONObject()
fun onScreen(block: () -> Unit) = runBlocking { withContext(mainDispatcher) { block() } }
when ("${r.method} ${r.path}") {
- "GET /api/now" -> json(out, 200, OrbitCompanion.now(s, now).put("queue", OrbitCompanion.queueJson()).put("onTv", OrbitCompanion.onTv))
+ "GET /api/now" -> json(out, 200, OrbitCompanion.now(s, now).put("queue", OrbitCompanion.queueJson()).put("onTv", OrbitCompanion.onTv).put("reminder", OrbitCompanion.reminderNow ?: org.json.JSONObject.NULL))
"GET /api/guide" -> json(out, 200, OrbitCompanion.guide(s, now))
"GET /api/catchup" -> json(out, 200, JSONObject().put("shelves", OrbitCompanion.catchUp(s, now)))
"GET /api/rooms" -> json(out, 200, OrbitCompanion.rooms(appContext))
diff --git a/android/app/src/main/java/tv/orbit/classic/Settings.kt b/android/app/src/main/java/tv/orbit/classic/Settings.kt
index 8822f620..a3e262d1 100644
--- a/android/app/src/main/java/tv/orbit/classic/Settings.kt
+++ b/android/app/src/main/java/tv/orbit/classic/Settings.kt
@@ -98,6 +98,10 @@ internal class OrbitSettings(context: Context) {
var identSoundQuiet: Boolean
get() = saved.getBoolean("ident_sound_quiet", false)
set(value) { saved.edit().putBoolean("ident_sound_quiet", value).apply() }
+ /** Quiet on its own late at night, 11pm to 7am (Paul, 8 November 2026). On by default. */
+ var identSoundNightQuiet: Boolean
+ get() = saved.getBoolean("ident_sound_night_quiet", true)
+ set(value) { saved.edit().putBoolean("ident_sound_night_quiet", value).apply() }
var driveInIntro: Boolean
get() = saved.getBoolean("drive_in_intro", true)
set(value) { saved.edit().putBoolean("drive_in_intro", value).apply() }
@@ -265,6 +269,7 @@ private fun ViewingDetail(firstSwitch: FocusRequester, modifier: Modifier, top:
var idents by remember { mutableStateOf(settings.idents) }
var identSound by remember { mutableStateOf(settings.identSound) }
var identSoundQuiet by remember { mutableStateOf(settings.identSoundQuiet) }
+ var identSoundNightQuiet by remember { mutableStateOf(settings.identSoundNightQuiet) }
var driveInIntro by remember { mutableStateOf(settings.driveInIntro) }
var reduceMotion by remember { mutableStateOf(settings.reduceMotion) }
var squeezeBack by remember { mutableStateOf(settings.squeezeBack) }
@@ -292,12 +297,19 @@ private fun ViewingDetail(firstSwitch: FocusRequester, modifier: Modifier, top:
SettingLine("Quiet ident sound", "Play the ident sounds softly, well under the programmes. Reduce motion shows idents as a still card, with no sound.") {
OnOff(identSoundQuiet, Modifier, enabled = identSound, onClick = { identSoundQuiet = !identSoundQuiet; settings.identSoundQuiet = identSoundQuiet })
}
+ SettingLine("Quieter late at night", "From 11pm to 7am, ident sounds play softly on their own, so nobody's woken.") {
+ OnOff(identSoundNightQuiet, Modifier, enabled = identSound && !identSoundQuiet, onClick = { identSoundNightQuiet = !identSoundNightQuiet; settings.identSoundNightQuiet = identSoundNightQuiet })
+ }
SettingLine("Special idents", "Give named blocks and events their own ident as they begin, such as Riot Laughs or PPV Sunday. Off uses each channel's usual ident.") {
OnOff(specialIdents, Modifier, onClick = { specialIdents = !specialIdents; settings.specialIdents = specialIdents })
}
SettingLine("Special ident sound", "Play the short sound with each special ident. Off keeps them silent.") {
OnOff(blockIdentSound, Modifier, onClick = { blockIdentSound = !blockIdentSound; settings.blockIdentSound = blockIdentSound })
}
+ // Credits for the sounds Paul chose (8 November 2026): royalty-free effects, named with thanks (design/channels/sound/samples).
+ Text("Sound credits: VHS, Horror, After Dark, Vortex, Heroes, Riot, Paradox and Ring X use royalty-free effects from Pixabay by " +
+ "freesound_community, jusatti890, tomas_herudek, audiopapkin, vishiv and other Pixabay creators, mastered for Orbit. Thank you.",
+ Modifier.fillMaxWidth().clip(RailCorner).background(Panel).padding(horizontal = 12.dp, vertical = 8.dp), color = Muted, fontSize = 12.sp)
SettingLine("Squeeze-back", "Over a programme's last minute, the credits shrink into a corner and what's next on the channel fills the screen beside them.") {
OnOff(squeezeBack, Modifier, onClick = { squeezeBack = !squeezeBack; settings.squeezeBack = squeezeBack })
}
diff --git a/android/app/src/test/java/tv/orbit/classic/IdentLateNightTest.kt b/android/app/src/test/java/tv/orbit/classic/IdentLateNightTest.kt
new file mode 100644
index 00000000..8a9bcfc9
--- /dev/null
+++ b/android/app/src/test/java/tv/orbit/classic/IdentLateNightTest.kt
@@ -0,0 +1,16 @@
+package tv.orbit.classic
+
+import org.junit.Assert.*
+import org.junit.Test
+import java.time.ZoneId
+import java.time.ZonedDateTime
+
+/** 8 November 2026: ident sounds play softly from 11pm to 7am. */
+class IdentLateNightTest {
+ private val zone = ZoneId.of("Europe/London")
+ private fun at(h: Int, m: Int = 0) = ZonedDateTime.of(2026, 11, 8, h, m, 0, 0, zone).toInstant().toEpochMilli()
+ @Test fun lateNightIsElevenToSeven() {
+ assertFalse(identLateNight(at(22, 59), zone)); assertTrue(identLateNight(at(23, 0), zone))
+ assertTrue(identLateNight(at(3), zone)); assertTrue(identLateNight(at(6, 59), zone)); assertFalse(identLateNight(at(7), zone))
+ }
+}
diff --git a/android/app/src/test/java/tv/orbit/classic/TasteStayedTest.kt b/android/app/src/test/java/tv/orbit/classic/TasteStayedTest.kt
new file mode 100644
index 00000000..ee2e72b9
--- /dev/null
+++ b/android/app/src/test/java/tv/orbit/classic/TasteStayedTest.kt
@@ -0,0 +1,22 @@
+package tv.orbit.classic
+
+import org.junit.Assert.*
+import org.junit.Rule
+import org.junit.Test
+import org.junit.rules.TemporaryFolder
+
+/** 8 November 2026: a night's real data had no "stayed" and every signal at 0 ms watched. Half-minute notes must add up. */
+class TasteStayedTest {
+ @get:Rule val tmp = TemporaryFolder()
+ @Test fun halfMinuteNotesAddUpToStayed() {
+ val minute = 60_000L; val start = 1_794_000_000_000L
+ val adult = Profile("grown", "Adult", "sil-blue", ProfileKind.Grown)
+ Taste.attach(tmp.root, start)
+ val show = SampleBroadcast(ScheduledMedia(SampleItem("Terror Train", "Movie", 97, "", "6048906", 97 * minute), "src", 97 * minute), start)
+ for (i in 0..60) { val now = start + i * 30_000L; Taste.watching(304, show, null, now - start, now, adult) }
+ val kinds = Taste.store!!.events("grown").map { it.kind to it.watchedMs }
+ println(kinds)
+ assertTrue(kinds.toString(), kinds.any { it.first == TasteKind.Stayed && (it.second ?: 0) >= 20 * minute })
+ assertTrue(kinds.none { it.first == TasteKind.Brief })
+ }
+}