Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for additional framework for building single-activity apps. #131

Open
terrakok opened this issue Nov 18, 2020 · 12 comments
Open

Proposal for additional framework for building single-activity apps. #131

terrakok opened this issue Nov 18, 2020 · 12 comments

Comments

@terrakok
Copy link
Owner

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
@terrakok
Copy link
Owner Author

May be it wont be library artifact but will be good topics for Wiki pages. What do you think?

@P1NG2WIN
Copy link

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.

@nzeeei
Copy link

nzeeei commented Nov 18, 2020

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?);

@logoped583st
Copy link

logoped583st commented Nov 18, 2020

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.

@terrakok
Copy link
Owner Author

Yes, I agree with you and wiki documentation looks more useful. I imagine this like cook-book with common cases

@Alvazz
Copy link

Alvazz commented Nov 24, 2020

@terrakok can you give some Cicerone with MvRx's BottomNavigation's demo? thanks a lot.

Airbnb MvRx

@emartynov
Copy link

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

@terrakok
Copy link
Owner Author

There isn't ETA. Just proposal and open discussion.

@emartynov
Copy link

emartynov commented Jan 15, 2021

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.

@terrakok
Copy link
Owner Author

I'm always open for PRs and new ideas.
Will be happy to see your suggestions and discuss about them

@emartynov
Copy link

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.

@terrakok
Copy link
Owner Author

Welcome to #139 discussion 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants