Skip to content

Commit

Permalink
Merge pull request #346 from lucasnlm/add-highlight-number-feature
Browse files Browse the repository at this point in the history
Add highlight number feature
  • Loading branch information
lucasnlm committed Oct 31, 2021
2 parents 6966fd8 + 5a129c5 commit d8e7a6e
Show file tree
Hide file tree
Showing 62 changed files with 161 additions and 138 deletions.
2 changes: 1 addition & 1 deletion about/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.2.1'

// Constraint
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'

// Lifecycle
api 'android.arch.lifecycle:extensions:1.1.1'
Expand Down
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {

defaultConfig {
// versionCode and versionName must be hardcoded to support F-droid
versionCode 1500021
versionName '15.0.2'
versionCode 1501001
versionName '15.1.0'
minSdkVersion 21
targetSdkVersion 31
multiDexEnabled true
Expand Down Expand Up @@ -135,10 +135,10 @@ dependencies {
implementation 'androidx.work:work-runtime-ktx:2.7.0'

// Lifecycle
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.0'

// Room
implementation 'androidx.room:room-ktx:2.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class CloudSaveManagerImpl(
squareDivider = preferencesRepository.squareDivider(),
doubleClickTimeout = preferencesRepository.getDoubleClickTimeout().toInt(),
allowTapNumbers = preferencesRepository.allowTapOnNumbers().toInt(),
highlightNumbers = preferencesRepository.dimNumbers().toInt(),
)
}
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ class MainActivity : ThematicActivity(R.layout.activity_main) {
}

private fun afterGooglePlayGames() {
playGamesManager.signInToFirebase(this)
inAppUpdateManager.checkUpdate(this)
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/test/java/dev/lucasnlm/antimine/di/TestAppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ val AppModule = module {
override fun keepRequestingLogin(status: Boolean) {}

override fun shouldRequestLogin(): Boolean = false

override fun signInToFirebase(activity: Activity) {}
}
} bind IPlayGamesManager::class

Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
implementation 'com.google.android.material:material:1.4.0'

// Constraint
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'

// Lifecycle
api 'android.arch.lifecycle:extensions:1.1.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ open class GameViewModel(
}
}

fun refreshUserPreferences() {
private fun refreshUserPreferences() {
if (initialized) {
gameController.apply {
val controlType = preferencesRepository.controlStyle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MinefieldHandlerTest {

@Test
fun testOpenAreaWithSafeZone() {
handleMinefield() { handler ->
handleMinefield { handler ->
assertTrue(handler.result()[3].isCovered)
handler.openAt(3, false, openNeighbors = false)
assertFalse(handler.result()[3].isCovered)
Expand Down
2 changes: 1 addition & 1 deletion control/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.2.1'

// Constraint
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'

// Lifecycle
api 'android.arch.lifecycle:extensions:1.1.1'
Expand Down
8 changes: 4 additions & 4 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'

// Lifecycle
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ interface IPlayGamesManager {
fun submitLeaderboard(leaderboard: Leaderboard, value: Long)
fun keepRequestingLogin(status: Boolean)
fun shouldRequestLogin(): Boolean
fun signInToFirebase(activity: Activity)
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ data class CloudSave(
val doubleClickTimeout: Int,
val allowTapNumbers: Int,
val hapticFeedbackLevel: Int,
val highlightNumbers: Int,
)

fun CloudSave.toHashMap(): HashMap<String, Any> = hashMapOf(
Expand All @@ -48,6 +49,7 @@ fun CloudSave.toHashMap(): HashMap<String, Any> = hashMapOf(
"newSquareDivider" to squareDivider,
"doubleClickTimeout" to doubleClickTimeout,
"allowTapNumbers" to allowTapNumbers,
"highlightNumbers" to highlightNumbers,
)

private fun Any?.parseInt(): Int = this?.toString()?.toInt() ?: throw Exception("Fail to parse Int")
Expand Down Expand Up @@ -78,4 +80,5 @@ fun cloudSaveOf(id: String, data: Map<String, Any>) =
squareDivider = data["newSquareDivider"].parseInt(0),
doubleClickTimeout = data["doubleClickTimeout"].parseInt(400),
allowTapNumbers = data["allowTapNumbers"].parseInt(1),
highlightNumbers = data["highlightNumbers"].parseInt(0),
)
4 changes: 4 additions & 0 deletions foss/src/main/java/dev/lucasnlm/external/PlayGamesManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ class PlayGamesManager(
override fun shouldRequestLogin(): Boolean {
return false
}

override fun signInToFirebase(activity: Activity) {
// F-droid build doesn't have Google Play Games
}
}
1 change: 0 additions & 1 deletion gdx/src/main/java/dev/lucasnlm/antimine/gdx/GdxLocal.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ object GdxLocal {
var textureAtlas: TextureAtlas? = null
var areaAtlas: TextureAtlas? = null
var gameTextures: GameTextures? = null
var highlightAlpha = 0.0f
var zoom = 1.0f

// Global animation scale, it defines how fast/slow all animations must be executed.
Expand Down
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-af-rZA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Verstellings</string>
<string name="animations">Animasie</string>
<string name="vibration">Haptiese terugvoer</string>
<string name="haptic_feedback_level">Haptic Feedback Level</string>
<string name="about">Aangaande</string>
<string name="events">Statistiek</string>
<string name="custom">Pasmaak</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Wil u \'n nuwe spel begin met hierdie kaart?</string>
<string name="mines_remaining">%d myne</string>
<string name="game_time">Speeltyd</string>
<string name="mine">Myne</string>
<string name="settings_general">Algemeen</string>
<string name="settings_gameplay">Spel</string>
<string name="settings_accessibility">Toeganklikheid</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">The current minefield may not be guess-free!</string>
<string name="fixed_size">Fixed Size</string>
<string name="progressive">Progressive</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-ar-rSA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">الإعدادات</string>
<string name="animations">الرسوم المتحركة</string>
<string name="vibration">تغذية راجعة باللمس</string>
<string name="haptic_feedback_level">تغذية راجعة باللمس</string>
<string name="about">حول</string>
<string name="events">إحصائيات</string>
<string name="custom">مخصص</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">هل تريد بدء لعبة جديدة؟</string>
<string name="mines_remaining">%d لغم</string>
<string name="game_time">وقت اللعب</string>
<string name="mine">لغم</string>
<string name="settings_general">عام</string>
<string name="settings_gameplay">أسلوب اللعبة</string>
<string name="settings_accessibility">إمكانية الوصول</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">قد لا يكون حقل الألغام الحالي خاليًا من التخمين!</string>
<string name="fixed_size">الجم الثابت</string>
<string name="progressive">التقدمي</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-bg-rBG/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Настройки</string>
<string name="animations">Анимации</string>
<string name="vibration">Вибрация при докосване</string>
<string name="haptic_feedback_level">Haptic Feedback Level</string>
<string name="about">За нас</string>
<string name="events">Статистики</string>
<string name="custom">По избор</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Искате ли да започнете нова игра?</string>
<string name="mines_remaining">%d мини</string>
<string name="game_time">Време в играта</string>
<string name="mine">Мина</string>
<string name="settings_general">Основни</string>
<string name="settings_gameplay">Начин на игра</string>
<string name="settings_accessibility">Достъпност</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">Сегашното поле може да не е без предположения!</string>
<string name="fixed_size">Фиксиран размер</string>
<string name="progressive">Прогресивен</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-ca-rES/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Configuració</string>
<string name="animations">Animacions</string>
<string name="vibration">Resposta hàptica</string>
<string name="haptic_feedback_level">Haptic Feedback Level</string>
<string name="about">Quant a</string>
<string name="events">Estadístiques</string>
<string name="custom">Personalitzat</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Vols començar un joc nou?</string>
<string name="mines_remaining">%d mines</string>
<string name="game_time">Temps de joc</string>
<string name="mine">Mina</string>
<string name="settings_general">General</string>
<string name="settings_gameplay">Joc</string>
<string name="settings_accessibility">Accessibilitat</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">The current minefield may not be guess-free!</string>
<string name="fixed_size">Mida Fixa</string>
<string name="progressive">Progressiu</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-cs-rCZ/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Nastavení</string>
<string name="animations">Animace</string>
<string name="vibration">Hmatová odezva</string>
<string name="haptic_feedback_level">Síla hmatové odezvy</string>
<string name="about">O aplikaci</string>
<string name="events">Statistiky</string>
<string name="custom">Vlastní</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Chcete začít novou hru?</string>
<string name="mines_remaining">Počet min: %d</string>
<string name="game_time">Herní čas</string>
<string name="mine">Mina</string>
<string name="settings_general">Obecné</string>
<string name="settings_gameplay">Hra</string>
<string name="settings_accessibility">Přístupnost</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">Možná budete potřebovat nápovědu k dokončení této úrovně!</string>
<string name="fixed_size">Pevná velikost</string>
<string name="progressive">Progresivní</string>
<string name="highlight_unsolved_numbers">Zvýraznit nevyřešená čísla</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-da-rDK/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Settings</string>
<string name="animations">Animationer</string>
<string name="vibration">Haptisk Feedback</string>
<string name="haptic_feedback_level">Haptic Feedback Level</string>
<string name="about">Om</string>
<string name="events">Statistik</string>
<string name="custom">Tilpasset</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Vil du starte et nyt spil?</string>
<string name="mines_remaining">%d miner</string>
<string name="game_time">Spil Tid</string>
<string name="mine">Mine</string>
<string name="settings_general">Generelt</string>
<string name="settings_gameplay">Gameplay</string>
<string name="settings_accessibility">Tilgængelighed</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">The current minefield may not be guess-free!</string>
<string name="fixed_size">Fixed Size</string>
<string name="progressive">Progressive</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-de-rDE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Einstellungen</string>
<string name="animations">Animationen</string>
<string name="vibration">Haptische Rückmeldung</string>
<string name="haptic_feedback_level">Haptische Rückmeldung</string>
<string name="about">Über</string>
<string name="events">Statistiken</string>
<string name="custom">Benutzerdefiniert</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Möchtest du ein neues Spiel beginnen?</string>
<string name="mines_remaining">%d Minen</string>
<string name="game_time">Spielzeit</string>
<string name="mine">Mine</string>
<string name="settings_general">Allgemein</string>
<string name="settings_gameplay">Spielablauf</string>
<string name="settings_accessibility">Barrierefreiheit</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">Das aktuelle Minenfeld ist möglicherweise nicht ratenfrei!</string>
<string name="fixed_size">Feste Größe</string>
<string name="progressive">Fortschrittlich</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-el-rGR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Ρυθμίσεις</string>
<string name="animations">Εφέ Κίνησης</string>
<string name="vibration">Δόνηση</string>
<string name="haptic_feedback_level">Επίπεδο Δόνησης</string>
<string name="about">Σχετικά</string>
<string name="events">Στατιστικά</string>
<string name="custom">Προσαρμοσμένο</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Θέλετε να ξεκινήσετε ένα νέο παιχνίδι;</string>
<string name="mines_remaining">%d νάρκες</string>
<string name="game_time">Ώρα Παιχνιδιού</string>
<string name="mine">Νάρκη</string>
<string name="settings_general">Γενικά</string>
<string name="settings_gameplay">Gameplay</string>
<string name="settings_accessibility">Προσβασιμότητα</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">Το τρέχον ναρκοπέδιο δεν μπορεί να λυθεί χωρίς μαντεψιές!</string>
<string name="fixed_size">Προεπιλεγμένο Μέγεθος</string>
<string name="progressive">Προοδευτικό</string>
<string name="highlight_unsolved_numbers">Επισήμανση άλυτων αριθμών</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-en-rUS/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Settings</string>
<string name="animations">Animations</string>
<string name="vibration">Haptic Feedback</string>
<string name="haptic_feedback_level">Haptic Feedback Level</string>
<string name="about">About</string>
<string name="events">Statistics</string>
<string name="custom">Custom</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Do you want to start a new game?</string>
<string name="mines_remaining">%d mines</string>
<string name="game_time">Game Time</string>
<string name="mine">Mine</string>
<string name="settings_general">General</string>
<string name="settings_gameplay">Gameplay</string>
<string name="settings_accessibility">Accessibility</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">The current minefield may not be guess-free!</string>
<string name="fixed_size">Fixed Size</string>
<string name="progressive">Progressive</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-eo-rUY/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Agordoj</string>
<string name="animations">Animacioj</string>
<string name="vibration">Tuŝ-retrokuplado</string>
<string name="haptic_feedback_level">Tuŝ-retrokuplado</string>
<string name="about">Pri</string>
<string name="events">Statistikaĵoj</string>
<string name="custom">Laŭmenda</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">Ĉu vi volas komenci novan ludon?</string>
<string name="mines_remaining">%d minoj</string>
<string name="game_time">Luda Tempo</string>
<string name="mine">Mino</string>
<string name="settings_general">Ĝeneralaj</string>
<string name="settings_gameplay">Ludmaniero</string>
<string name="settings_accessibility">Alirebleco</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">The current minefield may not be guess-free!</string>
<string name="fixed_size">Fixed Size</string>
<string name="progressive">Progressive</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
3 changes: 1 addition & 2 deletions i18n/src/main/res/values-es-rES/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<string name="settings">Configuración</string>
<string name="animations">Animaciones</string>
<string name="vibration">Respuesta háptica</string>
<string name="haptic_feedback_level">Nivel de respuesta táctil</string>
<string name="about">Acerca de</string>
<string name="events">Estadísticas</string>
<string name="custom">Personalizado</string>
Expand All @@ -33,7 +32,6 @@
<string name="new_game_request">¿Deseas empezar una nueva partida?</string>
<string name="mines_remaining">%d minas</string>
<string name="game_time">Tiempo de juego</string>
<string name="mine">Mina</string>
<string name="settings_general">General</string>
<string name="settings_gameplay">Jugabilidad</string>
<string name="settings_accessibility">Accesibilidad</string>
Expand Down Expand Up @@ -123,4 +121,5 @@
<string name="no_guess_fail_warning">¡Es posible que necesites una pista para solucionar este nivel!</string>
<string name="fixed_size">Tamaño fijo</string>
<string name="progressive">Progresivo</string>
<string name="highlight_unsolved_numbers">Highlight unsolved numbers</string>
</resources>
Loading

0 comments on commit d8e7a6e

Please sign in to comment.