Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Disabled override how to use light/dark theme #33

Closed
tcqq opened this issue Apr 24, 2018 · 1 comment
Closed

Disabled override how to use light/dark theme #33

tcqq opened this issue Apr 24, 2018 · 1 comment

Comments

@tcqq
Copy link

tcqq commented Apr 24, 2018

@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
Copy link
Owner

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants