terrakok / Cicerone

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

Fragments back stack handling #137

Closed emartynov closed 3 years ago

emartynov commented 3 years ago

I joined a project that uses Cicerone as for the navigation. I'm still learning and exploring. It is a Single Activity application with fragmetns.

What I understood I should override the back button in every fragment and call Router.exit() method. However, I was thinking why not to leave it to the defaults and only in super cases use Router.

Cicerone can allow fragment manager to pop back stack and Cicerone can refresh state on this event (it can set a listener for any back stack changes).

terrakok commented 3 years ago

Yes. You can call Router.exit() inside Activity.onBackPressed() but then no one fragment can override this logic. If it is right behavior for your app then all is OK.