This commit is contained in:
Lucas Lima 2020-06-23 00:30:33 -03:00
parent c6604cef42
commit c9f7c1ea42
No known key found for this signature in database
GPG key ID: C5EEF4C30BFBF8D7
5 changed files with 8 additions and 41 deletions

View file

@ -58,7 +58,6 @@
android:saveEnabled="false"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:configChanges="screenSize|orientation"
android:theme="@style/AppTheme.NoActionBar">
<tools:validation testUrl="https://www.lucasnlm.dev/antimine" />

View file

@ -504,40 +504,6 @@ class GameActivity : AppCompatActivity() {
)
}
}
Event.ResumeVictory -> {
val score = Score(
rightMines,
totalMines,
totalArea
)
status = Status.Over(currentTime, score)
invalidateOptionsMenu()
viewModel.stopClock()
if (viewModel.isCurrentGame()) {
waitAndShowEndGameDialog(
victory = true,
await = true
)
}
}
Event.ResumeGameOver -> {
val score = Score(
rightMines,
totalMines,
totalArea
)
status = Status.Over(currentTime, score)
invalidateOptionsMenu()
viewModel.stopClock()
if (viewModel.isCurrentGame()) {
waitAndShowEndGameDialog(
victory = false,
await = true
)
}
}
else -> { }
}
}

View file

@ -48,6 +48,7 @@ open class LevelFragment : CommonLevelFragment() {
val horizontalPadding = calcHorizontalPadding(it.width)
val verticalPadding = calcVerticalPadding(it.height)
layoutManager = makeNewLayoutManager(it.width)
setHasFixedSize(true)
setPadding(horizontalPadding, verticalPadding, 0, 0)
}
}
@ -64,15 +65,16 @@ open class LevelFragment : CommonLevelFragment() {
viewLifecycleOwner,
Observer {
when (it) {
Event.Pause,
Event.ResumeGameOver,
Event.GameOver,
Event.Victory,
Event.ResumeVictory -> areaAdapter.setClickEnabled(false)
Event.Running,
Event.Resume,
Event.ResumeGame,
Event.StartNewGame -> areaAdapter.setClickEnabled(true)
else -> {
}
null -> { }
}
}
)
@ -98,10 +100,10 @@ open class LevelFragment : CommonLevelFragment() {
recyclerGrid.apply {
val horizontalPadding = calcHorizontalPadding(levelSetup.width)
val verticalPadding = calcVerticalPadding(levelSetup.height)
setHasFixedSize(true)
addItemDecoration(SpaceItemDecoration(R.dimen.field_padding))
setPadding(horizontalPadding, verticalPadding, 0, 0)
layoutManager = makeNewLayoutManager(levelSetup.width)
setHasFixedSize(true)
adapter = areaAdapter
alpha = 0.0f

View file

@ -92,8 +92,8 @@ class GameViewModel @ViewModelInject constructor(
refreshAll()
when {
levelFacade.hasAnyMineExploded() -> eventObserver.postValue(Event.ResumeGameOver)
levelFacade.checkVictory() -> eventObserver.postValue(Event.ResumeVictory)
levelFacade.hasAnyMineExploded() -> eventObserver.postValue(Event.GameOver)
levelFacade.checkVictory() -> eventObserver.postValue(Event.Victory)
else -> eventObserver.postValue(Event.ResumeGame)
}

View file

@ -76,7 +76,7 @@ public class FixedGridLayoutManager extends RecyclerView.LayoutManager {
@Override
public boolean isAutoMeasureEnabled() {
return true;
return false;
}
/*