From acb8117cbec49bb62b40366fe46c127f9d88f424 Mon Sep 17 00:00:00 2001 From: Carsten Friedrich Date: Tue, 1 Jul 2025 19:14:59 +1000 Subject: [PATCH 1/3] Version upgrade and some project clean-up --- app/build.gradle | 10 +++++----- .../main/kotlin/org/carstenf/wordfinder/GameState.kt | 2 +- .../main/kotlin/org/carstenf/wordfinder/WordFinder.kt | 2 +- app/src/main/res/drawable/light_off.xml | 5 ----- app/src/main/res/drawable/lightbulb.xml | 5 ----- app/src/main/res/drawable/preview.xml | 5 ----- app/src/main/res/drawable/psychology_alt.xml | 5 ----- app/src/main/res/drawable/table_outline_border.xml | 4 ---- app/src/main/res/values/dimens.xml | 4 ---- build.gradle | 2 +- settings.gradle | 1 - 11 files changed, 8 insertions(+), 37 deletions(-) delete mode 100644 app/src/main/res/drawable/light_off.xml delete mode 100644 app/src/main/res/drawable/lightbulb.xml delete mode 100644 app/src/main/res/drawable/preview.xml delete mode 100644 app/src/main/res/drawable/psychology_alt.xml delete mode 100644 app/src/main/res/drawable/table_outline_border.xml delete mode 100644 app/src/main/res/values/dimens.xml delete mode 100644 settings.gradle diff --git a/app/build.gradle b/app/build.gradle index 528c2c9..17ddd9f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,12 +2,12 @@ apply plugin: 'com.android.application' apply plugin: 'org.jetbrains.kotlin.android' android { - compileSdk 35 + compileSdk 36 defaultConfig { applicationId "org.carstenf.wordfinder" minSdkVersion 22 - targetSdkVersion 35 + targetSdk 36 } buildTypes { @@ -36,9 +36,9 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.2.1' // NON-NLS implementation 'com.squareup.okhttp3:okhttp:4.12.0' // NON-NLS implementation 'com.google.android.material:material:1.12.0' // NON-NLS - implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.3' // NON-NLS - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3" // NON-NLS - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3" // NON-NLS + implementation 'com.fasterxml.jackson.core:jackson-databind:2.19.1' // NON-NLS + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2" // NON-NLS + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2" // NON-NLS implementation 'androidx.core:core-ktx:1.16.0' // NON-NLS implementation "androidx.preference:preference-ktx:1.2.1" // NON-NLS implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.1" // For Kotlin // NON-NLS diff --git a/app/src/main/kotlin/org/carstenf/wordfinder/GameState.kt b/app/src/main/kotlin/org/carstenf/wordfinder/GameState.kt index a1f581b..5bb1afc 100644 --- a/app/src/main/kotlin/org/carstenf/wordfinder/GameState.kt +++ b/app/src/main/kotlin/org/carstenf/wordfinder/GameState.kt @@ -347,7 +347,7 @@ class GameState : ViewModel() { } fun onSolveFinished() { - if (computerResultList.value?.size == 0) { + if (computerResultList.value?.isEmpty() ?: true) { cancelTimer() gameLifecycleState.postValue(GameLifeCycleState.UNSOLVABLE) } diff --git a/app/src/main/kotlin/org/carstenf/wordfinder/WordFinder.kt b/app/src/main/kotlin/org/carstenf/wordfinder/WordFinder.kt index cb9b467..42c41d8 100644 --- a/app/src/main/kotlin/org/carstenf/wordfinder/WordFinder.kt +++ b/app/src/main/kotlin/org/carstenf/wordfinder/WordFinder.kt @@ -494,7 +494,7 @@ class WordFinder : AppCompatActivity(), OnSharedPreferenceChangeListener { private fun updateLetterButtonOverlay() { val buttons = mutableListOf() for(m in gameState.moves) { - buttons.add(this.findViewById(letterButtonIds[m])) + buttons.add(this.findViewById(letterButtonIds[m])) } drawConnectionsBetweenButtons( this.findViewById(R.id.letterGridView), diff --git a/app/src/main/res/drawable/light_off.xml b/app/src/main/res/drawable/light_off.xml deleted file mode 100644 index c68a68a..0000000 --- a/app/src/main/res/drawable/light_off.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/lightbulb.xml b/app/src/main/res/drawable/lightbulb.xml deleted file mode 100644 index 643a621..0000000 --- a/app/src/main/res/drawable/lightbulb.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/preview.xml b/app/src/main/res/drawable/preview.xml deleted file mode 100644 index 652a312..0000000 --- a/app/src/main/res/drawable/preview.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/psychology_alt.xml b/app/src/main/res/drawable/psychology_alt.xml deleted file mode 100644 index c19ee07..0000000 --- a/app/src/main/res/drawable/psychology_alt.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/table_outline_border.xml b/app/src/main/res/drawable/table_outline_border.xml deleted file mode 100644 index 1cfe9b6..0000000 --- a/app/src/main/res/drawable/table_outline_border.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml deleted file mode 100644 index f947b71..0000000 --- a/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - 20dp - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 9c44e8d..1f549fd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { - kotlin_version = '1.9.24' + kotlin_version = '2.2.0' } repositories { mavenCentral() diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 45f8cb5..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' // NON-NLS From c236ee7f48cdc856a843754557b01799a6f4d0e4 Mon Sep 17 00:00:00 2001 From: Carsten Friedrich Date: Tue, 1 Jul 2025 19:33:48 +1000 Subject: [PATCH 2/3] Adding accidentally deleted file again --- settings.gradle | 1 + 1 file changed, 1 insertion(+) create mode 100644 settings.gradle diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..b489454 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include(":app") // NON-NLS From 659485aedc623ccd2e18561e65b153a107b76e25 Mon Sep 17 00:00:00 2001 From: Carsten Friedrich Date: Wed, 2 Jul 2025 09:33:50 +1000 Subject: [PATCH 3/3] Fixes Issue #44: Time up dialog is now no longer incorrectly shown on after configuration change if it had already been dismissed. --- .../main/kotlin/org/carstenf/wordfinder/util/Util.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/org/carstenf/wordfinder/util/Util.kt b/app/src/main/kotlin/org/carstenf/wordfinder/util/Util.kt index f1f1b00..6595752 100644 --- a/app/src/main/kotlin/org/carstenf/wordfinder/util/Util.kt +++ b/app/src/main/kotlin/org/carstenf/wordfinder/util/Util.kt @@ -172,6 +172,12 @@ fun parseTime(timeStr: String): Long { fun showTimeIsUpDialog(app: WordFinder) { + + val gameState = app.gameState + if(gameState.gameLifecycleState.value == GameState.GameLifeCycleState.GAME_OVER) { + return + } + val builder = AlertDialog.Builder(app) builder.setMessage(R.string.time_up_dialog_msg) .setTitle(R.string.time_up_dialog_title) @@ -179,8 +185,8 @@ fun showTimeIsUpDialog(app: WordFinder) { R.string.time_up_dialog_ok ) { _: DialogInterface?, _: Int -> - if(app.gameState.gameLifecycleState.value != GameState.GameLifeCycleState.GAME_OVER) { - app.gameState.gameLifecycleState.postValue(GameState.GameLifeCycleState.GAME_OVER) + if(gameState.gameLifecycleState.value != GameState.GameLifeCycleState.GAME_OVER) { + gameState.gameLifecycleState.postValue(GameState.GameLifeCycleState.GAME_OVER) } }