# compose

Amirul Zin

08/07/2019, 6:11 AM
Hi all. I’ve been Googling around but can’t seem to find an answer for this. Does JetPack compose support (or planning to support) resource qualifiers? Something that is currently easy to do in Android is supporting multiple configurations e.g. density based, RTL layouts, localizations etc. Powered by DataBinding null-aware inflation, this made supporting all this configurations quite trivial to implement. If it wasn’t supported, maybe something of the below (haven’t look thru the Compose code yet) would work?:
Copy code
fun someView(){
Or maybe just pass in the current qualifiers to the composable function? If I got off the wrong starting point, please enlighten me. Thanks!


08/07/2019, 12:54 PM
We're still identifying which patterns make the most sense with regards to supporting multiple configurations, so details are still TBD. Whereas XML layouts were relatively static (requiring coarse-grained configuration selection), Compose apps/widgets can be much more responsive (eg. see the
widget), which gives you more flexibility to naturally scale the app as the window size increases. To get something mimetic of the existing system, it is also possible for us (or you) to implement a widget that takes in a map of configuration qualifiers to composable lambdas, and will compose the appropriate lambda that matches the current configuration. So there are some options here, but wherever we land, it will likely be more code-centric rather than based on file name/path/annotation.

Adam Powell

08/07/2019, 1:05 PM
or to put it another way, at a minimum you'll be able to do something like this:
Copy code
fun SomeView() = if (currentConfiguration.smallestScreenWidthDp >= 600) {
} else {
and if we end up needing more than you can express in that sort of way, we'll invest further down the road
👍 4