Chameleon
Chameleon copied to clipboard
Duplicate OnCreate on startup when theme is selected
🐛 Bug Report
When a theme is selected, MainActivity.OnCreate is called twice upon startup. That results in 2x initialization, and end result is that the RootPage will show a back button, which when tapped, goes back to an empty tab page.
Expected behavior
Don't initialize app twice when a theme is selected.
Reproduction steps
- Select a different theme than "Auto"
- Close app (properly)
- Open app again. 3.a. Back button should now be showing
- Tap back button
- Now you're stuck on an empty tab page, without being able to navigate further in the app. You have to close it and reopen.
Configuration
I only tested Android. Might be an issue on other platforms too.
Platform:
- [ ] :iphone: iOS
- [x] :robot: Android
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [ ] :monkey: Xamarin.Forms
I do believe it's the Activity.Recreate() in ThemeService.
I tried commenting out the following lines, and the issue disappeared (it's not a fix, I know, but locates the problem).
https://github.com/Baseflow/Chameleon/blob/fb194608e83b6a0d9d5070b90c16bc331950e4f8/Chameleon.Droid/ThemeService.cs#L66-L70