Skip to content

Commit 8995626

Browse files
committed
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.
1 parent cffe157 commit 8995626

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.beemdevelopment.aegis.vault.VaultManager;
2727
import com.beemdevelopment.aegis.vault.VaultRepositoryException;
2828
import com.google.android.material.color.DynamicColors;
29+
import com.google.android.material.color.DynamicColorsOptions;
2930
import com.google.android.material.color.MaterialColors;
3031

3132
import java.lang.reflect.Field;
@@ -122,7 +123,11 @@ protected void setTheme(Map<Theme, Integer> themeMap) {
122123
setTheme(theme);
123124

124125
if (_prefs.isDynamicColorsEnabled()) {
125-
DynamicColors.applyToActivityIfAvailable(this);
126+
DynamicColorsOptions.Builder optsBuilder = new DynamicColorsOptions.Builder();
127+
if (getConfiguredTheme().equals(Theme.AMOLED)) {
128+
optsBuilder.setThemeOverlay(R.style.ThemeOverlay_Aegis_Dynamic_Amoled);
129+
}
130+
DynamicColors.applyToActivityIfAvailable(this, optsBuilder.build());
126131
}
127132
}
128133

app/src/main/res/values/themes.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,19 @@
148148
<item name="colorSurfaceBright">#000000</item>
149149
</style>
150150

151+
<style name="ThemeOverlay.Aegis.Dynamic.Amoled" parent="ThemeOverlay.Material3.DynamicColors.Dark">
152+
<item name="android:colorBackground">#000000</item>
153+
<item name="colorSurface">#000000</item>
154+
<item name="colorSurfaceVariant">#000000</item>
155+
<item name="colorSurfaceContainerHighest">#000000</item>
156+
<item name="colorSurfaceContainerHigh">#000000</item>
157+
<item name="colorSurfaceContainer">#000000</item>
158+
<item name="colorSurfaceContainerLow">#000000</item>
159+
<item name="colorSurfaceContainerLowest">#000000</item>
160+
<item name="colorSurfaceDim">#000000</item>
161+
<item name="colorSurfaceBright">#000000</item>
162+
</style>
163+
151164
<style name="Theme.Aegis.Light" parent="Base.Theme.Aegis.Light">
152165
</style>
153166
<style name="Theme.Aegis.Light.Fullscreen" parent="Theme.Aegis.Light">

0 commit comments

Comments
 (0)