Skip to content

Commit

Permalink
Das Theme folgt jetzt standardmäßig dem System
Browse files Browse the repository at this point in the history
  • Loading branch information
amarradi committed Aug 24, 2023
1 parent a02773b commit 52ad5e2
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 65 deletions.
7 changes: 3 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ plugins {
}

android {


compileSdk 33
defaultConfig {
applicationId "com.git.amarradi.palatschinkencounter"
minSdkVersion 28
targetSdkVersion 33
versionCode 20
versionName "1.0.16"
versionCode 22
versionName "1.0.18"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences

public static final String SHARED_PREFS = "sharedPrefs";
public static final String COUNTER = "text";
public static final String NIGHT_MODE = "night_mode";
public static final String DESIGN_MODE = "system";

public static final String SCREENSHOT_PNG = "screenshot.png";
private static final int SCREEN_ORIENTATION_UNSPECIFIED = SCREEN_ORIENTATION_PORTRAIT;
private CoordinatorLayout coordinatorLayout;
Expand Down Expand Up @@ -100,7 +101,7 @@ protected void onCreate(Bundle savedInstanceState) {


SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
String themes = sharedPreferences.getString(NIGHT_MODE, "");
String themes = sharedPreferences.getString(DESIGN_MODE, "");
changeTheme(themes);
load_data();
updateViews();
Expand Down Expand Up @@ -193,7 +194,7 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
}

private void loadThemeFromPreference(SharedPreferences sharedPreferences) {
changeTheme(sharedPreferences.getString(getString(R.string.theme_key), getString(R.string.lightmode_preference_option_value)));
changeTheme(sharedPreferences.getString(getString(R.string.theme_key), getString(R.string.system_preference_option_value)));
}

private void changeTheme(String theme_value) {
Expand All @@ -202,23 +203,23 @@ private void changeTheme(String theme_value) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(NIGHT_MODE, theme_value);
editor.putString(DESIGN_MODE, theme_value);
editor.apply();
break;
}
case "darkmode": {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(NIGHT_MODE, theme_value);
editor.putString(DESIGN_MODE, theme_value);
editor.apply();
break;
}
case "system default": {
case "system": {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(NIGHT_MODE, theme_value);
editor.putString(DESIGN_MODE, theme_value);
editor.apply();
break;
}
Expand Down
8 changes: 3 additions & 5 deletions app/src/main/res/raw/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## [1.0.16] - 2023-08-18
kleine Fehler sind behoben worden
Gradle update
## Lizenzen
ckChangeLog - http://www.apache.org/licenses/LICENSE-2.0
## [1.0.18] - 2023-08-24

Das Theme folgt jetzt standardmäßig dem System
4 changes: 2 additions & 2 deletions app/src/main/res/values-de-rDE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@


<string name="theme_preference">Farbschema</string>
<string name="lightmode_preference_key">Hell (standard)</string>
<string name="lightmode_preference_key">Hell</string>
<string name="darkmode_preference_key">Dunkel</string>
<string name="system_preference_key">Systemstandard</string>
<string name="system_preference_key">Systemstandard (standard)</string>
<string name="item_share">Teilen</string>
<string name="share_with">Teilen mit</string>
<string name="ready_to_share">Bereit zum Teilen</string>
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
<resources>
<!-- Label ordering must match values -->
<array name="design_mode_preference_key">
<item>@string/system_preference_key</item>
<item>@string/lightmode_preference_key</item>
<item>@string/darkmode_preference_key</item>
<item>@string/system_preference_key</item>

</array>
<array name="design_mode_preference_value">
<item>@string/system_preference</item>
<item>@string/lightmode_preference</item>
<item>@string/darkmode_preference</item>
<item>@string/system_preference</item>

</array>
<!-- Ingredients -->

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<string name="lightmode_preference_option_value" translatable="false">lightmode</string>
<!-- Value in SharedPreferences for darkmode option -->
<string name="darkmode_preference_option_value" translatable="false">darkmode</string>
<!-- Value in SharedPreferences for system_preference option -->
<string name="system_preference_option_value" translatable="false">system</string>


<string name="cancel" tools:ignore="ButtonCase">NO</string>
Expand Down Expand Up @@ -108,10 +110,10 @@
<string name="theme_preference">Theme</string>
<string name="darkmode_preference" translatable="false">darkmode</string>
<string name="lightmode_preference" translatable="false">lightmode</string>
<string name="system_preference" translatable="false">system default</string>
<string name="system_preference" translatable="false">system</string>
<string name="lightmode_preference_key">lightmode</string>
<string name="darkmode_preference_key">darkmode</string>
<string name="system_preference_key">system standard</string>
<string name="system_preference_key">follow system (standard)</string>
<string name="change">Changelog of the current version and licence</string>
<string name="item_share">share</string>
<string name="share_with">share via</string>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/xml/changelog_master.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>
<release version="1.0.18" versioncode="22" >
<change>Das Theme folgt jetzt standardmäßig dem System</change>
</release>
<release version="1.0.17" versioncode="21" >
<change>kleine Fehler sind behoben worden</change>
</release>
<release version="1.0.16" versioncode="20" >
<change>kleine Fehler sind behoben worden</change>
<change>Gradle update</change>
Expand Down

This file was deleted.

0 comments on commit 52ad5e2

Please sign in to comment.