If the GameActivity receives an Intent carrying an imported sudoku containing the key 'isCustom', set 'isCustom' attribute of the created GameInfoContainer to 'true'

This commit is contained in:
uykek 2020-07-14 09:54:41 +02:00
parent 54a4024dac
commit f9d053a069

View file

@ -140,6 +140,7 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
QQWing difficultyCheck;
GameInfoContainer container = new GameInfoContainer(0, GameDifficulty.Unspecified,
GameType.Unspecified, new int [boardSize], new int [boardSize], new boolean [boardSize][sectionSize]);
container.setCustom(extras.getBoolean("isCustom", false));
try {
container.parseGameType("Default_" + sectionSize + "x" + sectionSize);
@ -488,13 +489,20 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
editor.apply();
}
//Don't save statistics if game is custom
boolean isNewBestTime;
if (!gameController.gameIsCustom()) {
//Show time hints new plus old best time
statistics.saveGameStats();
boolean isNewBestTime = gameController.getUsedHints() == 0
isNewBestTime = gameController.getUsedHints() == 0
&& statistics.loadStats(gameController.getGameType(),gameController.getDifficulty()).getMinTime() >= gameController.getTime();
} else {
isNewBestTime = false;
}
dialog = new WinDialog(this, R.style.WinDialog , timeToString(gameController.getTime()), String.valueOf(gameController.getUsedHints()), isNewBestTime);
dialog.getWindow().setContentView(R.layout.win_screen_layout);