Modify the onCreate() method to ensure that only in case of the DailySudoku the DailySudoku is loaded

This commit is contained in:
ErikWaegerle 2020-05-27 20:15:28 +02:00
parent 9f999b5512
commit 1dc60679d3

View file

@ -55,7 +55,7 @@ import org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout;
import org.secuso.privacyfriendlysudoku.ui.view.WinDialog;
import org.secuso.privacyfriendlysudoku.ui.view.databinding.DialogFragmentShareBoardBinding;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
@ -158,14 +158,19 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
gameController.loadLevel(container);
} else {
boolean isDailySudoku = false;
if (extras != null) {
gameType = GameType.valueOf(extras.getString("gameType", GameType.Default_9x9.name()));
gameDifficulty = GameDifficulty.valueOf(extras.getString("gameDifficulty", GameDifficulty.Moderate.name()));
isDailySudoku = extras.getBoolean("isDailySudoku", false);
loadLevel = extras.getBoolean("loadLevel", false);
if (loadLevel) {
loadLevelID = extras.getInt("loadLevelID");
}
}
if (isDailySudoku) {
gameController.loadNewDailySudokuLevel(gameDifficulty);
} else {
List<GameInfoContainer> loadableGames = GameStateManager.getLoadableGameList();
@ -177,6 +182,7 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
gameController.loadNewLevel(gameType, gameDifficulty);
}
}
}
} else {
gameController = savedInstanceState.getParcelable("gameController");
// in case we get the same object back