Modern Apps git

← Modern-Apps.git

nonogram: make the how-to-play hint follow the mark mode (#ux-audit)

Commit
a41f522376c20176863fd3eb5289a7cb31855b93
Author
Vayun Mathur <[email protected]>
When
2026-11-13 01:29 UTC (23 days ago)
Parents
8c9f4b0
Symptom: the hint under a fresh board always said "Tap to fill, long
press to cross out", even in Cross mode, where a tap crosses and a long
press fills - the hint described the opposite of what the gestures do.

Root cause: NonogramControls showed one fixed string (how_to_play)
regardless of the selected MarkMode.

Fix: two strings chosen from the current mode -
how_to_play_fill "Tap or drag to fill, long press to cross out" and
how_to_play_cross "Tap or drag to cross out, long press to fill". Both
also mention drag now that drag-to-fill exists. The old how_to_play is
removed; the Polish translation is replaced with both variants.

User-visible effect: switching Fill/Cross immediately updates the hint
to match what a tap and a long press will do.

Verification: new Compose test flips the mode and asserts the hint
text changes; existing phone and expanded tests use the Fill variant.

Diff

games/nonogram/src/main/java/com/vayunmathur/games/nonogram/ui/NonogramGameScreen.kt
diff --git a/games/nonogram/src/main/java/com/vayunmathur/games/nonogram/ui/NonogramGameScreen.kt b/games/nonogram/src/main/java/com/vayunmathur/games/nonogram/ui/NonogramGameScreen.ktindex 4760dbd5c3..9eb119294a 100644--- a/games/nonogram/src/main/java/com/vayunmathur/games/nonogram/ui/NonogramGameScreen.kt+++ b/games/nonogram/src/main/java/com/vayunmathur/games/nonogram/ui/NonogramGameScreen.kt@@ -298,7 +298,11 @@ private fun NonogramControls(                 game.revealedBlanks.isEmpty()             ) {                 Text(-                    stringResource(R.string.how_to_play),+                    // Follows the toggle: in Cross mode a tap crosses and a long press fills.+                    stringResource(+                        if (state.markMode == MarkMode.CROSS) R.string.how_to_play_cross+                        else R.string.how_to_play_fill+                    ),                     style = MaterialTheme.typography.bodySmall,                     color = MaterialTheme.colorScheme.onSurfaceVariant,                     textAlign = TextAlign.Center,
games/nonogram/src/main/res/values-pl/strings.xml
diff --git a/games/nonogram/src/main/res/values-pl/strings.xml b/games/nonogram/src/main/res/values-pl/strings.xmlindex 0607856b33..27998f145c 100644--- a/games/nonogram/src/main/res/values-pl/strings.xml+++ b/games/nonogram/src/main/res/values-pl/strings.xml@@ -18,7 +18,8 @@     <string name="solved">Rozwiązano!</string>     <!-- NonogramGameScreen: Shown after clearing the daily, since there is only one per day. Sentence -->     <!-- NonogramGameScreen: Hint under a fresh board explaining the two gestures. Imperative sentence -->-    <string name="how_to_play">Stuknij, aby zamalować; przytrzymaj, aby wykreślić</string>+    <string name="how_to_play_fill">Stuknij lub przeciągnij, aby zamalować; przytrzymaj, aby wykreślić</string>+    <string name="how_to_play_cross">Stuknij lub przeciągnij, aby wykreślić; przytrzymaj, aby zamalować</string>     <!-- MarkModeToggle: Tap places part of the picture. Verb, imperative -->     <string name="mode_fill">Zamaluj</string>     <!-- MarkModeToggle: Tap crosses a cell off as empty. Verb, imperative -->
games/nonogram/src/main/res/values/strings.xml
diff --git a/games/nonogram/src/main/res/values/strings.xml b/games/nonogram/src/main/res/values/strings.xmlindex 154a6e7355..3a03271466 100644--- a/games/nonogram/src/main/res/values/strings.xml+++ b/games/nonogram/src/main/res/values/strings.xml@@ -19,8 +19,10 @@     <!-- NonogramGameScreen: Celebratory line shown when a level is completed. Declarative -->     <string name="solved">Solved!</string>     <!-- NonogramGameScreen: Shown after clearing the daily, since there is only one per day. Sentence -->-    <!-- NonogramGameScreen: Hint under a fresh board explaining the two gestures. Imperative sentence -->-    <string name="how_to_play">Tap to fill, long press to cross out</string>+    <!-- NonogramGameScreen: Hint under a fresh board in Fill mode, explaining the gestures. Imperative sentence -->+    <string name="how_to_play_fill">Tap or drag to fill, long press to cross out</string>+    <!-- NonogramGameScreen: Hint under a fresh board in Cross mode, explaining the gestures. Imperative sentence -->+    <string name="how_to_play_cross">Tap or drag to cross out, long press to fill</string>     <!-- MarkModeToggle: Tap places part of the picture. Verb, imperative -->     <string name="mode_fill">Fill</string>     <!-- MarkModeToggle: Tap crosses a cell off as empty. Verb, imperative -->
games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramExpandedScreenTest.kt
diff --git a/games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramExpandedScreenTest.kt b/games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramExpandedScreenTest.ktindex 4c04159661..3fa8184834 100644--- a/games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramExpandedScreenTest.kt+++ b/games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramExpandedScreenTest.kt@@ -34,7 +34,7 @@ class NonogramExpandedScreenTest {         rule.setContent {             NonogramGameScreen(NonogramUiState(game = game, level = 2, markMode = MarkMode.FILL), a, {}, {})         }-        rule.onNodeWithText(str(R.string.how_to_play)).assertExists()+        rule.onNodeWithText(str(R.string.how_to_play_fill)).assertExists()         rule.onNodeWithText(str(R.string.mode_cross)).performSemanticsAction(SemanticsActions.OnClick)         assertEquals(listOf(MarkMode.CROSS), a.modes)     }
games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramScreensTest.kt
diff --git a/games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramScreensTest.kt b/games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramScreensTest.ktindex 459fa0cf43..7f22b0ec80 100644--- a/games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramScreensTest.kt+++ b/games/nonogram/src/test/java/com/vayunmathur/games/nonogram/ui/NonogramScreensTest.kt@@ -125,7 +125,7 @@ class NonogramScreensTest {     @Test fun inProgressShowsHintToggleAndRestartWithoutConfirm() {         val a = Recording()         rule.setContent { NonogramGameScreen(NonogramUiState(game = game(), mode = GameMode.CASUAL, markMode = MarkMode.FILL, level = 2), a, {}, {}) }-        rule.onNodeWithText(str(R.string.how_to_play)).assertExists()+        rule.onNodeWithText(str(R.string.how_to_play_fill)).assertExists()         rule.onNodeWithText(str(R.string.mode_cross)).performSemanticsAction(SemanticsActions.OnClick)         assertEquals(listOf(MarkMode.CROSS), a.modes)         rule.onNodeWithText(str(UiR.string.restart)).performSemanticsAction(SemanticsActions.OnClick)@@ -168,6 +168,15 @@ class NonogramScreensTest {         assertEquals(listOf<Any>(14, false), a.strokes.last())     } +    @Test fun hintFollowsTheMarkMode() {+        var mode by androidx.compose.runtime.mutableStateOf(MarkMode.FILL)+        rule.setContent { NonogramGameScreen(NonogramUiState(game = game(), level = 2, markMode = mode), Recording(), {}, {}) }+        rule.onNodeWithText(str(R.string.how_to_play_fill)).assertExists()+        mode = MarkMode.CROSS+        rule.onNodeWithText(str(R.string.how_to_play_cross)).assertExists()+        rule.onNodeWithText(str(R.string.how_to_play_fill)).assertDoesNotExist()+    }+     @Test fun restartWithProgressAsksConfirmation() {         val a = Recording()         rule.setContent { NonogramGameScreen(NonogramUiState(game = game(filled = setOf(1)), level = 2), a, {}, {}) }