From f9d053a06924271822db9dd0c646220bcd00424e Mon Sep 17 00:00:00 2001 From: uykek Date: Tue, 14 Jul 2020 09:54:41 +0200 Subject: [PATCH] If the GameActivity receives an Intent carrying an imported sudoku containing the key 'isCustom', set 'isCustom' attribute of the created GameInfoContainer to 'true' --- .../privacyfriendlysudoku/ui/GameActivity.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java index 4c2ebff..c5f6c3d 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java @@ -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,12 +489,19 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig editor.apply(); } - //Show time hints new plus old best time + //Don't save statistics if game is custom + boolean isNewBestTime; - statistics.saveGameStats(); + if (!gameController.gameIsCustom()) { + //Show time hints new plus old best time + statistics.saveGameStats(); + isNewBestTime = gameController.getUsedHints() == 0 + && statistics.loadStats(gameController.getGameType(),gameController.getDifficulty()).getMinTime() >= gameController.getTime(); + + } else { + isNewBestTime = false; + } - boolean isNewBestTime = gameController.getUsedHints() == 0 - && statistics.loadStats(gameController.getGameType(),gameController.getDifficulty()).getMinTime() >= gameController.getTime(); dialog = new WinDialog(this, R.style.WinDialog , timeToString(gameController.getTime()), String.valueOf(gameController.getUsedHints()), isNewBestTime);