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

Support for multiple histories #217

Open
lassem opened this issue Nov 22, 2016 · 6 comments
Open

Support for multiple histories #217

lassem opened this issue Nov 22, 2016 · 6 comments
Milestone

Comments

@lassem
Copy link

lassem commented Nov 22, 2016

In our app, we would like to support bottom bar navigation and retain the histories of all the different views available there. 5 buttons in the bottom bar equals 5 distinct histories to switch between.

AFAICT this is not possible today due to the fact that Flow is tied to the Activity and only has 1 linear history.

I've kinda worked something out by cheating with package names and such, but I feel this should've been supported by the library one way or another.

MultiKeys doesn't help either. OTOH, MultiKeys are so confusing ;-) that I might be wrong.

@skrugly
Copy link

skrugly commented Nov 27, 2016

You could dump a history any time a bottom bar position changed by Flow::getHistory and replace it by Flow::setHistory

@Zhuinden
Copy link

Zhuinden commented Dec 8, 2016

@lassem I've been thinking a lot about this, but if you have multiple history stacks, then you need to give your Flow instances ids to separate the ID by which Flow persists the history to the Activity bundle.

Another possibility is to flatten the 5 history stacks into one using interfaces to determine which key belongs to which view, and the custom dispatcher logic can evaluate which stack this belongs to, and update the current selected bottom navigation element in the activity based on whether there is a mismatch between the new and previous element's stack group.

Although if you have anything else in mind, maybe it helps me brainstorm :)

@Zhuinden
Copy link

Zhuinden commented Feb 5, 2017

In the end, I just made my own library that allows it via backstackDelegate.setPersistenceTag()

EDIT from the future: It actually makes managing them kinda difficult though... :|

@rjrjr rjrjr added this to the post-1.0 milestone Apr 13, 2017
@BraisGabin
Copy link

You could dump a history any time a bottom bar position changed by Flow::getHistory and replace it by Flow::setHistory

I have this working following this advice but an easy way to Parcel a History would be very handy to implement this. It's not trivial.

@Zhuinden
Copy link

@BraisGabin only InternalLifecycleIntegration knows how to parcel a History, no?

@BraisGabin
Copy link

It does, I copied&pasted that code. But It doesn't fill right to copy&paste something like that.

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

5 participants