ncapdevi / FragNav

An Android library for managing multiple stacks of fragments
1.5k stars 220 forks source link

[Question] How `onTabTransaction` and `onFragmentTransaction` work? #60

Closed smihajlovski closed 7 years ago

smihajlovski commented 7 years ago

I've recently stumbled upon this library and just started using it because it suits my needs. Given the fact I am a beginner I wanted to know if you can provide some sample or code snippet of how I can use onTabTransaction and onFragmentTransaction? For example, in one of the tabs I am pushing a second fragment. If I go to the hardware back button, it does what it is supposed to do, pops the fragment. But, I also have a custom toolbar in that particular fragment which has a back button. I would like to pop the fragment when I click the button. How can I implement this functionality? Also, something like if the fragment is an instance of the root fragment but it's not the root, I would like to show a back button. I am interested on how to use these kind of functionalities. if it's not hassle please provide some more information.

Cheers!

ncapdevi commented 7 years ago

Check out the sample app for answers like this. https://github.com/ncapdevi/FragNav/blob/master/app/src/main/java/com/ncapdevi/sample/activities/BottomTabsActivity.java#L76

https://github.com/ncapdevi/FragNav/blob/master/app/src/main/java/com/ncapdevi/sample/activities/BottomTabsActivity.java#L109

https://github.com/ncapdevi/FragNav/blob/master/app/src/main/java/com/ncapdevi/sample/activities/BottomTabsActivity.java#L100