-
Notifications
You must be signed in to change notification settings - Fork 66
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
Daylight theme is not updated when app is launched #32
Comments
In the demo application, I have added the Light-Dark theme and it works when you switch the theme without any problems. Can you check that please if your case is the same? |
I've just tried the sample app and I can confirm it suffers the same issue. Like me, you are settings When the dark mode is changed on the system wide, and the app is launched, the activity theme is not updated. When I don't use the library (replace LocaleAwareApplication by Application) it's working well. |
Just for the last sentence |
Yep sorry (I've updated my comment) |
So the case is that the app is running and backgrounded, then you go the system settings and make the theme Dark there, and you restore the app from the recents, and the app couldn't pick up the new configuration change ? |
How the language is changing without using the library in the second gif :) ? OK, I will address the issue soon. Also feel free to send a PR if you know the solution already. |
The language is not changing without the library haha, that was just to illustrate how it works without the library ^^ I'd love to help you by opening a PR but I don't have enough knowledges on the subject to fix it :/ |
I can confirm this issue. Actually I was using another library for Locale changing and it has the same problem: franmontiel/LocaleChanger#20 |
I can confirm this issue two. |
I found this comment in
As you use |
BTW: I implemented super stupid fix. In class override fun attachBaseContext2(originalContext: Context): Context {
val originalUiMode = originalContext.resources.configuration.uiMode
val appCompatDelegateContext = super.attachBaseContext2(originalContext)
val superDelegateContext = superDelegate.attachBaseContext2(appCompatDelegateContext)
val wrappedContext = wrap(superDelegateContext)
val fixedWrappedContext = wrappedContext.createConfigurationContext(wrappedContext.resources.configuration.apply {
this.uiMode = originalUiMode
})
return fixedWrappedContext
} I don't think the fix is right (it looks stupid to me) but I may fix the problem. And introduce new-hard-to-find bugs. |
Hmm, fix above is not correct solution. |
Code needs polishing
That's a crazy issue... If you know a library that handle correctly this theme change let me know :) |
Hello, me again :)
I've noticed that by using the library, when the app is already launched and the the dark theme is switched on or off, the app keep his current theme until the app killed and launched again. Do you know a way to "refresh" the UI when the setting is changed?
In the meantime I'd like to thank you a lot for your awesome library that helps a lot !
The text was updated successfully, but these errors were encountered: