From 518971615f88d147b5144ad29a5dd4c40b8ae865 Mon Sep 17 00:00:00 2001 From: Lucas Lima Date: Wed, 18 Mar 2020 00:30:28 -0300 Subject: [PATCH] fix wear os build --- app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt | 4 ++-- .../dev/lucasnlm/antimine/level/view/EndGameDialogFragment.kt | 2 +- .../java/dev/lucasnlm/antimine/common/level/models/Status.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt b/app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt index 4eba5077..eadde1fd 100644 --- a/app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt +++ b/app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt @@ -387,8 +387,8 @@ class GameActivity : DaggerAppCompatActivity() { val score = currentGameStatus.score EndGameDialogFragment.newInstance( victory, - score.rightMines, - score.totalMines, + score?.rightMines ?: 0, + score?.totalMines ?: 0, currentGameStatus.time ).apply { showAllowingStateLoss(supportFragmentManager, EndGameDialogFragment.TAG) diff --git a/app/src/main/java/dev/lucasnlm/antimine/level/view/EndGameDialogFragment.kt b/app/src/main/java/dev/lucasnlm/antimine/level/view/EndGameDialogFragment.kt index 1520b23d..416c8369 100644 --- a/app/src/main/java/dev/lucasnlm/antimine/level/view/EndGameDialogFragment.kt +++ b/app/src/main/java/dev/lucasnlm/antimine/level/view/EndGameDialogFragment.kt @@ -51,7 +51,7 @@ class EndGameDialogFragment : DaggerAppCompatDialogFragment() { time = getLong(DIALOG_TIME) rightMines = getInt(DIALOG_RIGHT_MINES) totalMines = getInt(DIALOG_TOTAL_MINES) - hasValidData = true + hasValidData = (totalMines > 0) } } diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Status.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Status.kt index 18735862..ab40d01f 100644 --- a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Status.kt +++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Status.kt @@ -7,6 +7,6 @@ sealed class Status { class Over( val time: Long = 0L, - val score: Score + val score: Score? = null ) : Status() }