mozilla-mobile / fenix

⚠️ Fenix (Firefox for Android) moved to a new repository. It is now developed and maintained as part of: https://github.com/mozilla-mobile/firefox-android
https://github.com/mozilla-mobile/firefox-android
Mozilla Public License 2.0
6.47k stars 1.27k forks source link

Component to help with dynamic theming of UI widgets #13531

Closed data-sync-user closed 4 years ago

data-sync-user commented 4 years ago

In Fennec we have all those Themed* classes: https://searchfox.org/mozilla-central/search?q=&path=Themed*.java

Rocket is building something similar for "night mode": https://github.com/mozilla-tw/Rocket/tree/master/app/src/main/java/org/mozilla/rocket/nightmode/themed

Is there a better way? Can we dynamically change the Android theme of an app?

At the very least we could land the Themed* classes in a component - so that our other widgets can be based on them.

┆Issue is synchronized with this Jira Task

data-sync-user commented 4 years ago

➤ Sebastian Kaspari commented:

Can we dynamically change the Android theme of an app?

We can. But it always requires an activity restart to apply the configuration changes.

In WebView apps you do not want to restart because this would mean restoring/reloading the website. With GeckoView this seems to work fine. With the Session/View split we can recreate the activity and re-attach our previous session.