From 93cf408ea56aa454c1b065e05e485ebd0af65c6a Mon Sep 17 00:00:00 2001 From: Christopher Beckmann Date: Mon, 16 Nov 2015 23:32:35 +0100 Subject: [PATCH] Bugfix in MainActivity. --- .../java/tu_darmstadt/sudoku/controller/FileManager.java | 3 ++- .../java/tu_darmstadt/sudoku/controller/GameController.java | 2 +- app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/tu_darmstadt/sudoku/controller/FileManager.java b/app/src/main/java/tu_darmstadt/sudoku/controller/FileManager.java index d715115..9f4aa5f 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/controller/FileManager.java +++ b/app/src/main/java/tu_darmstadt/sudoku/controller/FileManager.java @@ -12,6 +12,7 @@ import java.io.IOException; import java.io.StringBufferInputStream; import tu_darmstadt.sudoku.game.GameBoard; +import tu_darmstadt.sudoku.game.GameType; /** * Created by Chris on 16.11.2015. @@ -47,7 +48,7 @@ public class FileManager { String[] levels = saves.split("###"); for(String level : levels) { String[] values = level.split("|"); - int size = Integer.valueOf(values[0]); + GameType type = Enum.valueOf(GameType.class, values[0]); } diff --git a/app/src/main/java/tu_darmstadt/sudoku/controller/GameController.java b/app/src/main/java/tu_darmstadt/sudoku/controller/GameController.java index 52e9dd7..21ee3a9 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/controller/GameController.java +++ b/app/src/main/java/tu_darmstadt/sudoku/controller/GameController.java @@ -351,7 +351,7 @@ public String getStringRepresentation() { StringBuilder sb = new StringBuilder(); sb.append("###"); // TODO add some game information - sb.append(gameType); + sb.append(gameType.name()); sb.append("|"); // add every fixed cell diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java index 99812db..8220682 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/MainActivity.java @@ -100,13 +100,11 @@ public class MainActivity extends AppCompatActivity { i.putExtra("gameDifficulty", gameDifficulty); break; default: - i = getIntent(); } } - if(i == null) { - i = getIntent(); + if(i != null) { + startActivity(i); } - startActivity(i); } @Override