diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index b938fc5d..9c9ce067 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 = 217 - versionName = "0.108.57-room-updates" + versionCode = 218 + versionName = "0.108.58-motion" } buildFeatures { compose = true } // Android logging and the like do nothing in unit tests, so whole flows (a channel read from a fake server) can run. 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 0419f4b4..31e4a173 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.57\"") + + ServerKind.Emby -> mapOf("X-Emby-Authorization" to "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.58\"") + (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.57\"" + + ServerKind.Jellyfin -> mapOf("Authorization" to "MediaBrowser Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.58\"" + (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/GuideGrid.kt b/android/app/src/main/java/tv/orbit/classic/GuideGrid.kt index b81bb473..c3d90ecd 100644 --- a/android/app/src/main/java/tv/orbit/classic/GuideGrid.kt +++ b/android/app/src/main/java/tv/orbit/classic/GuideGrid.kt @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clipToBounds import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusProperties import androidx.compose.ui.focus.focusRequester @@ -188,11 +189,14 @@ internal fun GuideGrid(channels: List, selectedNumber: Int, modif if (nowFraction != null) Box(Modifier.align(Alignment.BottomStart).offset(x = maxWidth * nowFraction - 3.dp).size(6.dp, 6.dp).background(Yellow)) } } - BoxWithConstraints(Modifier.fillMaxWidth().weight(1f)) { + BoxWithConstraints(Modifier.fillMaxWidth().weight(1f).clipToBounds()) { val visibleRows = ((maxHeight + 3.dp) / 41.dp).toInt().coerceAtLeast(1) firstRow = guideFirstRow(row, firstRow, visibleRows, channels.size) rowsShown = minOf(visibleRows, channels.size) - Column(Modifier.fillMaxWidth().focusRequester(gridFocus).onFocusChanged { gridFocused = it.isFocused }.focusable().onPreviewKeyEvent { event -> + // The channels ease under the focus a row at a time (design/motion); a held button doesn't wait. + // One row is drawn beyond each edge, out of sight, so a row easing in arrives already drawn. + val lead = if (firstRow > 0) 1 else 0 + Column(Modifier.fillMaxWidth().wrapContentHeight(Alignment.Top, unbounded = true).easeRows(firstRow, 41.dp, lead).focusRequester(gridFocus).onFocusChanged { gridFocused = it.isFocused }.focusable().onPreviewKeyEvent { event -> val native = event.nativeKeyEvent if (native.action != KeyEvent.ACTION_DOWN) return@onPreviewKeyEvent false when (native.keyCode) { @@ -218,8 +222,8 @@ internal fun GuideGrid(channels: List, selectedNumber: Int, modif else -> false } }, verticalArrangement = Arrangement.spacedBy(3.dp)) { - channels.subList(firstRow, minOf(firstRow + visibleRows, channels.size)).forEachIndexed { offset, line -> - val index = firstRow + offset + channels.subList(firstRow - lead, minOf(firstRow + visibleRows + 1, channels.size)).forEachIndexed { offset, line -> + val index = firstRow - lead + offset Row(Modifier.fillMaxWidth().height(38.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) { val mark = ChannelBrands.forNumber(line.number) // A takeover on at the guide's time wears its own mark (Paul, 6 November 2026). diff --git a/android/app/src/main/java/tv/orbit/classic/HomeScreen.kt b/android/app/src/main/java/tv/orbit/classic/HomeScreen.kt index a4cb9b46..7febf931 100644 --- a/android/app/src/main/java/tv/orbit/classic/HomeScreen.kt +++ b/android/app/src/main/java/tv/orbit/classic/HomeScreen.kt @@ -55,7 +55,10 @@ internal fun homeOnNow(channels: List, tunedNumber: Int, count: I internal fun HomeCard(modifier: Modifier = Modifier, focusRequester: FocusRequester? = null, onClick: () -> Unit, content: @Composable (Boolean) -> Unit) { var focused by remember { mutableStateOf(false) } val focus = if (focusRequester != null) Modifier.focusRequester(focusRequester) else Modifier - Box(modifier.then(focus).onFocusChanged { focused = it.isFocused }.clip(HomeCorner).background(if (focused) Yellow else Panel).clickable(onClick = onClick)) { + // Inside a glide area (Home's list) the area draws the gold, so the focused card leaves its fill clear. + val glide = LocalGlide.current + val fill = focusColor(if (focused && glide == null) Yellow else if (focused) Color.Transparent else Panel) + Box(modifier.then(focus).glideTarget(glide).onFocusChanged { focused = it.isFocused }.clip(HomeCorner).background(fill).clickable(onClick = onClick)) { content(focused) } } @@ -74,16 +77,17 @@ internal fun HomeScreen(channels: List, modifier: Modifier = Modi Spacer(Modifier.weight(.6f)) Text("What would you like to watch?", color = Ink, fontFamily = Anton, fontSize = 22.sp) Spacer(Modifier.height(16.dp)) - Column(Modifier.width(400.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { + val glide = rememberGlide() + CompositionLocalProvider(LocalGlide provides glide) { Column(Modifier.width(400.dp).glideArea(glide, Yellow, 6.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { homeCategories(channels.map { it.number }).forEachIndexed { index, category -> - HomeCard(Modifier.fillMaxWidth().height(31.dp).focusProperties { if (index == 0 && nav != null) up = nav }, if (index == 0) firstFocus else null, onClick = { onCategory(category) }) { focused -> + HomeCard(Modifier.fillMaxWidth().height(31.dp).riseIn(index).focusProperties { if (index == 0 && nav != null) up = nav }, if (index == 0) firstFocus else null, onClick = { onCategory(category) }) { focused -> Row(Modifier.fillMaxSize().padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) { Image(painterResource(category.icon), null, Modifier.size(18.dp), colorFilter = ColorFilter.tint(if (focused) OnAccent else Ink)) Text(category.label.uppercase(java.util.Locale.UK), color = if (focused) OnAccent else Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, letterSpacing = .5.sp, maxLines = 1) } } } - } + } } Spacer(Modifier.height(14.dp)) Text("Tonight's Pick and the evening's highlights are in What's On", color = Muted, fontSize = 11.sp) Spacer(Modifier.weight(1f)) diff --git a/android/app/src/main/java/tv/orbit/classic/MainActivity.kt b/android/app/src/main/java/tv/orbit/classic/MainActivity.kt index 4e7f0fe4..b0a7a5d5 100644 --- a/android/app/src/main/java/tv/orbit/classic/MainActivity.kt +++ b/android/app/src/main/java/tv/orbit/classic/MainActivity.kt @@ -59,6 +59,7 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + Motion.load(OrbitSettings(this)) if (intent?.getBooleanExtra("orbit_intro_test", false) == true) IntroTrial.nextTune = true intent?.getStringExtra("orbit_inspect_series")?.take(120)?.let { SeriesInspection.title = it } if (intent?.getBooleanExtra("orbit_read_evidence", false) == true) EvidenceRequest.pending = true @@ -87,8 +88,8 @@ internal fun OrbitButton(label: String, modifier: Modifier = Modifier, selected: enabled: Boolean = true, onFocus: () -> Unit = {}, centred: Boolean = false, onClick: () -> Unit) { var focused by remember { mutableStateOf(false) } Box(contentAlignment = if (centred) Alignment.Center else Alignment.TopStart, modifier = modifier.onFocusChanged { focused = it.isFocused; if (it.isFocused) onFocus() } - .background(if (focused) Yellow else if (selected) Blue else Panel) - .border(if (focused) 2.dp else 1.dp, if (focused) Ink else themed(Color(0xFF38629A)) { Blue }) + .background(focusColor(if (focused) Yellow else if (selected) Blue else Panel)) + .border(if (focused) 2.dp else 1.dp, focusColor(if (focused) Ink else themed(Color(0xFF38629A)) { Blue })) .clickable(enabled = enabled, onClick = onClick).padding(horizontal = 14.dp, vertical = 8.dp)) { Text(label, color = if (focused) OnAccent else Ink, fontSize = 14.sp, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis, fontWeight = if (focused || selected) FontWeight.Bold else FontWeight.Normal) @@ -103,8 +104,10 @@ internal fun OrbitButton(label: String, modifier: Modifier = Modifier, selected: private fun NavItem(label: String, selected: Boolean, focus: FocusRequester?, below: FocusRequester?, onClick: () -> Unit) { var focused by remember { mutableStateOf(false) } val corner = androidx.compose.foundation.shape.RoundedCornerShape(5.dp) - Column((if (focus != null) Modifier.focusRequester(focus) else Modifier).focusProperties { if (below != null) down = below }.height(32.dp).onFocusChanged { focused = it.isFocused } - .background(if (focused) Yellow else Color.Transparent, corner).clickable(onClick = onClick).padding(horizontal = 12.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) { + // The gold glides along the bar (design/motion): the bar draws it, so the item leaves its own fill clear. + val glide = LocalGlide.current + Column((if (focus != null) Modifier.focusRequester(focus) else Modifier).focusProperties { if (below != null) down = below }.height(32.dp).glideTarget(glide).onFocusChanged { focused = it.isFocused } + .background(if (focused && glide == null) Yellow else Color.Transparent, corner).clickable(onClick = onClick).padding(horizontal = 12.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) { Text(label, color = if (focused) OnAccent else if (selected) Ink else Muted, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1) Box(Modifier.padding(top = 2.dp).width(28.dp).height(2.dp).background(if (selected && !focused) Yellow else Color.Transparent)) } @@ -172,8 +175,12 @@ private fun OrbitApp() { CompositionLocalProvider(LocalNavFocus provides navFocus, LocalDriveInFocus provides driveInFocus) { // The Drive-In and a game in play take the whole screen; the bar sits over the Drive-In's sky. val fullBleed = section == "Drive-In" || playingGame - Column(if (fullBleed) Modifier.fillMaxSize() else Modifier.fillMaxSize().padding(start = 36.dp, end = 36.dp, top = 56.dp, bottom = 16.dp)) { - if (!restoreChecked) Text("Tuning in…", color = Muted, fontSize = 15.sp) + // A new section slides on from the side it lies on along the top bar (design/motion); the Drive-In and a + // game have their own openings, and full-screen viewing never moves. + val cameFrom = remember { arrayOf(section) } + val direction = remember(section) { sectionDirection(cameFrom[0], section).also { cameFrom[0] = section } } + val slides = !fullBleed && !FullScreen.active + Column((if (fullBleed) Modifier.fillMaxSize() else Modifier.fillMaxSize().padding(start = 36.dp, end = 36.dp, top = 56.dp, bottom = 16.dp)).arrive(section, direction, slides)) { if (section == "Arcade" && realChannelAvailable && chosen) OrbitArcade(Modifier.weight(1f), onPlaying = { playingGame = it }) EmbyConnectionScreen(if (section == "Arcade") Modifier else Modifier.weight(1f), visible = section == "Connect Emby", onboarding = onboarding, onSignedIn = { if (Onboarding.step == OnboardStep.SignIn) Onboarding.go(OnboardStep.Channels) }, @@ -185,6 +192,11 @@ private fun OrbitApp() { onChannelAvailable = { realChannelAvailable = it }, onRestoreChecked = { restoreChecked = true }, onGuide = { section = "TV Guide" }, onHome = { section = "Home" }, onDriveIn = { section = "Drive-In" }) } + // Tuning in (design/motion): the channels circle the dial while Orbit reads its sign-in and schedules. + // It waits a moment first, so a quick start never pays for it. + var slowStart by remember { mutableStateOf(false) } + LaunchedEffect(Unit) { delay(400); slowStart = true } + if (!restoreChecked && slowStart) MomentClip(Moment.Tuning, loop = true) // The sections sit centred on the screen, over the centred page below; the logo keeps the left, the clock the right. if (picking) WhosWatching(onClose = { activity?.finish() }) // At the end of the flow the one who set Orbit up starts watching as Adult; the tour goes back to Settings. @@ -192,7 +204,8 @@ private fun OrbitApp() { if (!tour) { section = if (realChannelAvailable) "Home" else "Connect Emby"; Profiles.current = Profiles.all.first { it.kind == ProfileKind.Grown } } } if (!playingGame && !picking && !onboarding) Box(Modifier.fillMaxWidth().padding(start = 36.dp, end = 36.dp, top = 12.dp)) { - if (realChannelAvailable) Row(Modifier.align(Alignment.Center), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { + val barGlide = rememberGlide() + if (realChannelAvailable) CompositionLocalProvider(LocalGlide provides barGlide) { Row(Modifier.align(Alignment.Center).glideArea(barGlide, Yellow, 5.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { // The whole-screen Drive-In has nothing for down to find by itself, so it's told. val below = if (section == "Drive-In") driveInFocus else null NavItem("Home", section == "Home", navFocus, below) { section = "Home" } @@ -201,7 +214,7 @@ private fun OrbitApp() { NavItem("Catch Up", section == "Catch Up", null, below) { section = "Catch Up" } if (kidsDriveIn) NavItem("Drive-In", section == "Drive-In", null, below) { section = "Drive-In" } if (kidsArcade) NavItem("Arcade", section == "Arcade", null, below) { section = "Arcade" } - } + } } Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { Image(painterResource(R.drawable.orbit_logo), "Orbit", Modifier.logoPlate().width(144.dp).height(36.dp)) Spacer(Modifier.weight(1f)) diff --git a/android/app/src/main/java/tv/orbit/classic/Moments.kt b/android/app/src/main/java/tv/orbit/classic/Moments.kt new file mode 100644 index 00000000..e7d96dc1 --- /dev/null +++ b/android/app/src/main/java/tv/orbit/classic/Moments.kt @@ -0,0 +1,94 @@ +package tv.orbit.classic + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.focusable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.input.key.onPreviewKeyEvent +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.compose.ui.viewinterop.AndroidView +import androidx.media3.common.MediaItem +import androidx.media3.common.PlaybackException +import androidx.media3.common.Player +import androidx.media3.datasource.RawResourceDataSource +import androidx.media3.exoplayer.ExoPlayer +import androidx.tv.material3.Text +import kotlinx.coroutines.delay + +/** + * Orbit's EffectCraft moments (Paul, 6 November 2026, from the approved motion sheet): short silent clips rendered by + * design/motion/build-moments.py, for the times something worth marking happens. Each plays once and any button skips it; + * Tuning in loops while Orbit opens. With Reduce motion on, each shows its final frame as a still instead. + */ +internal enum class Moment(val video: Int, val still: Int) { + Welcome(R.raw.moment_welcome, R.drawable.moment_welcome_still), + Linked(R.raw.moment_linked, R.drawable.moment_linked_still), + Tuning(R.raw.moment_tuning, R.drawable.moment_tuning_still), + OrbMan(R.raw.moment_arcade_orbman, R.drawable.moment_arcade_orbman_still), + Blast(R.raw.moment_arcade_blast, R.drawable.moment_arcade_blast_still), + Sky(R.raw.moment_arcade_sky, R.drawable.moment_arcade_sky_still), + Hive(R.raw.moment_arcade_hive, R.drawable.moment_arcade_hive_still), + Snake(R.raw.moment_arcade_snake, R.drawable.moment_arcade_snake_still), + Blocks(R.raw.moment_arcade_blocks, R.drawable.moment_arcade_blocks_still), + Bricks(R.raw.moment_arcade_bricks, R.drawable.moment_arcade_bricks_still), + Pairs(R.raw.moment_arcade_pairs, R.drawable.moment_arcade_pairs_still), + Patience(R.raw.moment_arcade_patience, R.drawable.moment_arcade_patience_still); + + companion object { + /** An Arcade game's opening, by the game's own name (the enum's names match). */ + fun forGame(name: String) = entries.firstOrNull { it.name == name } + } +} + +/** How long a still stands in for a moment with Reduce motion on. */ +internal const val MOMENT_STILL_MS = 900L + +/** + * One moment over the whole screen. [onDone] runs when it ends, on any button, or if it can't play; a [loop] (Tuning in) + * plays until whoever shows it takes it away, and ignores buttons so they reach the screen it's waiting for. + */ +@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) +@Composable +internal fun MomentClip(moment: Moment, modifier: Modifier = Modifier, loop: Boolean = false, caption: String? = null, onDone: () -> Unit = {}) { + val context = LocalContext.current + val done by rememberUpdatedState(onDone) + var finished by remember { mutableStateOf(false) } + fun finish() { if (!finished) { finished = true; done() } } + val calm = remember { Motion.reduce } + val focus = remember { FocusRequester() } + Box(modifier.fillMaxSize().background(Navy).then(if (loop) Modifier else Modifier.focusRequester(focus).onPreviewKeyEvent { event -> + // A press skips; the lift of the press that opened the moment doesn't. + if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN) finish(); true }.focusable())) { + if (calm) { + Image(painterResource(moment.still), null, Modifier.fillMaxSize()) + if (!loop) LaunchedEffect(Unit) { delay(MOMENT_STILL_MS); finish() } + } else { + val player = remember { + ExoPlayer.Builder(context).build().apply { + setMediaItem(MediaItem.fromUri(RawResourceDataSource.buildRawResourceUri(moment.video))) + volume = 0f + repeatMode = if (loop) Player.REPEAT_MODE_ONE else Player.REPEAT_MODE_OFF + addListener(object : Player.Listener { + override fun onPlaybackStateChanged(state: Int) { if (state == Player.STATE_ENDED) finish() } + override fun onPlayerError(error: PlaybackException) { finish() } + }) + prepare(); playWhenReady = true + } + } + DisposableEffect(player) { onDispose { player.release() } } + AndroidView(modifier = Modifier.fillMaxSize(), factory = { overlaySurface(it, player) }) + } + caption?.let { Text(it, Modifier.align(Alignment.BottomCenter).padding(bottom = 56.dp), color = Ink, fontSize = 20.sp) } + } + if (!loop) LaunchedEffect(Unit) { runCatching { focus.requestFocus() } } +} diff --git a/android/app/src/main/java/tv/orbit/classic/Motion.kt b/android/app/src/main/java/tv/orbit/classic/Motion.kt new file mode 100644 index 00000000..db693e94 --- /dev/null +++ b/android/app/src/main/java/tv/orbit/classic/Motion.kt @@ -0,0 +1,189 @@ +package tv.orbit.classic + +import androidx.compose.animation.core.Animatable +import androidx.compose.animation.core.CubicBezierEasing +import androidx.compose.animation.core.tween +import androidx.compose.animation.animateColorAsState +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxScope +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.composed +import androidx.compose.ui.draw.drawBehind +import androidx.compose.ui.focus.onFocusChanged +import androidx.compose.ui.geometry.CornerRadius +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.Size +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.layout.LayoutCoordinates +import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.layout.onPlaced +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch + +/** + * Orbit motion (Paul, 6 November 2026, from the approved design/motion sheet): one set of timings for moving around the + * app. Only position and fade move, a press always acts at once, and Reduce motion turns everything into a short fade. + */ +internal object Motion { + /** Quick out, gentle landing: the one curve used everywhere. */ + val Ease = CubicBezierEasing(.2f, 0f, 0f, 1f) + const val FOCUS = 140 + const val SCREEN = 240 + const val BACK = 200 + const val CARD = 180 + const val STAGGER = 40 + const val STAGGERED = 6 + const val DIM = 160 + const val RISE = 200 + const val GUIDE = 220 + const val CALM = 120 + /** A guide press sooner than this after the last is a held button: no easing, full speed. */ + const val HELD_MS = 250L + + /** Settings › On screen › Reduce motion, kept here so every screen follows it as it changes. */ + var reduce by mutableStateOf(false) + + fun load(settings: OrbitSettings) { reduce = settings.reduceMotion } +} + +/** The order of the top bar, so a move to the right slides on from the right and Back slides the other way. */ +internal fun sectionDirection(from: String, to: String): Int { + val order = listOf("Home", "What's On", "TV Guide", "Catch Up", "Drive-In", "Arcade", "Connect Emby") + return if (order.indexOf(to) >= order.indexOf(from)) 1 else -1 +} + +/** A focus fill that eases in [Motion.FOCUS] instead of snapping. */ +@Composable +internal fun focusColor(target: Color) = + animateColorAsState(target, if (Motion.reduce) tween(0) else tween(Motion.FOCUS, easing = Motion.Ease), label = "focus").value + +/** + * A new screen slides on 24 dp from the side it came from and fades up; nothing waits for it, and the first screen + * Orbit opens on just appears. + */ +internal fun Modifier.arrive(key: Any, direction: Int, enabled: Boolean = true): Modifier = composed { + val shift = remember { Animatable(0f) } + var first by remember { mutableStateOf(true) } + var calm by remember { mutableStateOf(false) } + LaunchedEffect(key) { + if (first || !enabled) { first = false; shift.snapTo(0f); return@LaunchedEffect } + // Reduce motion: the same arrival as a short fade, with no slide. + calm = Motion.reduce + shift.snapTo(direction.toFloat()) + shift.animateTo(0f, if (calm) tween(Motion.CALM) else tween(if (direction > 0) Motion.SCREEN else Motion.BACK, easing = Motion.Ease)) + } + val distance = with(LocalDensity.current) { 24.dp.toPx() } + graphicsLayer { translationX = if (calm) 0f else shift.value * distance; alpha = 1f - kotlin.math.abs(shift.value) } +} + +/** Cards rise into place in turn, 40 ms apart, for the first six only; later ones are simply there. */ +internal fun Modifier.riseIn(index: Int): Modifier = composed { + val calm = remember { Motion.reduce } + val shown = remember { Animatable(if (index >= Motion.STAGGERED) 1f else 0f) } + LaunchedEffect(Unit) { + if (shown.value >= 1f) return@LaunchedEffect + if (calm) shown.animateTo(1f, tween(Motion.CALM)) + else { delay(index * Motion.STAGGER.toLong()); shown.animateTo(1f, tween(Motion.CARD, easing = Motion.Ease)) } + } + val lift = with(LocalDensity.current) { 14.dp.toPx() } + graphicsLayer { translationY = if (calm) 0f else (1f - shown.value) * lift; alpha = shown.value } +} + +/** A card over the picture: the screen behind dims in [Motion.DIM], then the card rises in [Motion.RISE]. */ +@Composable +internal fun OverlayCard(scrim: Color, content: @Composable BoxScope.() -> Unit) { + val calm = remember { Motion.reduce } + val dim = remember { Animatable(0f) } + val rise = remember { Animatable(0f) } + LaunchedEffect(Unit) { + launch { dim.animateTo(1f, tween(if (calm) Motion.CALM else Motion.DIM)) } + rise.animateTo(1f, if (calm) tween(Motion.CALM) else tween(Motion.RISE, easing = Motion.Ease)) + } + val lift = with(LocalDensity.current) { 16.dp.toPx() } + Box(Modifier.fillMaxSize().graphicsLayer { alpha = dim.value }.background(scrim)) + Box(Modifier.fillMaxSize().graphicsLayer { translationY = if (calm) 0f else (1f - rise.value) * lift; alpha = rise.value }, contentAlignment = Alignment.Center, content = content) +} + +/** + * The guide's channels ease under the focus by one row in [Motion.GUIDE]. A held button scrolls at full speed: a move + * sooner than [Motion.HELD_MS] after the last one snaps. + */ +internal fun Modifier.easeRows(firstRow: Int, rowHeight: Dp, lead: Int = 0): Modifier = composed { + val shift = remember { Animatable(0f) } + var last by remember { mutableIntStateOf(firstRow) } + var lastAt by remember { mutableLongStateOf(0L) } + LaunchedEffect(firstRow) { + val moved = firstRow - last + last = firstRow + val at = System.currentTimeMillis(); val held = at - lastAt < Motion.HELD_MS; lastAt = at + if (moved == 0 || Motion.reduce || held || kotlin.math.abs(moved) > 3) { shift.snapTo(0f); return@LaunchedEffect } + shift.snapTo(moved.toFloat()) + shift.animateTo(0f, tween(Motion.GUIDE, easing = Motion.Ease)) + } + val height = with(LocalDensity.current) { rowHeight.toPx() } + graphicsLayer { translationY = (shift.value - lead) * height } +} + +/** + * The gold that glides from one item to the next (Home's list, the top bar). The area draws one gold box behind its + * items and moves it to whichever item has focus; the items leave their own focused fill clear. + */ +internal class Glide(private val scope: CoroutineScope) { + private val x = Animatable(0f); private val y = Animatable(0f) + private val w = Animatable(0f); private val h = Animatable(0f) + internal var area: LayoutCoordinates? = null + internal var shown by mutableStateOf(false) + private var placed = false + private var target = Offset.Zero + private var targetSize = androidx.compose.ui.unit.IntSize.Zero + + fun moveTo(item: LayoutCoordinates) { + val parent = area?.takeIf { it.isAttached } ?: return + if (!item.isAttached) return + val at = parent.localPositionOf(item, Offset.Zero) + val size = item.size + if (placed && at == target && size == targetSize) return + target = at; targetSize = size + val jump = !placed || Motion.reduce + placed = true + scope.launch { + if (jump) { x.snapTo(at.x); y.snapTo(at.y); w.snapTo(size.width.toFloat()); h.snapTo(size.height.toFloat()); return@launch } + val spec = tween(Motion.FOCUS, easing = Motion.Ease) + launch { x.animateTo(at.x, spec) }; launch { y.animateTo(at.y, spec) } + launch { w.animateTo(size.width.toFloat(), spec) }; h.animateTo(size.height.toFloat(), spec) + } + } + + internal fun draw(scope: androidx.compose.ui.graphics.drawscope.DrawScope, color: Color, corner: Float) { + if (!shown || w.value <= 0f) return + scope.drawRoundRect(color, Offset(x.value, y.value), Size(w.value, h.value), CornerRadius(corner, corner)) + } +} + +@Composable +internal fun rememberGlide(): Glide { val scope = rememberCoroutineScope(); return remember { Glide(scope) } } + +internal val LocalGlide = staticCompositionLocalOf { null } + +/** The area the gold glides within: it draws the box behind its items, and only while one of them has focus. */ +internal fun Modifier.glideArea(glide: Glide, color: Color, corner: Dp): Modifier = composed { + val radius = with(LocalDensity.current) { corner.toPx() } + onPlaced { glide.area = it }.onFocusChanged { glide.shown = it.hasFocus }.drawBehind { glide.draw(this, color, radius) } +} + +/** An item the gold glides to when it takes focus. */ +internal fun Modifier.glideTarget(glide: Glide?): Modifier = if (glide == null) this else composed { + val holder = remember { arrayOfNulls(1) } + var focused by remember { mutableStateOf(false) } + onGloballyPositioned { holder[0] = it; if (focused) glide.moveTo(it) } + .onFocusChanged { focused = it.isFocused; if (it.isFocused) holder[0]?.let(glide::moveTo) } +} diff --git a/android/app/src/main/java/tv/orbit/classic/Onboarding.kt b/android/app/src/main/java/tv/orbit/classic/Onboarding.kt index 93083116..47469498 100644 --- a/android/app/src/main/java/tv/orbit/classic/Onboarding.kt +++ b/android/app/src/main/java/tv/orbit/classic/Onboarding.kt @@ -114,6 +114,8 @@ internal fun OnboardingScreen(signedIn: Boolean, onDone: (tour: Boolean) -> Unit val context = LocalContext.current // Multiroom: joining another room instead of setting up from scratch. var joining by remember { mutableStateOf(false) } + // The Welcome moment opens the flow (design/motion); the first step waits for it, so its focus lands after. + var opening by remember { mutableStateOf(step == OnboardStep.Welcome) } // A step back with Back, except from the first. BackHandler(step != OnboardStep.Welcome && step != OnboardStep.AllSet) { Onboarding.go(OnboardStep.entries[step.ordinal - 1].let { if (it == OnboardStep.SignIn && signedIn && !Onboarding.tour) OnboardStep.Server else it }) } Box(Modifier.fillMaxSize().then(if (step == OnboardStep.SignIn && !Onboarding.tour) Modifier else Modifier.background(Navy))) { @@ -121,7 +123,7 @@ internal fun OnboardingScreen(signedIn: Boolean, onDone: (tour: Boolean) -> Unit Steps(step, Modifier.align(Alignment.TopCenter).padding(top = 16.dp)) Box(Modifier.fillMaxSize().padding(top = 70.dp, bottom = 24.dp, start = 40.dp, end = 40.dp)) { when (step) { - OnboardStep.Welcome -> if (joining) JoinRoomFlow(onJoined = { joining = false; Onboarding.go(if (signedIn) OnboardStep.Channels else OnboardStep.SignIn) }, onBack = { joining = false }) + OnboardStep.Welcome -> if (opening) Unit else if (joining) JoinRoomFlow(onJoined = { joining = false; Onboarding.go(if (signedIn) OnboardStep.Channels else OnboardStep.SignIn) }, onBack = { joining = false }) else WelcomeStep(onJoin = if (Onboarding.tour) null else ({ joining = true })) { Onboarding.go(OnboardStep.Look) } OnboardStep.Look -> LookStep { Onboarding.go(OnboardStep.Server) } OnboardStep.Server -> ServerStep { Onboarding.go(OnboardStep.SignIn) } @@ -133,6 +135,7 @@ internal fun OnboardingScreen(signedIn: Boolean, onDone: (tour: Boolean) -> Unit } } if (Onboarding.tour) Text("A tour: nothing you choose here changes Orbit", Modifier.align(Alignment.BottomEnd).padding(16.dp), color = Color(0xFFFF7AC6), fontSize = 12.sp) + if (opening) MomentClip(Moment.Welcome) { opening = false } } } diff --git a/android/app/src/main/java/tv/orbit/classic/OrbitArcade.kt b/android/app/src/main/java/tv/orbit/classic/OrbitArcade.kt index 5cf3f4af..3316bb88 100644 --- a/android/app/src/main/java/tv/orbit/classic/OrbitArcade.kt +++ b/android/app/src/main/java/tv/orbit/classic/OrbitArcade.kt @@ -384,12 +384,15 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit) { var recent by remember { mutableStateOf(settings.recentGames.mapNotNull { name -> ArcadeGame.entries.firstOrNull { it.name == name } }) } var playing by remember { mutableStateOf(null) } var chosen by remember { mutableStateOf(ArcadeGame.OrbMan) } + // Each game opens with its host streaking in (design/motion), then the game itself. + var opening by remember { mutableStateOf(null) } fun play(game: ArcadeGame) { recent = (listOf(game) + recent.filter { it != game }).take(6) settings.recentGames = recent.map { it.name } - playing = game + if (Moment.forGame(game.name) != null) opening = game else playing = game } - DisposableEffect(playing) { onPlaying(playing != null); onDispose { onPlaying(false) } } + DisposableEffect(playing, opening) { onPlaying(playing != null || opening != null); onDispose { onPlaying(false) } } + opening?.let { game -> MomentClip(Moment.forGame(game.name)!!) { opening = null; playing = game }; return } when (playing) { ArcadeGame.OrbMan -> { OrbManScreen(orbBest, onBest = { orbBest = it; settings.orbManBest = it }, onLeave = { playing = null }); return } ArcadeGame.Snake -> { SnakeScreen(best, onBest = { best = it; settings.snakeBest = it }, onLeave = { playing = null }); return } @@ -490,7 +493,7 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit) { // Tall enough for the name and its line in full (Paul, 5 November 2026: the line was clipped at 48). Row(Modifier.fillMaxWidth().height(56.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) { pair.forEachIndexed { i, game -> - GameCard(game, Modifier.weight(1f).fillMaxHeight(), if (row == 0 && i == 0) first else null, if (row == 0) nav else null, { chosen = game }, { play(game) }) + GameCard(game, Modifier.weight(1f).fillMaxHeight().riseIn(row * 2 + i), if (row == 0 && i == 0) first else null, if (row == 0) nav else null, { chosen = game }, { play(game) }) } if (pair.size == 1) Spacer(Modifier.weight(1f)) } diff --git a/android/app/src/main/java/tv/orbit/classic/Profiles.kt b/android/app/src/main/java/tv/orbit/classic/Profiles.kt index b0afcafc..a7bd42a8 100644 --- a/android/app/src/main/java/tv/orbit/classic/Profiles.kt +++ b/android/app/src/main/java/tv/orbit/classic/Profiles.kt @@ -174,7 +174,7 @@ internal fun WhosWatching(onClose: () -> Unit) { // Kids first, so a child's OK goes straight to their own. Profiles.all.sortedBy { if (it.kind == ProfileKind.Kids) 0 else 1 }.forEachIndexed { i, p -> var focused by remember { mutableStateOf(false) } - Column(Modifier.then(if (i == 0) Modifier.focusRequester(first) else Modifier).onFocusChanged { focused = it.isFocused } + Column(Modifier.riseIn(i).then(if (i == 0) Modifier.focusRequester(first) else Modifier).onFocusChanged { focused = it.isFocused } // No grey focus box behind the picture (Paul, 6 November 2026): the gold ring and name say it's chosen. .clickable(remember { androidx.compose.foundation.interaction.MutableInteractionSource() }, indication = null) { choose(p) }, horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) { diff --git a/android/app/src/main/java/tv/orbit/classic/RoomUpdates.kt b/android/app/src/main/java/tv/orbit/classic/RoomUpdates.kt index b5780a0f..bc3c77dc 100644 --- a/android/app/src/main/java/tv/orbit/classic/RoomUpdates.kt +++ b/android/app/src/main/java/tv/orbit/classic/RoomUpdates.kt @@ -192,7 +192,7 @@ internal fun RoomUpdateCard() { val first = remember { FocusRequester() } LaunchedEffect(offer) { runCatching { first.requestFocus() } } BackHandler { RoomUpdates.notNow() } - Box(Modifier.fillMaxSize().background(Navy.copy(alpha = .55f)), contentAlignment = Alignment.Center) { + OverlayCard(Navy.copy(alpha = .55f)) { Column(Modifier.width(560.dp).background(Panel, RoundedCornerShape(14.dp)).padding(22.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) { Text("Orbit ${shortVersion(offer.name)} is ready", color = Ink, fontFamily = Anton, fontSize = 26.sp) Text("${offer.room} has a newer Orbit. Install it on this TV? Your channels, schedules and settings stay as they are.", color = Muted, fontSize = 14.sp) diff --git a/android/app/src/main/java/tv/orbit/classic/RoomsUi.kt b/android/app/src/main/java/tv/orbit/classic/RoomsUi.kt index 022cc222..0a2758ac 100644 --- a/android/app/src/main/java/tv/orbit/classic/RoomsUi.kt +++ b/android/app/src/main/java/tv/orbit/classic/RoomsUi.kt @@ -122,10 +122,10 @@ internal fun RoomKnockOverlay() { } } BackHandler { if (asking) asking = false else { offer.refuse(); PhoneLink.offerRoom(null) } } - Box(Modifier.fillMaxSize().background(Navy.copy(alpha = .55f)), contentAlignment = Alignment.Center) { + OverlayCard(Navy.copy(alpha = .55f)) { if (asking) { PinEntry("Enter the Adult PIN to allow it", problem, onDone = { pin -> if (AfterDarkLock.check(context, pin)) { asking = false; offer.allow() } else problem = "That PIN didn't match." - }, onCancel = { asking = false }); return@Box } + }, onCancel = { asking = false }); return@OverlayCard } val first = remember { FocusRequester() } Column(Modifier.width(560.dp).background(Panel, RoundedCornerShape(14.dp)).padding(22.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) { Text("${offer.joining ?: "A new TV"} wants to join", color = Ink, fontFamily = Anton, fontSize = 26.sp) @@ -261,12 +261,15 @@ internal fun JoinRoomFlow(onJoined: () -> Unit, onBack: () -> Unit, var code by remember { mutableStateOf("") } var note by remember { mutableStateOf(null) } var join by remember { mutableStateOf(null) } + // Rooms linked (design/motion): the moment plays once the copy has landed, then Orbit carries on. + var linked by remember { mutableStateOf(false) } var copy by remember { mutableStateOf(preview?.second) } var parts by remember { mutableStateOf(RoomPart.entries.toSet()) } var sameSchedules by remember { mutableStateOf(true) } var name by remember { mutableStateOf("Bedroom") } var working by remember { mutableStateOf(false) } val first = remember { FocusRequester() } + if (linked) { MomentClip(Moment.Linked, caption = "$name is set up from ${roomName ?: "your other room"}") { onJoined() }; return } LaunchedEffect(phase) { runCatching { first.requestFocus() } } // Auto-scan: asks the chosen TV to show its code, wherever it is in Orbit. fun knock() { @@ -361,7 +364,7 @@ internal fun JoinRoomFlow(onJoined: () -> Unit, onBack: () -> Unit, RoomBundle.applyNow(context, got, parts) RoomArrival.keep(got, parts, sameSchedules && RoomPart.Channels in parts) android.util.Log.i("OrbitRooms", "joined parts=${parts.size}") - onJoined() + linked = true } } } 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 d9602cf0..c0446ae3 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.57") + next.setRequestProperty("User-Agent", "OrbitTV/0.108.58") 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/Settings.kt b/android/app/src/main/java/tv/orbit/classic/Settings.kt index 4e410121..e4b0ac32 100644 --- a/android/app/src/main/java/tv/orbit/classic/Settings.kt +++ b/android/app/src/main/java/tv/orbit/classic/Settings.kt @@ -112,11 +112,11 @@ internal class OrbitSettings(context: Context) { var castOn: Boolean get() = saved.getBoolean("cast_on", true) set(value) { saved.edit().putBoolean("cast_on", value).apply() } - /** Turns off moving presentation such as the Drive-In's curtains. More screens will follow it as they gain motion. */ /** The chosen look ([OrbitLook]); Orbit Night until one is chosen. */ var look: OrbitLook get() = saved.getString("look", null)?.let { name -> OrbitLook.entries.firstOrNull { it.name == name } } ?: OrbitLook.Night set(value) { saved.edit().putString("look", value.name).apply() } + /** Turns off moving presentation: the Drive-In's curtains, and every slide and rise becomes a short fade (design/motion). */ var reduceMotion: Boolean get() = saved.getBoolean("reduce_motion", false) set(value) { saved.edit().putBoolean("reduce_motion", value).apply() } @@ -289,7 +289,7 @@ private fun ViewingDetail(firstSwitch: FocusRequester, modifier: Modifier, top: } Heading("Comfort") SettingLine("Reduce motion", "Leave out moving presentation, such as the Drive-In's curtains.") { - OnOff(reduceMotion, Modifier, onClick = { reduceMotion = !reduceMotion; settings.reduceMotion = reduceMotion }) + OnOff(reduceMotion, Modifier, onClick = { reduceMotion = !reduceMotion; settings.reduceMotion = reduceMotion; Motion.reduce = reduceMotion }) } } diff --git a/android/app/src/main/java/tv/orbit/classic/SleepTimer.kt b/android/app/src/main/java/tv/orbit/classic/SleepTimer.kt index 41088cda..1d81a29c 100644 --- a/android/app/src/main/java/tv/orbit/classic/SleepTimer.kt +++ b/android/app/src/main/java/tv/orbit/classic/SleepTimer.kt @@ -81,7 +81,7 @@ internal fun sleepLeft(endsAt: Long?, nowMs: Long): String? = endsAt?.let { ((it @Composable internal fun SleepWarning(modifier: Modifier = Modifier) { val corner = RoundedCornerShape(10.dp) - Column(modifier.width(400.dp).background(Navy.copy(alpha = .96f), corner).border(2.dp, Yellow, corner).padding(horizontal = 22.dp, vertical = 16.dp), + Column(modifier.riseIn(0).width(400.dp).background(Navy.copy(alpha = .96f), corner).border(2.dp, Yellow, corner).padding(horizontal = 22.dp, vertical = 16.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) { Text("SLEEP TIMER", color = Yellow, fontFamily = Anton, fontSize = 18.sp) Text("Orbit switches off in 1 minute", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold) diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_blast_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_blast_still.webp new file mode 100644 index 00000000..a6af5608 Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_blast_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_blocks_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_blocks_still.webp new file mode 100644 index 00000000..1460434a Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_blocks_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_bricks_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_bricks_still.webp new file mode 100644 index 00000000..45441f34 Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_bricks_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_hive_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_hive_still.webp new file mode 100644 index 00000000..e326d239 Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_hive_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_orbman_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_orbman_still.webp new file mode 100644 index 00000000..1d009712 Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_orbman_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_pairs_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_pairs_still.webp new file mode 100644 index 00000000..ce6e89ed Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_pairs_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_patience_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_patience_still.webp new file mode 100644 index 00000000..2966240c Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_patience_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_sky_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_sky_still.webp new file mode 100644 index 00000000..ec41fc82 Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_sky_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_arcade_snake_still.webp b/android/app/src/main/res/drawable-nodpi/moment_arcade_snake_still.webp new file mode 100644 index 00000000..378a485f Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_arcade_snake_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_linked_still.webp b/android/app/src/main/res/drawable-nodpi/moment_linked_still.webp new file mode 100644 index 00000000..061a4bd1 Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_linked_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_tuning_still.webp b/android/app/src/main/res/drawable-nodpi/moment_tuning_still.webp new file mode 100644 index 00000000..ab3571ab Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_tuning_still.webp differ diff --git a/android/app/src/main/res/drawable-nodpi/moment_welcome_still.webp b/android/app/src/main/res/drawable-nodpi/moment_welcome_still.webp new file mode 100644 index 00000000..f0b17c8b Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/moment_welcome_still.webp differ diff --git a/android/app/src/main/res/raw/moment_arcade_blast.mp4 b/android/app/src/main/res/raw/moment_arcade_blast.mp4 new file mode 100644 index 00000000..920566a6 Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_blast.mp4 differ diff --git a/android/app/src/main/res/raw/moment_arcade_blocks.mp4 b/android/app/src/main/res/raw/moment_arcade_blocks.mp4 new file mode 100644 index 00000000..a6f4cb10 Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_blocks.mp4 differ diff --git a/android/app/src/main/res/raw/moment_arcade_bricks.mp4 b/android/app/src/main/res/raw/moment_arcade_bricks.mp4 new file mode 100644 index 00000000..f0bb2f3a Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_bricks.mp4 differ diff --git a/android/app/src/main/res/raw/moment_arcade_hive.mp4 b/android/app/src/main/res/raw/moment_arcade_hive.mp4 new file mode 100644 index 00000000..6cb9f2b3 Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_hive.mp4 differ diff --git a/android/app/src/main/res/raw/moment_arcade_orbman.mp4 b/android/app/src/main/res/raw/moment_arcade_orbman.mp4 new file mode 100644 index 00000000..7a6b5221 Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_orbman.mp4 differ diff --git a/android/app/src/main/res/raw/moment_arcade_pairs.mp4 b/android/app/src/main/res/raw/moment_arcade_pairs.mp4 new file mode 100644 index 00000000..18dd7cb1 Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_pairs.mp4 differ diff --git a/android/app/src/main/res/raw/moment_arcade_patience.mp4 b/android/app/src/main/res/raw/moment_arcade_patience.mp4 new file mode 100644 index 00000000..80eda713 Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_patience.mp4 differ diff --git a/android/app/src/main/res/raw/moment_arcade_sky.mp4 b/android/app/src/main/res/raw/moment_arcade_sky.mp4 new file mode 100644 index 00000000..a517495f Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_sky.mp4 differ diff --git a/android/app/src/main/res/raw/moment_arcade_snake.mp4 b/android/app/src/main/res/raw/moment_arcade_snake.mp4 new file mode 100644 index 00000000..ec4c27f9 Binary files /dev/null and b/android/app/src/main/res/raw/moment_arcade_snake.mp4 differ diff --git a/android/app/src/main/res/raw/moment_linked.mp4 b/android/app/src/main/res/raw/moment_linked.mp4 new file mode 100644 index 00000000..accf7023 Binary files /dev/null and b/android/app/src/main/res/raw/moment_linked.mp4 differ diff --git a/android/app/src/main/res/raw/moment_tuning.mp4 b/android/app/src/main/res/raw/moment_tuning.mp4 new file mode 100644 index 00000000..c12fdc95 Binary files /dev/null and b/android/app/src/main/res/raw/moment_tuning.mp4 differ diff --git a/android/app/src/main/res/raw/moment_welcome.mp4 b/android/app/src/main/res/raw/moment_welcome.mp4 new file mode 100644 index 00000000..8e1b8c9a Binary files /dev/null and b/android/app/src/main/res/raw/moment_welcome.mp4 differ diff --git a/android/app/src/test/java/tv/orbit/classic/MotionTest.kt b/android/app/src/test/java/tv/orbit/classic/MotionTest.kt new file mode 100644 index 00000000..0c686a2d --- /dev/null +++ b/android/app/src/test/java/tv/orbit/classic/MotionTest.kt @@ -0,0 +1,24 @@ +package tv.orbit.classic + +import org.junit.Assert.* +import org.junit.Test + +/** Orbit motion (Paul, 6 November 2026, design/motion): one set of timings, and a moment for every Arcade game. */ +class MotionTest { + @Test fun screensSlideFromTheSideTheyLieOnAlongTheBar() { + assertEquals(1, sectionDirection("Home", "TV Guide")) + assertEquals(-1, sectionDirection("Arcade", "Home")) + assertEquals(1, sectionDirection("Home", "Connect Emby")) + } + + @Test fun everyArcadeGameHasItsOpening() { + for (game in listOf("OrbMan", "Blast", "Sky", "Hive", "Snake", "Blocks", "Bricks", "Pairs", "Patience")) assertNotNull(game, Moment.forGame(game)) + assertNull(Moment.forGame("Welcome".lowercase())) + } + + @Test fun theTimingsMatchTheSheet() { + assertEquals(140, Motion.FOCUS); assertEquals(240, Motion.SCREEN); assertEquals(200, Motion.BACK) + assertEquals(180, Motion.CARD); assertEquals(40, Motion.STAGGER); assertEquals(220, Motion.GUIDE); assertEquals(120, Motion.CALM) + assertTrue(Motion.BACK < Motion.SCREEN) + } +}