terrakok / Cicerone

🚦 Cicerone is a lightweight library that makes the navigation in an Android app easy.
Other
2.58k stars 218 forks source link

Made properties protected to add ability use them in overridden methods. #101

Closed Anton111111 closed 4 years ago

Jeevuz commented 5 years ago

Can you please describe the cases in which one might need this properties to be open?

Anton111111 commented 5 years ago

Can you please describe the cases in which one might need this properties to be open?

If I want to make my Navigator based on SupportAppNavigator. As a result, I can override for example fragmentForward, but inside I can't do anything because there are private fields:     private final FragmentManager fragmentManager;     private final int containerId;     private LinkedList localStackCopy;

For this reason they must be protected.

terrakok commented 5 years ago

You have to do it for all library navigators.

Jeevuz commented 5 years ago

And why you need to override fragmentGorward or some of this kind of methods?

I asking because I think If you need to override this, maybe API of this class is not flexible enough. And better way is to change API and not to open inner fields.

mistreckless commented 5 years ago

And why you need to override fragmentGorward or some of this kind of methods?

I asking because I think If you need to override this, maybe API of this class is not flexible enough. And better way is to change API and not to open inner fields.

Just open localStackCopy field. In my case better to hide/show fragments instead of replace it and I want to get my custom back button behavior. After migrating to androidx and cicerone 5.0.0 I lost that opportunity.

terrakok commented 5 years ago

localStackCopy is not stack of fragments or some screens! It is just inner calculated field for navigator optimizations. You shouldn't use it for show/hide fragments. If you want to do navigator with hide command instead replace then you have to implement it from scratch.

mistreckless commented 5 years ago

localStackCopy is not stack of fragments or some screens! It is just inner calculated field for navigator optimizations.

Sure, I used this field only to calculate when to finish current screen chain. Cicerone is really simple library and I don't see any reasons to not using "inner calculated field for navigator optimizations". But, after migrating to androidx I was in slipknot. Implement the custom navigator is the best way, thanks

terrakok commented 5 years ago

If someone will do it for all library navigators then I'll merge this request.

inwady commented 5 years ago

If someone will do it for all library navigators then I'll merge this request.

My hack is applyCommands(emptyArray()) in order to call the method copyStackToLocal for getting access to localStackCopy. So I didn't rewrite the whole navigator. It's rude hack.

Anton111111 commented 5 years ago

If someone will do it for all library navigators then I'll merge this request.

i've added changes to AppNavigato

rs-georg commented 4 years ago

Hi. When will this change be released?