From 79b01e8eb99a978229d8b2f3154b4d38bf7d3382 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 31 Oct 2024 09:40:05 +0100 Subject: [PATCH] Allow beige background for Material You --- .../main/java/eu/faircode/email/ApplicationEx.java | 8 ++++++++ .../java/eu/faircode/email/FragmentDialogTheme.java | 13 ++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ApplicationEx.java b/app/src/main/java/eu/faircode/email/ApplicationEx.java index 4ee060630a..2deac33efb 100644 --- a/app/src/main/java/eu/faircode/email/ApplicationEx.java +++ b/app/src/main/java/eu/faircode/email/ApplicationEx.java @@ -1063,6 +1063,14 @@ public class ApplicationEx extends Application } } + if (version < 2243 && "a".equals(BuildConfig.REVISION)) { + boolean beige = prefs.getBoolean("beige", true); + String theme = prefs.getString("theme", "blue_orange_system"); + boolean you = theme.startsWith("you_"); + if (you && beige) + editor.putBoolean("beige", false); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG) editor.remove("background_service"); diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogTheme.java b/app/src/main/java/eu/faircode/email/FragmentDialogTheme.java index 054543fa9d..14fd8b6320 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogTheme.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogTheme.java @@ -663,11 +663,14 @@ public class FragmentDialogTheme extends FragmentDialogBase { Integer color = null; if (cards) { - if (you && (!dark || !black) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) - color = ContextCompat.getColor(context, dark - ? android.R.color.system_background_dark - : android.R.color.system_background_light); - else { + if (you && (!dark || !black) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + if (beige) + color = ContextCompat.getColor(context, R.color.lightColorBackground_cards_beige); + else + color = ContextCompat.getColor(context, dark + ? android.R.color.system_background_dark + : android.R.color.system_background_light); + } else { if (compose) { if (!dark || solarized) color = Helper.resolveColor(context, R.attr.colorCardBackground);