Modify the onCreate() method to ensure that only in case of the DailySudoku the DailySudoku is loaded
This commit is contained in:
parent
9f999b5512
commit
1dc60679d3
1 changed files with 14 additions and 8 deletions
|
@ -55,7 +55,7 @@ import org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.WinDialog;
|
import org.secuso.privacyfriendlysudoku.ui.view.WinDialog;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.databinding.DialogFragmentShareBoardBinding;
|
import org.secuso.privacyfriendlysudoku.ui.view.databinding.DialogFragmentShareBoardBinding;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -158,23 +158,29 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
|
||||||
gameController.loadLevel(container);
|
gameController.loadLevel(container);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
boolean isDailySudoku = false;
|
||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
gameType = GameType.valueOf(extras.getString("gameType", GameType.Default_9x9.name()));
|
gameType = GameType.valueOf(extras.getString("gameType", GameType.Default_9x9.name()));
|
||||||
gameDifficulty = GameDifficulty.valueOf(extras.getString("gameDifficulty", GameDifficulty.Moderate.name()));
|
gameDifficulty = GameDifficulty.valueOf(extras.getString("gameDifficulty", GameDifficulty.Moderate.name()));
|
||||||
|
isDailySudoku = extras.getBoolean("isDailySudoku", false);
|
||||||
loadLevel = extras.getBoolean("loadLevel", false);
|
loadLevel = extras.getBoolean("loadLevel", false);
|
||||||
if (loadLevel) {
|
if (loadLevel) {
|
||||||
loadLevelID = extras.getInt("loadLevelID");
|
loadLevelID = extras.getInt("loadLevelID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isDailySudoku) {
|
||||||
|
gameController.loadNewDailySudokuLevel(gameDifficulty);
|
||||||
|
} else {
|
||||||
|
|
||||||
List<GameInfoContainer> loadableGames = GameStateManager.getLoadableGameList();
|
List<GameInfoContainer> loadableGames = GameStateManager.getLoadableGameList();
|
||||||
|
|
||||||
if (loadLevel && loadableGames.size() > loadLevelID) {
|
if (loadLevel && loadableGames.size() > loadLevelID) {
|
||||||
// load level from GameStateManager
|
// load level from GameStateManager
|
||||||
gameController.loadLevel(loadableGames.get(loadLevelID));
|
gameController.loadLevel(loadableGames.get(loadLevelID));
|
||||||
} else {
|
} else {
|
||||||
// load a new level
|
// load a new level
|
||||||
gameController.loadNewLevel(gameType, gameDifficulty);
|
gameController.loadNewLevel(gameType, gameDifficulty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue