-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Android no longer reacts to system theme change #16241
Comments
Android seems to have a weird behavior concerning theme "ownership". If the app sets their app theme with AppCompatDelegate.DefaultNightMode to NightModeYes/No, the system no longer manages theming for the app, and only Activity.OnConfigurationChanged will be called for the app to detect system theme change. As at now, we have 2 PlatformThemeVariants, Dark and Light. There is no Default or System variant that would reset the app theme to the system one. Android saves the last NightMode for the app and applies it when the Activity is created, unless the app is newly installed, the RequestedThemeVariant usually set in App.xaml will be ignored on Android 12. This is due to requesting the systems/app theme accents here;
which will also forward the saved NightMode to the app. So the current issues are as follows;
@maxkatz6 any thoughts? We could add a Default/System PlatformThemeVariant to restore system theme. |
@emmauss we don't have PlatformThemeVariant.Default/System, because framework explicitly expects a specific value from the OS to be reported from the platform settings API -
But also, ideally, if theme wasn't changed, we shouldn't override any system value. |
There's also one more issue. When you remove |
That's because of the activity being restarted because of an unhandled config change. We should handle it, but it seems to be broken |
Thanks for your contribution! But since the pull request has not been merged yet, is there any way to respond to android theme changes while still using the official Avalonia package? |
Describe the bug
@emmauss
To Reproduce
https://github.com/kerams/theme
Pull down the status bar and change theme, notice the application theme changes accordingly. Repeat with version 11.2.999-cibuild0049782-alpha and observe application theme does not change.
Expected behavior
No response
Avalonia version
11.2.999-cibuild0049474-alpha, 11.2.999-cibuild0049782-alpha
OS
Android
The text was updated successfully, but these errors were encountered: