https://kotlinlang.org logo
#compose
Title
# compose
j

james

01/15/2022, 12:54 AM
I'm looking for opinions on an architectural decision for a brand new project I'm starting, with probably around 20 different screens for the user to go to I need to decide between the following: 1. Single activity, many Composables 2. Single activity, one fragment per "screen", many Composables 3. Many activities, no fragments, many Composables I'm leaning toward option 3, but I'm wondering if option 3 will make it hard to have shared element transitions between different Activities? all opinions welcome 🙏
e

Ethan Hsu

01/15/2022, 1:51 AM
I think option 1 would be the best choice since you can use Compose Navigation to handle navigating in Compose and compose-shared-element to do transitions. If you have a solid use case for having lots of activities, maybe deep linking or external intents, then option 3 might be better. Tho even deep linking can be handled in a single activity…
🙏 1
s

Stylianos Gakis

01/15/2022, 10:00 AM
I would never go with 3 1 is the more "bleeding edge" approach, which will have you rely on accompanist for stuff like animations between screens etc. I would go there if you like being adventurous and don't mind spending some extra time figuring out stuff. 2 is the most battle tested way, navigation for fragments has been there for a long time, navigation animations are not relying on accompanist. Plus when you feel ready, to replace all the top level fragments with just composables will be a breeze. As long as all your fragments do is inflate their composable.
🙏 1
c

Colton Idle

01/15/2022, 9:48 PM
Option 1 hasn't failed me yet in 3 apps in prod. Also, shared element transitions are coming soon it seems
🙏 1
z

Zach Klippenstein (he/him) [MOD]

01/16/2022, 3:36 AM
I would do 1 as well. Gives you much more flexibility with how you handle navigation, and since it's all in compose it's probably going to be easier to test
🙏 2
m

myanmarking

01/16/2022, 1:52 PM
I would pick 2. I like the 1) but for me there is no viable navigation library full compose yet
🙏 1
j

james

01/17/2022, 6:17 AM
amazing, thank you all for the responses 💙
🙏 1
a

Arun Joseph

01/17/2022, 8:10 PM
We do option 1, also has view embedded by AndroidView composable
2 Views