Merge branch 'Sudoku-v3.0' of https://github.com/SecUSo/privacy-friendly-sudoku into Sudoku-v3.0
This commit is contained in:
commit
d1615b4f5f
5 changed files with 17 additions and 20 deletions
|
@ -26,11 +26,6 @@ import org.secuso.privacyfriendlysudoku.ui.view.CreateSudokuSpecialButtonLayout;
|
|||
import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout;
|
||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout;
|
||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class CreateSudokuActivity extends BaseActivity implements IFinalizeDialogFragmentListener {
|
||||
|
||||
|
@ -45,28 +40,18 @@ public class CreateSudokuActivity extends BaseActivity implements IFinalizeDialo
|
|||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
if (sharedPref.getBoolean("pref_dark_mode_setting", false )) {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
}
|
||||
|
||||
if(sharedPref.getBoolean("pref_keep_screen_on", true)) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
|
||||
gameController = new GameController(sharedPref, getApplicationContext());
|
||||
|
||||
if(sharedPref.getBoolean("pref_keep_screen_on", true)) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
GameType gameType = GameType.valueOf(extras.getString("gameType", GameType.Default_9x9.name()));
|
||||
int sectionSize = gameType.getSize();
|
||||
int boardSize = sectionSize * sectionSize;
|
||||
|
||||
GameInfoContainer container = new GameInfoContainer(0, GameDifficulty.Unspecified,
|
||||
GameInfoContainer container = new GameInfoContainer(0, GameDifficulty.Moderate,
|
||||
gameType, new int [boardSize], new int [boardSize], new boolean [boardSize][sectionSize]);
|
||||
gameController.loadLevel(container);
|
||||
|
||||
|
@ -126,16 +111,20 @@ public class CreateSudokuActivity extends BaseActivity implements IFinalizeDialo
|
|||
GameType gameType = gameController.getGameType();
|
||||
int boardSize = gameType.getSize() * gameType.getSize();
|
||||
String boardContent = gameController.getCodeOfField();
|
||||
|
||||
GameInfoContainer container = new GameInfoContainer(0, GameDifficulty.Unspecified,
|
||||
gameType, new int [boardSize], new int [boardSize], new boolean [boardSize][gameType.getSize()]);
|
||||
container.parseFixedValues(boardContent);
|
||||
//gameController.loadLevel(container);
|
||||
|
||||
QQWing verifier = new QQWing(gameType, GameDifficulty.Unspecified);
|
||||
verifier.setRecordHistory(true);
|
||||
verifier.setPuzzle(container.getFixedValues());
|
||||
boolean solvable = verifier.solve();
|
||||
verifier.solve();
|
||||
|
||||
if(solvable) {
|
||||
boolean distinctlySolvable = verifier.hasUniqueSolution();
|
||||
|
||||
if(distinctlySolvable) {
|
||||
Toast.makeText(CreateSudokuActivity.this, R.string.finished_verifying_custom_sudoku_toast, Toast.LENGTH_LONG).show();
|
||||
final Intent intent = new Intent(this, GameActivity.class);
|
||||
intent.setData(Uri.parse(GameActivity.URL_SCHEME_WITHOUT_HOST + "://" + boardContent));
|
||||
|
|
|
@ -147,7 +147,9 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
|
|||
difficultyCheck = new QQWing(container.getGameType(), GameDifficulty.Unspecified);
|
||||
difficultyCheck.setRecordHistory(true);
|
||||
difficultyCheck.setPuzzle(container.getFixedValues());
|
||||
startGame = difficultyCheck.solve();
|
||||
difficultyCheck.solve();
|
||||
|
||||
startGame = difficultyCheck.hasUniqueSolution();
|
||||
container.parseDifficulty(difficultyCheck.getDifficulty().toString());
|
||||
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
<item android:id="@+id/nav_newgame_main" android:icon="@drawable/ic_menu_home"
|
||||
android:title="@string/menu_main" />
|
||||
<item android:id="@+id/nav_dailySudoku_main" android:icon="@drawable/ic_menu_daily_sudoku"
|
||||
android:title="Daily Sudoku" />
|
||||
android:title="@string/menu_daily_sudoku" />
|
||||
<item android:id="@+id/nav_import_sudoku" android:icon="@android:drawable/ic_input_get"
|
||||
android:title="@string/menu_import_custom_sudoku"/>
|
||||
<item android:id="@+id/nav_highscore_main" android:icon="@android:drawable/ic_menu_myplaces"
|
||||
android:title="@string/menu_highscore" />
|
||||
<item android:id="@+id/menu_tutorial_main" android:icon="@drawable/ic_school_black_24dp"
|
||||
|
|
|
@ -106,10 +106,12 @@
|
|||
<string name="menu_tutorial">Tutorial</string>
|
||||
|
||||
<!-- ### DailySudokuActivity ###-->
|
||||
<string name="menu_daily_sudoku">Sudoku des Tages</string>
|
||||
<string name="finished_daily_sudoku">Du hast das Sudoku des Tages bereits gelöst.</string>
|
||||
<string name="daily_number_of_hints">Benutzte Hinweise</string>
|
||||
|
||||
<!-- ### Create custome sudoku ###-->
|
||||
<string name="menu_import_custom_sudoku">Sudoku importieren</string>
|
||||
<string name="finalize_custom_sudoku_dialog">Möchtest du dieses Sudoku fertigstellen?</string>
|
||||
<string name="verify_custom_sudoku_process_toast">Verifiziere Level…</string>
|
||||
<string name="finished_verifying_custom_sudoku_toast">Verifizierung abgeschlossen!</string>
|
||||
|
|
|
@ -162,11 +162,13 @@
|
|||
<string name="menu_tutorial">Tutorial</string>
|
||||
|
||||
<!-- ### DailySudokuActivity ###-->
|
||||
<string name="menu_daily_sudoku">Daily Sudoku</string>
|
||||
<string name="finished_daily_sudoku">You have already solved the sudoku of the day</string>
|
||||
<string name="daily_number_of_hints">Used hints</string>
|
||||
<string name="number_of_completed_games">Completed games</string>
|
||||
|
||||
<!-- ### Create custome sudoku ###-->
|
||||
<string name="menu_import_custom_sudoku">Import Sudoku</string>
|
||||
<string name="finalize_custom_sudoku_dialog">Do you wish to finalize this sudoku?</string>
|
||||
<string name="verify_custom_sudoku_process_toast">Verifying…</string>
|
||||
<string name="finished_verifying_custom_sudoku_toast">Done verifying!</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue