From 4a78ccef0b0ce14dae72a1b8ff6bb37f46e7d17c Mon Sep 17 00:00:00 2001 From: Lucas Lima Date: Sat, 9 Oct 2021 19:26:05 -0300 Subject: [PATCH] Remove no guess from settings --- .../antimine/cloud/CloudSaveManagerImpl.kt | 1 - .../antimine/main/viewmodel/MainViewModel.kt | 1 - .../preferences/PreferencesActivity.kt | 7 ----- app/src/main/res/layout/activity_main.xml | 2 +- .../main/res/layout/activity_preferences.xml | 27 +------------------ .../mocks/MockPreferencesRepository.kt | 4 --- .../antimine/common/level/GameController.kt | 7 +---- .../common/level/viewmodel/GameViewModel.kt | 1 - .../src/main/res/layout/activity_control.xml | 2 +- .../dev/lucasnlm/external/model/CloudSave.kt | 3 --- i18n/src/main/res/values/strings.xml | 4 +-- .../preferences/IPreferencesRepository.kt | 3 --- .../antimine/preferences/PreferenceKeys.kt | 1 - .../preferences/PreferencesRepository.kt | 7 ----- 14 files changed, 5 insertions(+), 65 deletions(-) diff --git a/app/src/main/java/dev/lucasnlm/antimine/cloud/CloudSaveManagerImpl.kt b/app/src/main/java/dev/lucasnlm/antimine/cloud/CloudSaveManagerImpl.kt index 9f85cc3a6..1896ac6f4 100644 --- a/app/src/main/java/dev/lucasnlm/antimine/cloud/CloudSaveManagerImpl.kt +++ b/app/src/main/java/dev/lucasnlm/antimine/cloud/CloudSaveManagerImpl.kt @@ -48,7 +48,6 @@ class CloudSaveManagerImpl( stats = statsRepository.getAllStats(minId).map { it.toHashMap() }, premiumFeatures = preferencesRepository.isPremiumEnabled().toInt(), controlStyle = preferencesRepository.controlStyle().ordinal, - noGuessing = preferencesRepository.useNoGuessingAlgorithm().toInt(), language = preferencesRepository.getPreferredLocale() ?: "", openDirectly = preferencesRepository.openGameDirectly().toInt(), unlockedThemes = preferencesRepository.getUnlockedThemes().joinToString(" "), diff --git a/app/src/main/java/dev/lucasnlm/antimine/main/viewmodel/MainViewModel.kt b/app/src/main/java/dev/lucasnlm/antimine/main/viewmodel/MainViewModel.kt index fc76f55ad..3a2145fec 100644 --- a/app/src/main/java/dev/lucasnlm/antimine/main/viewmodel/MainViewModel.kt +++ b/app/src/main/java/dev/lucasnlm/antimine/main/viewmodel/MainViewModel.kt @@ -78,7 +78,6 @@ class MainViewModel( setSquareSize(squareSize) setCustomLongPressTimeout(touchTiming.toLong()) setQuestionMark(questionMark != 0) - setNoGuessingAlgorithm(noGuessing != 0) setPreferredLocale(language) setFlagAssistant(gameAssistance != 0) setHapticFeedback(hapticFeedback != 0) diff --git a/app/src/main/java/dev/lucasnlm/antimine/preferences/PreferencesActivity.kt b/app/src/main/java/dev/lucasnlm/antimine/preferences/PreferencesActivity.kt index 6853adf4f..c1b7e3b48 100644 --- a/app/src/main/java/dev/lucasnlm/antimine/preferences/PreferencesActivity.kt +++ b/app/src/main/java/dev/lucasnlm/antimine/preferences/PreferencesActivity.kt @@ -92,13 +92,6 @@ class PreferencesActivity : action = { preferenceRepository.setFlagAssistant(it) } ) - bindItem( - label = noGuessingLabel, - switch = noGuessing, - checked = preferenceRepository.useNoGuessingAlgorithm(), - action = { preferenceRepository.setNoGuessingAlgorithm(it) } - ) - bindItem( label = helpLabel, switch = help, diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 3a8880b6e..cb62ee1b8 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -38,7 +38,7 @@ android:layout_marginStart="4dp" android:textColor="?attr/colorOnBackground" android:drawablePadding="8dp" - android:paddingStart="16dp" + android:paddingStart="8dp" android:paddingEnd="0dp" tools:text="@string/app_name" app:drawableStartCompat="@drawable/mine" /> diff --git a/app/src/main/res/layout/activity_preferences.xml b/app/src/main/res/layout/activity_preferences.xml index 64b185e0c..1ca68b385 100644 --- a/app/src/main/res/layout/activity_preferences.xml +++ b/app/src/main/res/layout/activity_preferences.xml @@ -211,31 +211,6 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/automaticFlagsLabel" /> - - - - + app:layout_constraintTop_toBottomOf="@+id/automaticFlagsLabel" /> diff --git a/external/src/main/java/dev/lucasnlm/external/model/CloudSave.kt b/external/src/main/java/dev/lucasnlm/external/model/CloudSave.kt index 586b09c93..d47453b4f 100644 --- a/external/src/main/java/dev/lucasnlm/external/model/CloudSave.kt +++ b/external/src/main/java/dev/lucasnlm/external/model/CloudSave.kt @@ -17,7 +17,6 @@ data class CloudSave( val stats: List>, val premiumFeatures: Int, val controlStyle: Int, - val noGuessing: Int, val language: String, val openDirectly: Int, val unlockedThemes: String, @@ -43,7 +42,6 @@ fun CloudSave.toHashMap(): HashMap = hashMapOf( "stats" to stats, "premiumFeatures" to premiumFeatures, "controlStyle" to controlStyle, - "noGuessing" to noGuessing, "language" to language, "openDirectly" to openDirectly, "unlockedThemes" to unlockedThemes, @@ -74,7 +72,6 @@ fun cloudSaveOf(id: String, data: Map) = stats = data["stats"] as List>, premiumFeatures = data["premiumFeatures"].parseInt(), controlStyle = data["controlStyle"].parseInt(), - noGuessing = data["noGuessing"].parseInt(1), language = data["language"].parseString(""), openDirectly = data["openDirectly"].parseInt(0), unlockedThemes = data["unlockedThemes"].parseString(""), diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index 34fc2364a..1fb36adb7 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -7,7 +7,7 @@ If a square has the same number of flags, all other remaining squares adjacent to it aren\'t mines (the green arrow). Review the numbers and keep opening squares. Games - Tap to begin + Tap to Begin Previous Games Difficulty Standard @@ -20,7 +20,6 @@ Settings Animations Haptic Feedback - Haptic Feedback Level About Statistics Custom @@ -33,7 +32,6 @@ Do you want to start a new game? %d mines Game Time - Mine General Gameplay Accessibility diff --git a/preferences/src/main/java/dev/lucasnlm/antimine/preferences/IPreferencesRepository.kt b/preferences/src/main/java/dev/lucasnlm/antimine/preferences/IPreferencesRepository.kt index b40dc5b83..faac9943a 100644 --- a/preferences/src/main/java/dev/lucasnlm/antimine/preferences/IPreferencesRepository.kt +++ b/preferences/src/main/java/dev/lucasnlm/antimine/preferences/IPreferencesRepository.kt @@ -86,9 +86,6 @@ interface IPreferencesRepository { fun useAnimations(): Boolean fun setAnimations(enabled: Boolean) - fun setNoGuessingAlgorithm(value: Boolean) - fun useNoGuessingAlgorithm(): Boolean - fun useQuestionMark(): Boolean fun setQuestionMark(value: Boolean) diff --git a/preferences/src/main/java/dev/lucasnlm/antimine/preferences/PreferenceKeys.kt b/preferences/src/main/java/dev/lucasnlm/antimine/preferences/PreferenceKeys.kt index a555d908f..7a60519fb 100644 --- a/preferences/src/main/java/dev/lucasnlm/antimine/preferences/PreferenceKeys.kt +++ b/preferences/src/main/java/dev/lucasnlm/antimine/preferences/PreferenceKeys.kt @@ -5,7 +5,6 @@ object PreferenceKeys { const val PREFERENCE_VIBRATION_LEVEL = "preference_vibration_level" const val PREFERENCE_ASSISTANT = "preference_assistant" const val PREFERENCE_ANIMATION = "preference_animation" - const val PREFERENCE_NO_GUESSING = "preference_no_guessing" const val PREFERENCE_AREA_SIZE = "preference_new_area_size" const val PREFERENCE_QUESTION_MARK = "preference_use_question_mark" const val PREFERENCE_USE_HELP = "preference_use_help" diff --git a/preferences/src/main/java/dev/lucasnlm/antimine/preferences/PreferencesRepository.kt b/preferences/src/main/java/dev/lucasnlm/antimine/preferences/PreferencesRepository.kt index 447b4d1fb..4732e2f78 100644 --- a/preferences/src/main/java/dev/lucasnlm/antimine/preferences/PreferencesRepository.kt +++ b/preferences/src/main/java/dev/lucasnlm/antimine/preferences/PreferencesRepository.kt @@ -103,13 +103,6 @@ class PreferencesRepository( preferencesManager.putBoolean(PreferenceKeys.PREFERENCE_ANIMATION, enabled) } - override fun setNoGuessingAlgorithm(value: Boolean) { - preferencesManager.putBoolean(PreferenceKeys.PREFERENCE_NO_GUESSING, value) - } - - override fun useNoGuessingAlgorithm(): Boolean = - preferencesManager.getBoolean(PreferenceKeys.PREFERENCE_NO_GUESSING, true) - override fun useQuestionMark(): Boolean = preferencesManager.getBoolean(PreferenceKeys.PREFERENCE_QUESTION_MARK, false)