From 8995626d167fe97bd161c245625db2d9b002c1d2 Mon Sep 17 00:00:00 2001 From: Alexander Bakker Date: Wed, 13 Mar 2024 23:18:18 +0100 Subject: [PATCH] Apply dark background colors when combining AMOLED and dynamic colors Previously, the dark background colors would not be applied for this combination of settings. Unfortunately, I couldn't find a way to avoid some duplication in themes.xml. --- .../com/beemdevelopment/aegis/ui/AegisActivity.java | 7 ++++++- app/src/main/res/values/themes.xml | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java b/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java index 7f012701..e18155d3 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java @@ -26,6 +26,7 @@ import com.beemdevelopment.aegis.icons.IconPackManager; import com.beemdevelopment.aegis.vault.VaultManager; import com.beemdevelopment.aegis.vault.VaultRepositoryException; import com.google.android.material.color.DynamicColors; +import com.google.android.material.color.DynamicColorsOptions; import com.google.android.material.color.MaterialColors; import java.lang.reflect.Field; @@ -122,7 +123,11 @@ public abstract class AegisActivity extends AppCompatActivity implements VaultMa setTheme(theme); if (_prefs.isDynamicColorsEnabled()) { - DynamicColors.applyToActivityIfAvailable(this); + DynamicColorsOptions.Builder optsBuilder = new DynamicColorsOptions.Builder(); + if (getConfiguredTheme().equals(Theme.AMOLED)) { + optsBuilder.setThemeOverlay(R.style.ThemeOverlay_Aegis_Dynamic_Amoled); + } + DynamicColors.applyToActivityIfAvailable(this, optsBuilder.build()); } } diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index e7268f0b..6c1884d5 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -148,6 +148,19 @@ #000000 + +