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:
parent
54a4024dac
commit
f9d053a069
1 changed files with 12 additions and 4 deletions
|
@ -140,6 +140,7 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
|
||||||
QQWing difficultyCheck;
|
QQWing difficultyCheck;
|
||||||
GameInfoContainer container = new GameInfoContainer(0, GameDifficulty.Unspecified,
|
GameInfoContainer container = new GameInfoContainer(0, GameDifficulty.Unspecified,
|
||||||
GameType.Unspecified, new int [boardSize], new int [boardSize], new boolean [boardSize][sectionSize]);
|
GameType.Unspecified, new int [boardSize], new int [boardSize], new boolean [boardSize][sectionSize]);
|
||||||
|
container.setCustom(extras.getBoolean("isCustom", false));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
container.parseGameType("Default_" + sectionSize + "x" + sectionSize);
|
container.parseGameType("Default_" + sectionSize + "x" + sectionSize);
|
||||||
|
@ -488,13 +489,20 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Don't save statistics if game is custom
|
||||||
|
boolean isNewBestTime;
|
||||||
|
|
||||||
|
if (!gameController.gameIsCustom()) {
|
||||||
//Show time hints new plus old best time
|
//Show time hints new plus old best time
|
||||||
|
|
||||||
statistics.saveGameStats();
|
statistics.saveGameStats();
|
||||||
|
isNewBestTime = gameController.getUsedHints() == 0
|
||||||
boolean isNewBestTime = gameController.getUsedHints() == 0
|
|
||||||
&& statistics.loadStats(gameController.getGameType(),gameController.getDifficulty()).getMinTime() >= gameController.getTime();
|
&& 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 = new WinDialog(this, R.style.WinDialog , timeToString(gameController.getTime()), String.valueOf(gameController.getUsedHints()), isNewBestTime);
|
||||||
|
|
||||||
dialog.getWindow().setContentView(R.layout.win_screen_layout);
|
dialog.getWindow().setContentView(R.layout.win_screen_layout);
|
||||||
|
|
Loading…
Reference in a new issue