Proposal for additional framework for building single-activity apps.
terrakok opened this issue ยท 12 comments
Call for suggestions!
What are base classes needed?
AppActivity
: global router, deep-links handler, back button handlerBaseFragment
: clear life-cycle, back button handlerFlowFragment
: nested navigation container, child-parent routersBottomNavigationFragment
: several FlowFragments with own backstacks, back button handler
May be it wont be library artifact but will be good topics for Wiki pages. What do you think?
I propose to describe these cases on the wiki:
- deeplink.
Now in all projects on start AS puts a Jetpack Navigation that processes deeplink itself. When dev moving on, he expects this library to do the same. So describe that there is no built-in support, but it is done easily
- How to work with bottom navigation view and multibackstack.
Possible cases for the wiki:
DialogFragment
andBottomSheetFragment
of course -_- That work as dialogs (but they're not!);- Integration with other libraries (Moxy, Toothpick/Dagger/...);
- Different cases when handle deeplinks. E.g. what we do depending on which method is called:
onCreate()
oronNewIntent()
. A lot of people ask about it or don't even know it matters; - Handling deeplinks in a complex hierarchy of screens: how we might handle them? To pass through bundles, to store in a memory or use anything else?
- Handling insets: what if we want a full-screen SplashFragment? E.g. we create a full screen activity and make fragments handle insets themselves. We can create an open method in the BaseFragment and override it if need:
protected open fun dispatchInsets(v: View, insets: WindowInsets) {}
protected open fun fitSystemWindows(v: View, insets: WindowInsets) {
v.updatePadding(
top = insets.systemWindowInsetTop,
bottom = insets.systemWindowInsetBottom
)
}
...
override fun dispatchInsets(v: View, insets: WindowInsets): Unit = fitSystemWindows(v, insets)
- Communication between fragment: custom buses (Flow?), built-in ResultBus, targetFragment (really annoying!). Also, how we might jump between stacks in the app with bottom navigation (named bound routers?);
Is it possible to avoid using abstractions for framework implementation? I don't think it's quiet good idea because in this case we can't use other frameworks like MOXY and e.t.c.
IMHO General idea seems like Conductor framework and i don't realy like that.
Yes, I agree with you and wiki documentation looks more useful. I imagine this like cook-book with common cases
@terrakok can you give some Cicerone with MvRx's BottomNavigation's demo? thanks a lot.
There isn't ETA. Just proposal and open discussion.
Cool, just adding this to our project:
if (fragment is BottomSheetDialogFragment) {
fragment.show(fragmentManager, screen.screenKey)
} else {
showFragment(fragment, type, screen, addToBackStack)
}
Also need to check how will it work with the next fragment.
Let me know when you are open for PR.
I'm always open for PRs and new ideas.
Will be happy to see your suggestions and discuss about them
Unfortunately, I failed since BottomSheetDialogFragment never will get in the back stack of the manager. I made a wrapper fragment that shows BSD and closes itself when BSD is fully dismissed.