diff --git a/app/build.gradle b/app/build.gradle
index 8f24f1c4..2e1a9b5f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -15,8 +15,8 @@ android {
applicationId "org.secuso.privacyfriendlysudoku"
minSdkVersion 17
targetSdkVersion 34
- versionCode 16
- versionName "3.2.1"
+ versionCode 17
+ versionName "3.2.2"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
}
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GeneratorService.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GeneratorService.java
index 62044b3e..1637c25e 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GeneratorService.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GeneratorService.java
@@ -81,6 +81,10 @@ private void buildGenerationList() {
for(GameType validType : GameType.getValidGameTypes()) {
for(GameDifficulty validDifficulty : GameDifficulty.getValidDifficultyList()) {
+ // currently it's extremely unlikely to generate 16x16 easier than hard
+ if (validType.equals(GameType.Default_16x16) && (validDifficulty.equals(GameDifficulty.Easy) || validDifficulty.equals(GameDifficulty.Moderate))) {
+ continue;
+ }
int levelCount = dbHelper.getLevels(validDifficulty, validType).size();
Log.d(TAG, "\tType: "+ validType.name() + " Difficulty: " + validDifficulty.name() + "\t: " + levelCount);
// add the missing levels to the list
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/NewLevelManager.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/NewLevelManager.java
index 32d23ac1..24ffbb45 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/NewLevelManager.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/NewLevelManager.java
@@ -77,6 +77,9 @@ private NewLevelManager(Context context, SharedPreferences settings) {
public boolean isLevelLoadable(GameType type, GameDifficulty diff) {
return dbHelper.getLevels(diff, type).size() > 0;
}
+ public int getCountAvailableLevels(GameType type, GameDifficulty diff) {
+ return dbHelper.getLevels(diff, type).size();
+ }
@Deprecated
public boolean isLevelLoadableOld(GameType type, GameDifficulty diff) {
diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java
index 0b54dc9e..31ecd6f1 100644
--- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java
+++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java
@@ -147,6 +147,12 @@ public void onPageScrolled(int position, float positionOffset, int positionOffse
public void onPageSelected(int position) {
arrowLeft.setVisibility((position==0)?View.INVISIBLE:View.VISIBLE);
arrowRight.setVisibility((position==mSectionsPagerAdapter.getCount()-1)?View.INVISIBLE:View.VISIBLE);
+
+ GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem());
+ int index = difficultyBar.getProgress()-1;
+ GameDifficulty gameDifficulty = GameDifficulty.getValidDifficultyList().get(index < 0 ? 0 : index);
+ ((TextView) findViewById(R.id.level_count))
+ .setText(String.format(getString(R.string.levels_available), newLevelManager.getCountAvailableLevels(gameType, gameDifficulty)));
}
@Override
@@ -167,11 +173,30 @@ public void onPageScrollStateChanged(int state) {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
createGameBar.setChecked(false);
- ((Button) findViewById(R.id.playButton)).setText(R.string.new_game);
+ Button button = findViewById(R.id.playButton);
+ button.setText(R.string.new_game);
if (rating >= 1) {
+ GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem());
+ int index = difficultyBar.getProgress()-1;
+ GameDifficulty gameDifficulty = GameDifficulty.getValidDifficultyList().get(index < 0 ? 0 : index);
+ if (gameType == GameType.Default_16x16 && rating <= 2) {
+ button.setEnabled(false);
+ button.setText(R.string.game_config_unsupported);
+ button.setBackgroundResource(R.drawable.button_inactive);
+ } else {
+ button.setEnabled(true);
+ button.setText(R.string.new_game);
+ button.setBackgroundResource(R.drawable.button_standalone);
+ }
+
+ ((TextView) findViewById(R.id.level_count))
+ .setText(String.format(getString(R.string.levels_available), newLevelManager.getCountAvailableLevels(gameType, gameDifficulty)));
+
difficultyText.setText(getString(difficultyList.get((int) ratingBar.getRating() - 1).getStringResID()));
} else {
+ button.setEnabled(true);
+ button.setBackgroundResource(R.drawable.button_standalone);
difficultyText.setText(R.string.difficulty_custom);
createGameBar.setChecked(true);
((Button)findViewById(R.id.playButton)).setText(R.string.create_game);
@@ -179,6 +204,11 @@ public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser)
}
});
+ GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem());
+ GameDifficulty gameDifficulty = GameDifficulty.getValidDifficultyList().get(index < 0 ? 0 : index);
+ ((TextView) findViewById(R.id.level_count))
+ .setText(String.format(getString(R.string.levels_available), newLevelManager.getCountAvailableLevels(gameType, gameDifficulty)));
+
createGameBar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml
index 39c22732..865033ee 100644
--- a/app/src/main/res/layout/activity_main_menu.xml
+++ b/app/src/main/res/layout/activity_main_menu.xml
@@ -100,6 +100,12 @@
android:layout_width="wrap_content"
android:text="@string/difficulty_easy"
android:textSize="@dimen/main_text_difficulty"/>
+
Löscht das ausgewählte Feld
Löschen
Privatsphäre Information
- Zeit deaktivieren
+ Deaktiviere die Zeitmessung beim Spielen. Spiele ohne Zeitmessung werden nicht in die Statistiken aufgenommen.
Zeit zurücksetzen
Beim zurücksetzen des Spielfeldes wird die Zeit auch zurückgesetzt.
Okay
@@ -129,5 +129,7 @@
Verifizierung abgeschlossen!
Verifizierung fehlgeschlagen: Dein Sudoku kann nicht gelöst werden.
Zeit deaktivieren
+ Diese Spielkombination ist momentan nicht unterstützt.
+ Levels verfügbar: %d
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8939e4f8..bb6ab1ea 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -204,5 +204,7 @@
Only download attachments when manually requested
Sudoku 16x16
+ This game combination is currently not supported.
+ Levels available: %d