terrakok/Cicerone

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 handler
  • BaseFragment: clear life-cycle, back button handler
  • FlowFragment: nested navigation container, child-parent routers
  • BottomNavigationFragment: 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:

  1. 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

  1. How to work with bottom navigation view and multibackstack.
NZeee commented

Possible cases for the wiki:

  • DialogFragment and BottomSheetFragment 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() or onNewIntent(). 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.

Airbnb MvRx

@terrakok what is ETA for the new plans? Asking before own implementation.

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.

Welcome to #139 discussion ๐Ÿค—