Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix of Night theme handling #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thubalek
Copy link

@thubalek thubalek commented Dec 7, 2021

Closed #32

There was incorrect handling of Day/Night theme in the app. Root cause was calling superDelegate.attachBaseContext2() in method androidx.appcompat.app.LocaleHelperAppCompatDelegate#attachBaseContext2

@tgvoskuilen
Copy link

I tried this fix out in several different API levels and it doesn't seem to work properly. Before the fix, none of the app colors would change when the system dark/light mode changed. With this change, some of the app changes, but other parts like the toolbar and CardViews stay with the old color theme (which honestly looks worse than just having nothing change at all).

My "fix" for this so far has been to add a switch in Application::attachBaseContext so that dark/light auto-switching is only broken for those who have actually selected a non-default language setting at least.

override fun attachBaseContext(base: Context) {
    if( LocaleHelper.hasLocaleSelection(base)) {
        super.attachBaseContext(localeAppDelegate.attachBaseContext(base))
    }
    else {
        super.attachBaseContext(base)
    }
}

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

Successfully merging this pull request may close these issues.

Daylight theme is not updated when app is launched
2 participants