From 5229f4df3fe4eb90febfcd375217075952ff4390 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 16 Aug 2019 12:14:20 +0200 Subject: [PATCH] Refactoring --- .../main/java/eu/faircode/email/ActivityBase.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index d474792d3b..fc5d765104 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -70,17 +70,18 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (!this.getClass().equals(ActivityMain.class)) { - String theme = prefs.getString("theme", null); - if ("system".equals(theme)) { + String theme = prefs.getString("theme", "light"); + + if ("dark".equals(theme)) + setTheme(R.style.AppThemeDark); + else if ("black".equals(theme)) + setTheme(R.style.AppThemeBlack); + else if ("system".equals(theme)) { int uiMode = getResources().getConfiguration().uiMode; Log.i("UI mode=" + uiMode); if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0) setTheme(R.style.AppThemeBlack); } - if ("dark".equals(theme)) - setTheme(R.style.AppThemeDark); - else if ("black".equals(theme)) - setTheme(R.style.AppThemeBlack); } prefs.registerOnSharedPreferenceChangeListener(this);