Disabled override how to use light/dark theme
tcqq opened this issue · 1 comments
tcqq commented
@garretyoder Dark/Light themeing will not work when override is disable, I try using "setCustomThemeOverride" to set it in style , when I changed Light to the Dark theme, but it will not change immediately, Only change after restarting the app. What did i do wrong? How should I correct it?
Code
Activity.java
Colorful().edit()
.setCustomThemeOverride(darkTheme ? R.style.AppThemeDark: R.style.AppTheme)
.apply(getContext(), () -> {
recreate();
return null;
});
BaseActivity.java
ColorfulKt.Colorful().apply(this, false, true);
Style.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>
<style name="AppThemeDark" parent="Theme.AppCompat.NoActionBar">
</style>
garretyoder commented
This is explained in the readme.
The override value will control whether Colorful overrides your activitie's existing base theme, or merely sets primary and accent colors. Note: dark/light themeing will not work when override is disabled