Modern Apps git

← Modern-Apps.git

voxels: make the elytra hint name the Jump button (#ux-audit)

Commit
88cec4b32f7bfe65e650e1809e5b48c67444c52e
Author
Vayun Mathur <[email protected]>
When
2026-11-13 01:47 UTC (23 days ago)
Parents
f25d765
Symptom: with an elytra equipped the HUD said "Tap ▲ mid-air to
glide", but no on-screen control shows a ▲ - the button is labelled
"Jump" (or "Up" while flying) - so players didn't know what to press.
Once gliding, nothing said how to stop.

Root cause: stale copy in ui/Hotbar.kt GlideIndicator from an older
HUD.

Fix: the chip reads "Tap Jump in mid-air to glide" and, while gliding,
"Gliding - tap Jump to fold wings" (a mid-air Jump tap toggles
glide_armed in player.rs). Both strings take the Jump button's own
label resource, so translations stay consistent with the button.

User-visible effect: the hint matches the control.

Verification: new Compose test GlideIndicatorTest checks the hint text.

Diff

games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/GlideIndicator.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/GlideIndicator.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/GlideIndicator.ktindex bcc5025459..01151e2517 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/GlideIndicator.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/GlideIndicator.kt@@ -14,13 +14,15 @@ import com.vayunmathur.games.voxels.R import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text -// Small chip shown while an elytra is equipped: prompts to deploy, or confirms gliding.+// Small chip shown while an elytra is equipped: prompts to deploy, or confirms gliding. It names the+// on-screen Jump button (a mid-air Jump tap toggles the wings, player.rs glide_armed); it used to+// say "Tap ▲", a symbol no control shows. @Composable fun GlideIndicator(healthJson: String, modifier: Modifier = Modifier) {     val hj = remember(healthJson) { parseHealth(healthJson) }     if (!hj.elytra) return     val (label, tint) = if (hj.gliding) R.string.glide_active to Color(0xFF7CE0FF) else R.string.glide_hint to Color.White.copy(0.75f)     Box(modifier.background(Color.Black.copy(0.45f), RoundedCornerShape(6.dp)).padding(horizontal = 8.dp, vertical = 4.dp)) {-        Text(stringResource(label), color = tint, style = MaterialTheme.typography.labelMedium)+        Text(stringResource(label, stringResource(R.string.jump)), color = tint, style = MaterialTheme.typography.labelMedium)     } }
games/voxels/src/main/res/values/strings.xml
diff --git a/games/voxels/src/main/res/values/strings.xml b/games/voxels/src/main/res/values/strings.xmlindex 5ccc6e43fe..6cf4fa5a2f 100644--- a/games/voxels/src/main/res/values/strings.xml+++ b/games/voxels/src/main/res/values/strings.xml@@ -138,10 +138,10 @@     <string name="up">Up</string>     <string name="sneak">Sneak</string>     <string name="sneaking">Sneaking</string>-    <!-- Elytra chip: gliding now. Fragment -->-    <string name="glide_active">Gliding</string>-    <!-- Elytra chip: how to start gliding. Instruction -->-    <string name="glide_hint">Tap ▲ mid-air to glide</string>+    <!-- Elytra chip while gliding; %1$s = the Jump button's label. Fragment -->+    <string name="glide_active">Gliding — tap %1$s to fold wings</string>+    <!-- Elytra chip: how to start gliding; %1$s = the Jump button's label. Instruction -->+    <string name="glide_hint">Tap %1$s in mid-air to glide</string>     <!-- Boss bar names. Nouns -->     <string name="boss_dragon">Ender Dragon</string>     <string name="boss_wither">The Wither</string>
games/voxels/src/test/java/com/vayunmathur/games/voxels/ui/GlideIndicatorTest.kt
diff --git a/games/voxels/src/test/java/com/vayunmathur/games/voxels/ui/GlideIndicatorTest.kt b/games/voxels/src/test/java/com/vayunmathur/games/voxels/ui/GlideIndicatorTest.ktnew file mode 100644index 0000000000..a50e6ada78--- /dev/null+++ b/games/voxels/src/test/java/com/vayunmathur/games/voxels/ui/GlideIndicatorTest.kt@@ -0,0 +1,19 @@+package com.vayunmathur.games.voxels.ui++import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onNodeWithText+import org.junit.Rule+import org.junit.runner.RunWith+import org.robolectric.RobolectricTestRunner+import kotlin.test.Test++@RunWith(RobolectricTestRunner::class)+class GlideIndicatorTest {+    @get:Rule val rule = createComposeRule()++    // The hint must name the button players actually see.+    @Test fun `the elytra hint names the Jump button`() {+        rule.setContent { GlideIndicator(healthJson = """{"elytra":true,"gliding":false}""") }+        rule.onNodeWithText("Tap Jump in mid-air to glide").assertExists()+    }+}