diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 20627e73..e450484e 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 = 306 - versionName = "0.116.0-orbiteroids" + versionCode = 307 + versionName = "0.116.1-orbiteroids" } 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/arcade/ArcadeHome.kt b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeHome.kt index e595de5d..751e2061 100644 --- a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeHome.kt +++ b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeHome.kt @@ -372,7 +372,7 @@ private fun GameSettingsSheet(game: ArcadeGame, record: GameRecord, legacy: (Str LaunchedEffect(Unit) { runCatching { first.requestFocus() } } androidx.activity.compose.BackHandler(onBack = onClose) ArcadeScrim { - Column(Modifier.width(300.dp).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp), + Column(Modifier.width(380.dp).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { Text("${game.title.uppercase()} SETTINGS", color = ArcadeColours.Ink, fontFamily = Anton, fontSize = 22.sp) Text("Saved for whoever's playing, on this TV.", color = ArcadeColours.Muted, fontSize = 12.sp) diff --git a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeShared.kt b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeShared.kt index 9435b027..13fb15a6 100644 --- a/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeShared.kt +++ b/android/app/src/main/java/tv/orbit/classic/arcade/ArcadeShared.kt @@ -77,9 +77,11 @@ internal fun ArcadeButton(label: String, modifier: Modifier = Modifier, icon: St Row(modifier.height(height).onFocusChanged { focused = it.isFocused }.background(fill, corner).border(if (focused) 3.dp else 1.dp, edge, corner) .clickable(enabled = enabled, onClick = onClick).padding(horizontal = 12.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { if (icon != null) Text(icon, color = if (danger) ArcadeColours.Red else ArcadeColours.Ink, fontSize = 14.sp, fontWeight = FontWeight.Bold) - Text(label, Modifier.weight(1f, fill = false), color = if (enabled) (if (danger && !focused) Color(0xFFFFC2C2) else ArcadeColours.Ink) else ArcadeColours.Muted, + // With a detail on the right, the label takes all the room left over (Paul, 9 November 2026: "Sound" read "S…" + // because a spacer shared that room with it, so the label only ever had half). + Text(label, Modifier.weight(1f, fill = detail != null), color = if (enabled) (if (danger && !focused) Color(0xFFFFC2C2) else ArcadeColours.Ink) else ArcadeColours.Muted, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis) - if (detail != null) { Spacer(Modifier.weight(1f)); Text(detail, color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1) } + if (detail != null) Text(detail, color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1) } } @@ -109,7 +111,7 @@ internal fun ArcadePauseMenu(game: ArcadeGame, line: String, onResume: () -> Uni BackHandler(onBack = onResume) ArcadeScrim { // Back caught here as well: on the TV a focused button would otherwise spend it moving focus (menus go up one level). - Column(Modifier.width(210.dp).onBackKey(action = onResume).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp), + Column(Modifier.width(250.dp).onBackKey(action = onResume).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) { Text("PAUSED", color = ArcadeColours.Ink, fontFamily = Anton, fontSize = 30.sp) Text(line, color = ArcadeColours.Muted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) diff --git a/android/app/src/main/java/tv/orbit/classic/arcade/hive/HiveSim.kt b/android/app/src/main/java/tv/orbit/classic/arcade/hive/HiveSim.kt index d507fd0f..9552c7c5 100644 --- a/android/app/src/main/java/tv/orbit/classic/arcade/hive/HiveSim.kt +++ b/android/app/src/main/java/tv/orbit/classic/arcade/hive/HiveSim.kt @@ -427,12 +427,14 @@ internal class HiveSim(val save: HiveSaveData, private val host: HiveHost, seed: private fun titleButtons(): List { val list = ArrayList(5) - list.add(HiveButton("PLAY", 520.0, 330.0, 240.0, 64.0, HiveAct.Play)) - // Hard mode (Paul, 8 November 2026): chosen here, beside Play; each mode keeps its own levels. - list.add(HiveButton("MODE: " + mode.title.uppercase(), 790.0, 330.0, 240.0, 64.0, HiveAct.Mode)) - list.add(HiveButton("LEVELS", 520.0, 410.0, 240.0, 64.0, HiveAct.Levels)) - list.add(HiveButton("HELP & SETTINGS", 520.0, 490.0, 240.0, 64.0, HiveAct.Help)) - if (save.lastSpin != host.today()) list.add(HiveButton("DAILY BONUS", 520.0, 570.0, 240.0, 64.0, HiveAct.Daily, glow = true)) + // One stack, top to bottom (Paul, 9 November 2026: the Mode button sat off to the right of Play): Play, Mode, Levels, + // Help & Settings and the Daily Bonus, all the same size, so ▲▼ walks straight down them. + list.add(HiveButton("PLAY", 520.0, 330.0, 240.0, 56.0, HiveAct.Play)) + // Hard mode (Paul, 8 November 2026): each mode keeps its own levels. + list.add(HiveButton("MODE: " + mode.title.uppercase(), 520.0, 394.0, 240.0, 56.0, HiveAct.Mode)) + list.add(HiveButton("LEVELS", 520.0, 458.0, 240.0, 56.0, HiveAct.Levels)) + list.add(HiveButton("HELP & SETTINGS", 520.0, 522.0, 240.0, 56.0, HiveAct.Help)) + if (save.lastSpin != host.today()) list.add(HiveButton("DAILY BONUS", 520.0, 586.0, 240.0, 56.0, HiveAct.Daily, glow = true)) return list } diff --git a/android/app/src/test/java/tv/orbit/classic/arcade/TitleTextFitsTest.kt b/android/app/src/test/java/tv/orbit/classic/arcade/TitleTextFitsTest.kt index 374b4d06..a2857079 100644 --- a/android/app/src/test/java/tv/orbit/classic/arcade/TitleTextFitsTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/arcade/TitleTextFitsTest.kt @@ -142,4 +142,26 @@ class TitleTextFitsTest { val body = Font(Font.SANS_SERIF, Font.PLAIN, 1).deriveFont(14f * 1.3f) for (n in 2..8) assertTrue("sector $n", width(body, tv.orbit.classic.arcade.orbiteroids.sectorTeaser(n)) <= 3 * (380 - 40)) } + + @Test fun thePauseMenusSoundLineFitsWithItsValue() { + // The pause menu is 250 dp less 2 × 16 padding; the button 12 dp each side, the ♪, 8 dp gaps, then "Sound" and its value. + val label = Font(Font.SANS_SERIF, Font.BOLD, 1).deriveFont(14f * 1.3f) + val detail = Font(Font.SANS_SERIF, Font.PLAIN, 1).deriveFont(12f * 1.3f) + val room = 250.0 - 32 - 24 - 4 + for (value in listOf("On", "Off", "Effects on", "Effects off", "Music on", "Music off")) + assertTrue("Sound · $value", width(label, "♪") + 8 + width(label, "Sound") + 8 + width(detail, value) <= room) + } + + @Test fun everyGamesSettingsAndHowToPlayFit() { + val label = Font(Font.SANS_SERIF, Font.BOLD, 1).deriveFont(14f * 1.3f) + val detail = Font(Font.SANS_SERIF, Font.PLAIN, 1).deriveFont(12f * 1.3f) + // A game's settings sheet (Menu on its card): 380 dp less 2 × 16 padding, 2 × 12 inside the button, a gap and "Off". + val room = 380.0 - 32 - 24 - 4 + for (g in ArcadeGames.all) for (t in g.settings.map { it.title } + "Show How to Play every time") + assertTrue("${g.title}: $t", width(label, t) + 8 + width(detail, "Off") <= room) + // How to Play's heading for every game, in Anton at 28 sp, in the card's text column. + val anton = Font.createFont(Font.TRUETYPE_FONT, File("src/main/res/font/anton_regular.ttf")).deriveFont(28f) + val column = 960.0 - 2 * 52 - 2 * 24 - 76 - 2 * 28 - 110 + for (g in ArcadeGames.all) assertTrue(g.title, width(anton, "HOW TO PLAY ${g.title.uppercase()}") <= column) + } } diff --git a/android/app/src/test/java/tv/orbit/classic/arcade/hive/HiveSimTest.kt b/android/app/src/test/java/tv/orbit/classic/arcade/hive/HiveSimTest.kt index 55a8e8f0..a3494409 100644 --- a/android/app/src/test/java/tv/orbit/classic/arcade/hive/HiveSimTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/arcade/hive/HiveSimTest.kt @@ -363,4 +363,16 @@ class HiveSimTest { // Aiming and firing: four sin/cos calls (guide line and shot), each at most the JVM's small reduction arrays (none on Android). assertTrue("a shot allocated ${shotBytes / shots} bytes", shotBytes / shots <= 256) } + + @Test fun theTitlesButtonsAreOneStackWalkedTopToBottom() { + // Paul, 9 November 2026: the Mode button sat off to the right of Play. Now one column, the same size, in order. + val host = object : HiveHost { override fun today() = "2026-11-09" } + val s = HiveSim(HiveSaveData(), host, seed = 1) + val b = s.buttons + assertEquals(listOf(HiveAct.Play, HiveAct.Mode, HiveAct.Levels, HiveAct.Help, HiveAct.Daily), b.map { it.act }) + assertTrue(b.all { it.x == b[0].x && it.w == b[0].w && it.h == b[0].h }) + assertTrue(b.zipWithNext().all { (a, c) -> c.y > a.y + a.h }) + // Inside the TV-safe area, clear of the info line at 672. + assertTrue(b.last().y + b.last().h < 660) + } }