From ad0e77ecc6eba315888d106156e3ebda7e3247fc Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 9 Sep 2019 11:40:14 +0200 Subject: [PATCH] Added grey system theme --- .../java/eu/faircode/email/ActivityBase.java | 7 + .../email/FragmentOptionsDisplay.java | 6 + app/src/main/res/layout/dialog_theme.xml | 122 ++++++++++-------- app/src/main/res/values/strings.xml | 1 + 4 files changed, 82 insertions(+), 54 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index 6e8cbf24d3..f24c735e95 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -87,6 +87,13 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc Log.i("UI mode=" + uiMode); if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0) setTheme(R.style.AppThemeBlack); + } else if ("grey_system".equals(theme)) { + int uiMode = getResources().getConfiguration().uiMode; + Log.i("UI mode=" + uiMode); + if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0) + setTheme(R.style.AppThemeGreyDark); + else + setTheme(R.style.AppThemeGreyLight); } } diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index 0f4c396488..4c99241991 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -401,6 +401,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer case "system": rgTheme.check(R.id.rbThemeSystem); break; + case "grey_system": + rgTheme.check(R.id.rbThemeGreySystem); + break; default: rgTheme.check(R.id.rbThemeLight); } @@ -429,6 +432,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer case R.id.rbThemeSystem: prefs.edit().putString("theme", "system").apply(); break; + case R.id.rbThemeGreySystem: + prefs.edit().putString("theme", "grey_system").apply(); + break; } } }); diff --git a/app/src/main/res/layout/dialog_theme.xml b/app/src/main/res/layout/dialog_theme.xml index 953770d503..cdecd3c266 100644 --- a/app/src/main/res/layout/dialog_theme.xml +++ b/app/src/main/res/layout/dialog_theme.xml @@ -1,69 +1,83 @@ - - + android:layout_height="wrap_content"> - + android:orientation="vertical" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + - + - + - + - - - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 92b083cc4d..f82a11ef12 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -185,6 +185,7 @@ Grey light theme Grey dark theme System theme + Grey system theme Advanced Options