I am planning on a View Hierarchy like this:
Basically the Main Fragment will be able to trigger navigations inside the Bottom Sheet Navigation Controller , Bottom Sheet Fragment will also be able to trigger navigations inside the Bottom Sheet Navigation Controller and send Events/Data to the Main Fragment.
For example, lets suppose Main Fragment has a grid of items while the Bottom Sheet Fragment shows the last clicked item details. The user might click a button inside the details in the Bottom Sheet Fragment, let's say a "Order Now" Button and now this Event will have to be carried out to the Main Fragment. Please do not hold yourself to this particular use case, this is just an example I am making to illustrate the need.
My question is how can I overcome the separation provided by the Navigation Controllers in Android Jetpack? There are lots of documentations about how to use a common Activity
and etc. to manage communications between Fragments
that share the same screen, but now there's the new Navigation Controller that brings new abstractions de decouples the Fragment
handling so I am not so sure on how to proceed.
I thought about maybe using a Singleton
to pass Events/Data around, maybe with LiveData
inside it, but I think there might be some more elegant solutions out there.