Skip to content

Commit

Permalink
[fix] deactivates levels on pager changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
coderPaddyS committed Jan 14, 2025
1 parent 1e37cb6 commit 32de936
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ public void onPageSelected(int position) {
GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem());
int index = difficultyBar.getProgress()-1;
GameDifficulty gameDifficulty = GameDifficulty.getValidDifficultyList().get(index < 0 ? 0 : index);
Button button = findViewById(R.id.playButton);
if (gameType == GameType.Default_16x16 && index <= 2) {
button.setEnabled(false);
button.setText(R.string.game_config_unsupported);
button.setBackgroundResource(R.drawable.button_inactive);
} else {
button.setEnabled(true);
button.setText(R.string.new_game);
button.setBackgroundResource(R.drawable.button_standalone);
}
((TextView) findViewById(R.id.level_count))
.setText(String.format(getString(R.string.levels_available), newLevelManager.getCountAvailableLevels(gameType, gameDifficulty)));
}
Expand Down

0 comments on commit 32de936

Please sign in to comment.