wordmaker: say so when a word has no definition (#627)
- Commit
d43331e46fdc945a02b7b1acb21deb8a31dc48cc- Author
- vayun-mathur <[email protected]>
- When
- 2026-09-07 04:02 UTC (3 months ago)
- Parents
b79b96a
Diff
games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/WordGameScreen.kt
diff --git a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/WordGameScreen.kt b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/WordGameScreen.ktindex 1a0bf38bb0..5527f74cc1 100644--- a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/WordGameScreen.kt+++ b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/WordGameScreen.kt@@ -255,10 +255,7 @@ fun WordGameScreen( onCellClicked = { row, col -> val word = crosswordData.getWordAt(row, col, foundWords) if (word != null && word in foundWords) {- val definition = actions.getDefinition(word)- if (definition.isNotEmpty()) {- wordWithDefinition = Pair(word, definition)- }+ wordWithDefinition = Pair(word, actions.getDefinition(word)) } }, { scale = it
games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/dialogs/WordDialogs.kt
diff --git a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/dialogs/WordDialogs.kt b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/dialogs/WordDialogs.ktindex df27e3a509..7bafadb610 100644--- a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/dialogs/WordDialogs.kt+++ b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/dialogs/WordDialogs.kt@@ -29,7 +29,14 @@ fun DefinitionDialog(word: String, definition: List<String>, onDismiss: () -> Un title = { Text(text = word.replaceFirstChar { it.uppercase() }) }, text = { Column(modifier = Modifier.verticalScroll(rememberScrollState())) {- Text(text = definition.joinToString("\n\n"))+ // The bundled dictionary does not cover every word the puzzles use, so an+ // empty list is a normal outcome and has to be said out loud — otherwise the+ // tap looks like it did nothing (#627).+ if (definition.isEmpty()) {+ Text(text = stringResource(R.string.no_definition_available))+ } else {+ Text(text = definition.joinToString("\n\n"))+ } } }, confirmButton = {
games/wordmaker/src/main/res/values/strings.xml
diff --git a/games/wordmaker/src/main/res/values/strings.xml b/games/wordmaker/src/main/res/values/strings.xmlindex 6537884108..16af1d8e3a 100644--- a/games/wordmaker/src/main/res/values/strings.xml+++ b/games/wordmaker/src/main/res/values/strings.xml@@ -59,4 +59,7 @@ <string name="cd_submit">Submit</string> <!-- WordGameScreen tap mode: Accessibility description for backspace button to delete last selected letter. Noun --> <string name="cd_backspace">Backspace</string>++ <!-- DefinitionDialog: Body shown when the bundled dictionary has no entry for the tapped word. Sentence -->+ <string name="no_definition_available">No definition available for this word.</string> </resources>