Hi everyone! I'm new to Jetpack Compose and Kotlin...
# compose
t
Hi everyone! I'm new to Jetpack Compose and Kotlin. Our company is starting a mobile app based project. I'm researching about Jetpack Compose and, especially, Android Flavors Support for Jetpack Compose. Is there any example projects where I can see how resources are managed? For each flavor I need to have: theme, colors, shape, typography, strings (I would like to not keep them in .xml file, and I'd like to to change the app language on the fly).
c
Jetpack Compose UI is pretty much just a user interface framework. It doesn't replace all of Android, just the “displaying stuff to users” part. All the resource management should be exactly the same as with good-old android. (Though I'm just a user as well, a staff member might want to step in for more details)
t
Thanks for your response, @CLOVIS. I'm also new to Android native development. 🙂 I have experience in developing mobile apps with Flutter and React Native. I think .xml isn't convenient for resources. Jetpack Compose default template comes with Color.kt, Theme.kt, Shape.kt and Type.kt (for typography). I think strings should also be brought to .kt file.
a
Wouldn't really work out too well afaik, since you'd need to link them import them into a single file, and you probably couldn't feasibly split it into an APK bundle, plus, string resources would still need to exist for things like app name localization on the launcher, etc
Bringing strings to a Kotlin files
I mean, you obviously could, but it's really not worth it. Storing strings in XML is optimal
t
Thanks for your response, @andrew. I'll take into account it. Thanks.
a
Have you seen the Jetpack Compose Pathway? The codelabs would sure help you get started.
t
@Archie thanks for your response. Yes I've looked through all the codelabs.