Modern Apps git

← Modern-Apps.git

wordmaker: fix the tap to spell mode

Commit
9c8ce26bc9820146304bb42d713cd5c9045ffb64
Author
Vayun Mathur <[email protected]>
When
2026-06-12 16:46 UTC (5 months ago)
Parents
2129c87

Diff

games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/MainActivity.kt
diff --git a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/MainActivity.kt b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/MainActivity.ktindex 3b861a70d2..813d1c8404 100644--- a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/MainActivity.kt+++ b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/MainActivity.kt@@ -81,6 +81,7 @@ import com.vayunmathur.games.wordmaker.ui.SettingsPage import com.vayunmathur.games.wordmaker.util.AppBackupAgent import com.vayunmathur.games.wordmaker.util.WordMakerViewModel import com.vayunmathur.library.ui.AchievementNotification+import com.vayunmathur.library.ui.IconSettings import com.vayunmathur.library.ui.DynamicTheme import com.vayunmathur.library.ui.GameCenterScreen import com.vayunmathur.library.util.AchievementsManager@@ -304,12 +305,12 @@ fun WordGameScreen(     }      val isWon = crosswordData.winsWith(foundWords)-    +     LaunchedEffect(isWon) {         if (isWon) {             if (currentLevel == 1) achievementsManager.onAchievementUnlocked("level_1_done")             if (currentLevel == 861) achievementsManager.onAchievementUnlocked("manual_levels_done")-            +             achievementsManager.onProgressUpdated("manual_levels_done", currentLevel)             achievementsManager.onProgressUpdated("level_50", currentLevel)             achievementsManager.onProgressUpdated("level_100", currentLevel)@@ -335,7 +336,7 @@ fun WordGameScreen(                         Icon(painterResource(id = android.R.drawable.btn_star_big_on), "Achievements")                     }                     IconButton(onClick = onOpenSettings) {-                        Icon(painterResource(id = android.R.drawable.ic_menu_preferences), "Settings")+                        IconSettings()                     }                 }             )@@ -818,7 +819,31 @@ fun LetterChooser(         )          Row(verticalAlignment = Alignment.Top) {-            Spacer(modifier = Modifier.width(72.dp))+            Column(+                modifier = Modifier.width(72.dp),+                horizontalAlignment = Alignment.CenterHorizontally+            ) {+                if (tapToSpell && selectedLettersIndices.isNotEmpty()) {+                    FilledIconButton(onClick = {+                        selectedLettersIndices = selectedLettersIndices.dropLast(1)+                    }) {+                        Icon(painterResource(R.drawable.backspace_24px), contentDescription = "Backspace")+                    }+                    Spacer(modifier = Modifier.height(8.dp))+                    FilledIconButton(onClick = {+                        if (selectedLettersIndices.isNotEmpty()) {+                            val word = selectedLettersIndices.map { letters[it].char }.joinToString("")+                            val ids = selectedLettersIndices.map { letters[it].id }+                            coroutineScope.launch {+                                onWordSubmitted(word, ids)+                                selectedLettersIndices = emptyList()+                            }+                        }+                    }) {+                        Icon(painterResource(R.drawable.keyboard_return_24px), contentDescription = "Submit")+                    }+                }+            }             Box(                 modifier = Modifier                     .size(250.dp)@@ -915,7 +940,7 @@ fun LetterChooser(                                 }                             } else Modifier),                             CircleShape,-                            if (index in selectedLettersIndices) colorScheme.primary else colorScheme.surfaceVariant,+                            if (index in selectedLettersIndices) colorScheme.primary else colorScheme.secondary,                             chooserLetter.char.toString(),                             Modifier.padding(1.dp),                             FontWeight.Bold,@@ -929,28 +954,6 @@ fun LetterChooser(                 Icon(painterResource(R.drawable.ic_shuffle), contentDescription = "Shuffle")             }         }-        if (tapToSpell && selectedLettersIndices.isNotEmpty()) {-            Row(modifier = Modifier.padding(top = 8.dp)) {-                FilledIconButton(onClick = {-                    selectedLettersIndices = selectedLettersIndices.dropLast(1)-                }) {-                    Icon(painterResource(android.R.drawable.ic_input_delete), contentDescription = "Backspace")-                }-                Spacer(modifier = Modifier.width(16.dp))-                FilledIconButton(onClick = {-                    if (selectedLettersIndices.isNotEmpty()) {-                        val word = selectedLettersIndices.map { letters[it].char }.joinToString("")-                        val ids = selectedLettersIndices.map { letters[it].id }-                        coroutineScope.launch {-                            onWordSubmitted(word, ids)-                            selectedLettersIndices = emptyList()-                        }-                    }-                }) {-                    Icon(painterResource(android.R.drawable.ic_menu_send), contentDescription = "Submit")-                }-            }-        }     } } 
games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/SettingsPage.kt
diff --git a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/SettingsPage.kt b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/SettingsPage.ktindex 58510c5fcf..6fe32b2b66 100644--- a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/SettingsPage.kt+++ b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/SettingsPage.kt@@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp+import com.vayunmathur.library.ui.IconNavigation import com.vayunmathur.games.wordmaker.R import com.vayunmathur.games.wordmaker.util.WordMakerViewModel @@ -34,9 +35,7 @@ fun SettingsPage(viewModel: WordMakerViewModel, onBack: () -> Unit) {             TopAppBar(                 title = { Text(stringResource(R.string.settings)) },                 navigationIcon = {-                    IconButton(onClick = onBack) {-                        Icon(painterResource(android.R.drawable.ic_menu_revert), contentDescription = "Back")-                    }+                    IconNavigation(onBack)                 },                 actions = {                     com.vayunmathur.library.ui.BackupButtons(
games/wordmaker/src/main/res/drawable/backspace_24px.xml
diff --git a/games/wordmaker/src/main/res/drawable/backspace_24px.xml b/games/wordmaker/src/main/res/drawable/backspace_24px.xmlnew file mode 100644index 0000000000..d6ba8fc613--- /dev/null+++ b/games/wordmaker/src/main/res/drawable/backspace_24px.xml@@ -0,0 +1,20 @@+<!--+  ~ Copyright (C) 2026 The Android Open Source Project+  ~+  ~ Licensed under the Apache License, Version 2.0 (the "License");+  ~ you may not use this file except in compliance with the License.+  ~ You may obtain a copy of the License at+  ~+  ~      http://www.apache.org/licenses/LICENSE-2.0+  ~+  ~ Unless required by applicable law or agreed to in writing, software+  ~ distributed under the License is distributed on an "AS IS" BASIS,+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+  ~ See the License for the specific language governing permissions and+  ~ limitations under the License.+  -->+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="24dp" android:tint="#000000" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp">+      +    <path android:fillColor="@android:color/white" android:pathData="M456,640L560,536L664,640L720,584L616,480L720,376L664,320L560,424L456,320L400,376L504,480L400,584L456,640ZM360,800Q341,800 324,791.5Q307,783 296,768L80,480L296,192Q307,177 324,168.5Q341,160 360,160L800,160Q833,160 856.5,183.5Q880,207 880,240L880,720Q880,753 856.5,776.5Q833,800 800,800L360,800ZM180,480L360,720Q360,720 360,720Q360,720 360,720L800,720Q800,720 800,720Q800,720 800,720L800,240Q800,240 800,240Q800,240 800,240L360,240Q360,240 360,240Q360,240 360,240L180,480ZM580,480Q580,480 580,480Q580,480 580,480L580,480Q580,480 580,480Q580,480 580,480L580,480Q580,480 580,480Q580,480 580,480L580,480L580,480Q580,480 580,480Q580,480 580,480Z"/>+    +</vector>
games/wordmaker/src/main/res/drawable/keyboard_return_24px.xml
diff --git a/games/wordmaker/src/main/res/drawable/keyboard_return_24px.xml b/games/wordmaker/src/main/res/drawable/keyboard_return_24px.xmlnew file mode 100644index 0000000000..536bff184f--- /dev/null+++ b/games/wordmaker/src/main/res/drawable/keyboard_return_24px.xml@@ -0,0 +1,20 @@+<!--+  ~ Copyright (C) 2026 The Android Open Source Project+  ~+  ~ Licensed under the Apache License, Version 2.0 (the "License");+  ~ you may not use this file except in compliance with the License.+  ~ You may obtain a copy of the License at+  ~+  ~      http://www.apache.org/licenses/LICENSE-2.0+  ~+  ~ Unless required by applicable law or agreed to in writing, software+  ~ distributed under the License is distributed on an "AS IS" BASIS,+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+  ~ See the License for the specific language governing permissions and+  ~ limitations under the License.+  -->+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="24dp" android:tint="#000000" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp">+      +    <path android:fillColor="@android:color/white" android:pathData="M360,720L120,480L360,240L416,296L272,440L760,440L760,280L840,280L840,520L272,520L416,664L360,720Z"/>+    +</vector>