From 68b402fff78570b8466903276fbc1e3734c77870 Mon Sep 17 00:00:00 2001 From: ErikWaegerle Date: Wed, 1 Jul 2020 21:39:59 +0200 Subject: [PATCH 1/5] Inserting the pref_settings_general.xml-v29 file Allows to load the different layout files for different SDK versions. For SDK >= 29 pref_settings_general.xml-v29 --- .../res/xml-v29/pref_settings_general.xml | 102 ++++++++++++++++++ .../main/res/xml/pref_settings_general.xml | 14 +-- 2 files changed, 103 insertions(+), 13 deletions(-) create mode 100644 app/src/main/res/xml-v29/pref_settings_general.xml diff --git a/app/src/main/res/xml-v29/pref_settings_general.xml b/app/src/main/res/xml-v29/pref_settings_general.xml new file mode 100644 index 0000000..70ee3bf --- /dev/null +++ b/app/src/main/res/xml-v29/pref_settings_general.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_settings_general.xml b/app/src/main/res/xml/pref_settings_general.xml index f53c0cc..4db23b3 100644 --- a/app/src/main/res/xml/pref_settings_general.xml +++ b/app/src/main/res/xml/pref_settings_general.xml @@ -36,18 +36,6 @@ android:summary="@string/pref_dark_mode_summary" android:defaultValue="true"/> - - - - @@ -99,4 +87,4 @@ android:negativeButtonText="@null" android:positiveButtonText="@null" /> --> - + \ No newline at end of file From 9982c9f592d89dc1700fa4835b8e0d59f67d6936 Mon Sep 17 00:00:00 2001 From: ErikWaegerle Date: Tue, 7 Jul 2020 16:56:32 +0200 Subject: [PATCH 2/5] Adaptation of the GamePreferenceFragment class Modify the switches in the SettingsActivity If Dark Theme has been set manually, Dark Theme is displayed greyed out according to battery and system. Additionally it is only allowed to set one of both to the Dark theme, not both at the same time. --- .../ui/SettingsActivity.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java index f6c20fd..a3153d4 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java @@ -213,6 +213,22 @@ public class SettingsActivity extends AppCompatPreferenceActivity { addPreferencesFromResource(R.xml.pref_settings_general); setHasOptionsMenu(true); + + PreferenceManager preferenceManager = getPreferenceManager(); + SharedPreferences sp = preferenceManager.getSharedPreferences(); + + + if (sp.getBoolean("pref_dark_mode_setting", false)) { + //TwoStatePreference x = (TwoStatePreference) findPreference("pref_dark_mode_automatically_by_system"); + //x.setEnabled(false); + findPreference("pref_dark_mode_automatically_by_system").setEnabled(false); + findPreference("pref_dark_mode_automatically_by_battery").setEnabled(false); + } else { + + findPreference("pref_dark_mode_automatically_by_system").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_battery", false)); + findPreference("pref_dark_mode_automatically_by_battery").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_system", false)); + } + // Bind the summaries of EditText/List/Dialog/Ringtone preferences // to their values. When their values change, their summaries are // updated to reflect the new value, per the Android Design @@ -222,7 +238,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity { //bindPreferenceSummaryToValue(findPreference("example_list")); } - @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); From e25da314ff90d12d70067f73323bbeb2fd8ceb0c Mon Sep 17 00:00:00 2001 From: ErikWaegerle Date: Tue, 7 Jul 2020 18:15:49 +0200 Subject: [PATCH 3/5] bug fix Query the current SDK version to avoid complications when setting the switches in older versions. --- .../ui/SettingsActivity.java | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java index a3153d4..f749e46 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java @@ -217,27 +217,30 @@ public class SettingsActivity extends AppCompatPreferenceActivity { PreferenceManager preferenceManager = getPreferenceManager(); SharedPreferences sp = preferenceManager.getSharedPreferences(); + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - if (sp.getBoolean("pref_dark_mode_setting", false)) { - //TwoStatePreference x = (TwoStatePreference) findPreference("pref_dark_mode_automatically_by_system"); - //x.setEnabled(false); - findPreference("pref_dark_mode_automatically_by_system").setEnabled(false); - findPreference("pref_dark_mode_automatically_by_battery").setEnabled(false); - } else { + if (sp.getBoolean("pref_dark_mode_setting", false)) { + //TwoStatePreference x = (TwoStatePreference) findPreference("pref_dark_mode_automatically_by_system"); + //x.setEnabled(false); + findPreference("pref_dark_mode_automatically_by_system").setEnabled(false); + findPreference("pref_dark_mode_automatically_by_battery").setEnabled(false); + } else { + + findPreference("pref_dark_mode_automatically_by_system").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_battery", false)); + findPreference("pref_dark_mode_automatically_by_battery").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_system", false)); + } + + // Bind the summaries of EditText/List/Dialog/Ringtone preferences + // to their values. When their values change, their summaries are + // updated to reflect the new value, per the Android Design + // guidelines. + + //bindPreferenceSummaryToValue(findPreference("example_text")); + //bindPreferenceSummaryToValue(findPreference("example_list")); + + } - findPreference("pref_dark_mode_automatically_by_system").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_battery", false)); - findPreference("pref_dark_mode_automatically_by_battery").setEnabled(!sp.getBoolean("pref_dark_mode_automatically_by_system", false)); } - - // Bind the summaries of EditText/List/Dialog/Ringtone preferences - // to their values. When their values change, their summaries are - // updated to reflect the new value, per the Android Design - // guidelines. - - //bindPreferenceSummaryToValue(findPreference("example_text")); - //bindPreferenceSummaryToValue(findPreference("example_list")); - - } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); From aa4571a1249279d095ddb6f23d25a7ecf0df6782 Mon Sep 17 00:00:00 2001 From: ErikWaegerle Date: Tue, 7 Jul 2020 22:03:08 +0200 Subject: [PATCH 4/5] Adjusting the pref_help_general.xml add the finalize button and description (German and English) on the help activity --- app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/pref_help_general.xml | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index bf7fd65..af9e422 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -73,6 +73,8 @@ Berechtigungen Schaltet zwischen Notizen- und Werteingabe hin und her Notizen + Fertigstellen + Ist zur Bestätigung der Zahleneingabe im "Create Sudoku" Spielmodus Zeigt an, ob die korrekte Anzahl des Wertes im Spielfeld vorkommt. 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. Tastatur diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f40a3ff..d475097 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -138,6 +138,8 @@ Deletes a selected field Note toggle button Toggles if numbers should be set as notes or as values in a field + Finalize button + Is used to confirm the numeric input in the create sudoku game mode Privacy Info Permissions Privacy Friendly Sudoku does not use any permissions. diff --git a/app/src/main/res/xml/pref_help_general.xml b/app/src/main/res/xml/pref_help_general.xml index 7b711e4..16300d3 100644 --- a/app/src/main/res/xml/pref_help_general.xml +++ b/app/src/main/res/xml/pref_help_general.xml @@ -34,6 +34,10 @@ android:selectable="false" android:icon="@drawable/ic_create_black_48dp" android:summary="@string/help_notes_summary"/> + From 92f2730265678f4f1651209b3ce0679057149719 Mon Sep 17 00:00:00 2001 From: ErikWaegerle Date: Tue, 7 Jul 2020 22:45:32 +0200 Subject: [PATCH 5/5] Modify the activity_daily_sudoku.xml/strings.xml Adjust the text gravity to center and add the German translation --- app/src/main/res/layout/activity_daily_sudoku.xml | 1 + app/src/main/res/values-de/strings.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_daily_sudoku.xml b/app/src/main/res/layout/activity_daily_sudoku.xml index b691388..13f345c 100644 --- a/app/src/main/res/layout/activity_daily_sudoku.xml +++ b/app/src/main/res/layout/activity_daily_sudoku.xml @@ -166,6 +166,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="2" + android:gravity="center" android:text="@string/number_of_completed_games" /> Sudoku des Tages Du hast das Sudoku des Tages bereits gelöst. Benutzte Hinweise - + Abgeschlossene
Spiele
Sudoku importieren Möchtest du dieses Sudoku fertigstellen?