is it currently possible to set up theme, without ...
# compose
p
is it currently possible to set up theme, without using xml-theming at all? For example, I currently have to use xml theme with statusBarColor and primaryColor stuff set, otherwise colors are different, before activities start. I'm using accompanist to set up system bar colors tough
a
No, the static theme is used by the system to show part of your app startup before your code even has a chance to run. Loading your app code is part of what takes a while and the system showing this part of the app startup on your behalf is what keeps your app launch feeling more responsive
There may be variants in the future that don't strictly use xml as the developer-facing declaration mechanism, but it will need to be determined at build time, not runtime
p
I see, thank you for explaining! Hope I would be able to do this in future, since declaring theme on two places is not ideal atm.
a
you can take a look at things like the material theme converters to read your xml themes into compose at runtime to address the single source of truth part, it won't help the being xml part though 🙂
👍 1
the mechanism used is
context.obtainStyledAttributes
under the hood
we decided to take a wait and see approach here in terms of what people end up wanting/needing, whether that's the full mdc-android stuff, appcompat, or just android framework theme attributes and styles. Different apps will need different things and if we offered all of the possible options it could get super confusing
👍 1