From 2df51ac5ba8f5aa8127ae1a517955d06ac6059d4 Mon Sep 17 00:00:00 2001 From: uykek Date: Tue, 14 Jul 2020 09:50:48 +0200 Subject: [PATCH] Change the way a custom sudoku is saved (add 'true' at the end of the byte stream) so that the GameStateManager can recognise custom levels when loading the sudokus the user has saved on his device --- .../privacyfriendlysudoku/controller/GameStateManager.java | 4 ++++ .../controller/helper/GameInfoContainer.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameStateManager.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameStateManager.java index c50ba6c..a4e9af1 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameStateManager.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameStateManager.java @@ -89,6 +89,10 @@ public class GameStateManager { gic.parseNotes(values[i++]); gic.parseHintsUsed(values[i++]); + if (values.length > i) { + gic.setCustom(true); + } + if (gic.getID() == GameController.DAILY_SUDOKU_ID) { includesDaily = true; } diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java index a2d6ade..79cc687 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/helper/GameInfoContainer.java @@ -185,6 +185,7 @@ public class GameInfoContainer { public static String getGameInfo(GameController controller) { StringBuilder sb = new StringBuilder(); Date today = new Date(); + boolean custom = controller.gameIsCustom(); sb.append(controller.getGameType().name()); sb.append("/"); @@ -202,6 +203,11 @@ public class GameInfoContainer { sb.append("/"); sb.append(controller.getUsedHints()); + if (custom) { + sb.append("/"); + sb.append(custom); + } + String result = sb.toString(); Log.d("getGameInfo", result);