Merge branch 'Sudoku-v3.0' of https://github.com/SecUSo/privacy-friendly-sudoku into Sudoku-v3.0

This commit is contained in:
ErikWaegerle 2020-08-29 13:49:28 +02:00
commit f09028feed
5 changed files with 40 additions and 15 deletions

View file

@ -83,10 +83,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
settings = PreferenceManager.getDefaultSharedPreferences(this); settings = PreferenceManager.getDefaultSharedPreferences(this);
if (settings.getBoolean("pref_dark_mode_setting", false )) { if (settings.getBoolean("pref_dark_mode_setting", false )) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
@ -100,6 +96,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} }
super.onCreate(savedInstanceState);
NewLevelManager newLevelManager = NewLevelManager.getInstance(getApplicationContext(), settings); NewLevelManager newLevelManager = NewLevelManager.getInstance(getApplicationContext(), settings);
// check if we need to pre generate levels. // check if we need to pre generate levels.
@ -169,12 +167,14 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
@Override @Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) { public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
createGameBar.setChecked(false); createGameBar.setChecked(false);
((Button) findViewById(R.id.playButton)).setText("New Game"); ((Button) findViewById(R.id.playButton)).setText(R.string.new_game);
if (rating >= 1) { if (rating >= 1) {
difficultyText.setText(getString(difficultyList.get((int) ratingBar.getRating() - 1).getStringResID())); difficultyText.setText(getString(difficultyList.get((int) ratingBar.getRating() - 1).getStringResID()));
} else { } else {
difficultyText.setText("Custom Sudoku"); difficultyText.setText(R.string.difficulty_custom);
createGameBar.setChecked(true);
((Button)findViewById(R.id.playButton)).setText(R.string.create_game);
} }
} }
}); });
@ -185,13 +185,21 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
if (isChecked) { if (isChecked) {
difficultyBar.setRating(0); difficultyBar.setRating(0);
((Button)findViewById(R.id.playButton)).setText("Create"); ((Button)findViewById(R.id.playButton)).setText(R.string.create_game);
} }
createGameBar.setChecked(isChecked); createGameBar.setChecked(isChecked);
}}); }});
GameDifficulty lastChosenDifficulty = GameDifficulty.valueOf(settings.getString("lastChosenDifficulty", "Moderate")); String retrievedDifficulty = settings.getString("lastChosenDifficulty", "Moderate");
//difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(lastChosenDifficulty) + 1); GameDifficulty lastChosenDifficulty = GameDifficulty.valueOf(
retrievedDifficulty.equals("Custom")? GameDifficulty.Unspecified.toString() : retrievedDifficulty);
if (lastChosenDifficulty == GameDifficulty.Unspecified) {
difficultyBar.setRating(0);
createGameBar.setChecked(true);
} else {
difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(lastChosenDifficulty) + 1);
}
/*LayerDrawable stars = (LayerDrawable)difficultyBar.getProgressDrawable(); /*LayerDrawable stars = (LayerDrawable)difficultyBar.getProgressDrawable();
stars.getDrawable(2).setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.SRC_ATOP);//Color for Stars fully selected stars.getDrawable(2).setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.SRC_ATOP);//Color for Stars fully selected
stars.getDrawable(1).setColorFilter(getResources().getColor(R.color.middleblue), PorterDuff.Mode.SRC_ATOP);//Color for Stars partially selected stars.getDrawable(1).setColorFilter(getResources().getColor(R.color.middleblue), PorterDuff.Mode.SRC_ATOP);//Color for Stars partially selected
@ -243,9 +251,14 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
case R.id.playButton: case R.id.playButton:
GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem()); GameType gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem());
if (((CheckBox)findViewById(R.id.circleButton)).isChecked()) { if (((CheckBox)findViewById(R.id.circleButton)).isChecked()) {
// send everything to game activity // start CreateSudokuActivity
i = new Intent(this, CreateSudokuActivity.class); i = new Intent(this, CreateSudokuActivity.class);
i.putExtra("gameType", gameType.name()); i.putExtra("gameType", gameType.name());
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastChosenGameType", gameType.name());
editor.putString("lastChosenDifficulty", "Custom");
editor.apply();
//i.putExtra("gameDifficulty", GameDifficulty.Easy); //i.putExtra("gameDifficulty", GameDifficulty.Easy);
break; break;
} }

View file

@ -7,25 +7,27 @@
<string name="menu_main">Hauptmenü</string> <string name="menu_main">Hauptmenü</string>
<string name="menu_help">Hilfe</string> <string name="menu_help">Hilfe</string>
<string name="menu_about">Über</string> <string name="menu_about">Über</string>
<string name="create_game">Spiel erstellen</string>
<!-- Strings related to Settings --> <!-- Strings related to Settings -->
<string name="title_activity_settings">Einstellungen</string> <string name="title_activity_settings">Einstellungen</string>
<string name="pref_dark_mode">Nachtmodus</string> <string name="pref_dark_mode">Nachtmodus</string>
<string name="pref_dark_mode_setting">Nachtmodus</string> <string name="pref_dark_mode_setting">Nachtmodus</string>
<string name="pref_dark_mode_summary">Wechsel zwischen Tages und Nacht Modus</string> <string name="pref_dark_mode_summary">Wechsel zwischen Tages- und Nacht-Modus</string>
<!-- About Page --> <!-- About Page -->
<string name="about_affiliation">In Zusammenarbeit mit:</string> <string name="about_affiliation">In Zusammenarbeit mit:</string>
<string name="about_author">Autoren:</string> <string name="about_author">Autoren:</string>
<string name="version_number">Version:</string> <string name="version_number">Version:</string>
<string name="about_author_contributors">und Mitwirkende.</string> <string name="about_author_contributors">und Mitwirkende.</string>
<string name="privacy_friendly">Diese App gehört zur Gruppe der Privacy Friendly Apps entwickelt von der Technischen Universität Darmstadt. Quelltext lizenziert unter GPLv3. Bilder copyright TU Darmstadt und Google Inc.</string> <string name="privacy_friendly">Diese App gehört zur Gruppe der Privacy Friendly Apps entwickelt von dem Karlsruher Institut für Technologie (KIT). Quelltext lizenziert unter GPLv3. Bilder copyright KIT und Google Inc.</string>
<string name="more_info">Weitere Infos unter:</string> <string name="more_info">Weitere Infos unter:</string>
<!-- ###GameDifficulty### --> <!-- ###GameDifficulty### -->
<string name="difficulty_easy">Leicht</string> <string name="difficulty_easy">Leicht</string>
<string name="difficulty_moderate">Normal</string> <string name="difficulty_moderate">Normal</string>
<string name="difficulty_hard">Schwer</string> <string name="difficulty_hard">Schwer</string>
<string name="difficulty_custom">Benutzerdefiniert</string>
<string name="about_qqwing">Diese App benutzt eine modifizierte Version des QQWing v1.3.4.</string> <string name="about_qqwing">Diese App benutzt eine modifizierte Version des QQWing v1.3.4.</string>
<string name="average_time">Ø-Zeit:</string> <string name="average_time">Ø-Zeit:</string>
<string name="cancel">Abbrechen</string> <string name="cancel">Abbrechen</string>
@ -74,7 +76,9 @@
<string name="help_notes_summary">Schaltet zwischen Notizen- und Werteingabe hin und her</string> <string name="help_notes_summary">Schaltet zwischen Notizen- und Werteingabe hin und her</string>
<string name="help_notes">Notizen</string> <string name="help_notes">Notizen</string>
<string name="finalize">Fertigstellen</string> <string name="finalize">Fertigstellen</string>
<string name="finalize_summary">Ist zur Bestätigung der Zahleneingabe im "Create Sudoku" Spielmodus </string> <string name="finalize_summary">Bestätigt die Zahleneingabe beim Erstellen eines benutzerdefinierten Sudokus </string>
<string name="help_import">Importieren</string>
<string name="help_import_summary">Importiert beim Erstellen eines benutzerdefinierten Sudokus ein neues, editierbares Sudoku-Feld.\nWarnung: Durch den Import werden alle zuvor eingetragenen Felder unwiderruflich überschrieben. </string>
<string name="help_keyhighlighted_yellow_summary">Zeigt an, ob die korrekte Anzahl des Wertes im Spielfeld vorkommt.</string> <string name="help_keyhighlighted_yellow_summary">Zeigt an, ob die korrekte Anzahl des Wertes im Spielfeld vorkommt.</string>
<string name="help_keyhighlighted_summary">Zeigt an, dass der Wert ausgewählt ist. Jede Berührung eines Feldes setzt in diesem Modus die Zahl direkt, ohne das Feld vorher auszuwählen.</string> <string name="help_keyhighlighted_summary">Zeigt an, dass der Wert ausgewählt ist. Jede Berührung eines Feldes setzt in diesem Modus die Zahl direkt, ohne das Feld vorher auszuwählen.</string>
<string name="help_keyboard">Tastatur</string> <string name="help_keyboard">Tastatur</string>

View file

@ -52,7 +52,7 @@
<string name="about_author_contributors">と貢献者。</string> <string name="about_author_contributors">と貢献者。</string>
<string name="version_number">バージョン</string> <string name="version_number">バージョン</string>
<string name="about_affiliation">提携</string> <string name="about_affiliation">提携</string>
<string name="privacy_friendly">このアプリケーションは、ダルムシュタット工科大学 (Technische Universität Darmstadt, Germany) が開発したプライバシーフレンドリーアプリのグループに属しています。 ソースコードは GPLv3 の下でライセンスされます。画像の著作権は TU Darmstadt および Google Inc.</string> <string name="privacy_friendly">このアプリケーションは、カールスルーエ工科大学 (Karlsruher Institut für Technologie(KIT), Germany) が開発したプライバシーフレンドリーアプリのグループに属しています。 ソースコードは GPLv3 の下でライセンスされます。画像の著作権は KIT および Google Inc.</string>
<string name="more_info">さらに詳しい情報は以下でご覧ください:</string> <string name="more_info">さらに詳しい情報は以下でご覧ください:</string>
<string name="about_qqwing">このアプリケーションは QQWing v1.3.4 の修正版を使用しています</string> <string name="about_qqwing">このアプリケーションは QQWing v1.3.4 の修正版を使用しています</string>

View file

@ -14,6 +14,7 @@
<string name="menu_reset">Reset Board</string> <string name="menu_reset">Reset Board</string>
<string name="menu_share">Share Board</string> <string name="menu_share">Share Board</string>
<string name="menu_continue_game">Continue Game</string> <string name="menu_continue_game">Continue Game</string>
<string name="create_game">Create Game</string>
<string name="navigation_drawer_open" translatable="false">Open navigation drawer</string> <string name="navigation_drawer_open" translatable="false">Open navigation drawer</string>
<string name="navigation_drawer_close" translatable="false">Close navigation drawer</string> <string name="navigation_drawer_close" translatable="false">Close navigation drawer</string>
@ -82,6 +83,7 @@
<string name="difficulty_easy">Easy</string> <string name="difficulty_easy">Easy</string>
<string name="difficulty_moderate">Moderate</string> <string name="difficulty_moderate">Moderate</string>
<string name="difficulty_hard">Hard</string> <string name="difficulty_hard">Hard</string>
<string name="difficulty_custom">Custom</string>
<!--###GameActivity --> <!--###GameActivity -->
<string name="Sudoku" translatable="false">Sudoku</string> <string name="Sudoku" translatable="false">Sudoku</string>
@ -140,7 +142,9 @@
<string name="help_notes">Note toggle button</string> <string name="help_notes">Note toggle button</string>
<string name="help_notes_summary">Toggles if numbers should be set as notes or as values in a field</string> <string name="help_notes_summary">Toggles if numbers should be set as notes or as values in a field</string>
<string name="finalize">Finalize button</string> <string name="finalize">Finalize button</string>
<string name="finalize_summary">Is used to confirm the numeric input in the create sudoku game mode </string> <string name="finalize_summary">Confirms the numeric input in the create sudoku game mode </string>
<string name="help_import">Import button</string>
<string name="help_import_summary">Imports a new, customizable sudoku field into the create sudoku game mode.\nWarning: this will override the entire field and its old values cannot be recovered.</string>
<string name="help_privacyInfo">Privacy Info</string> <string name="help_privacyInfo">Privacy Info</string>
<string name="help_permissions">Permissions</string> <string name="help_permissions">Permissions</string>
<string name="help_permissions_summary">Privacy Friendly Sudoku does not use any permissions.</string> <string name="help_permissions_summary">Privacy Friendly Sudoku does not use any permissions.</string>

View file

@ -38,6 +38,10 @@
android:selectable="false" android:selectable="false"
android:icon="@drawable/ic_finalize" android:icon="@drawable/ic_finalize"
android:summary="@string/finalize_summary"/> android:summary="@string/finalize_summary"/>
<Preference android:title="@string/help_import"
android:selectable="false"
android:icon="@drawable/ic_import"
android:summary="@string/help_import_summary"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/help_privacyInfo"> <PreferenceCategory android:title="@string/help_privacyInfo">