DMCApps / NavigationFragment

The purpose of this manager is to work with the ViewPager, Tabs and Navigation drawer to handle a single stack flow of fragments on the screen. It makes use of a main Fragment as a container and presents and hides fragments within it as children.
MIT License
28 stars 8 forks source link

implement setnavigationmanager #23

Closed jjhesk closed 8 years ago

jjhesk commented 8 years ago

i have noticed that the setnavigationmanager has been removed.


 @Override
    public Object instantiateItem(ViewGroup container, int position) {
        Object item = super.instantiateItem(container, position);
        if (item instanceof NavigationFragment) {
            NavigationFragment nav = (NavigationFragment) item;
            nav.setNavigationManager(nmf);
        }
        return item;
    }

what do i need to do to fix it for the new version 0.2.0.3. As you have mentioned

No longer a need for the setNavigationManager(NavigationManagerFragment) method. The NavigationFragmentManager is now smart enough to look at it's parent (or parent's parent, etc.) until it finds a NavigationManagerFragment to use.

I still dont get it..

jjhesk commented 8 years ago

so i just need to remove it right?

DMCApps commented 8 years ago

@jjhesk

That's right. The navigation manager is now smart enough to look at the parent of the fragment (and continue looking up the stack of parents) until it finds a NavigationManager. It will then present and dismiss on that instance.

Check here for the implementation and it might give you a better understanding: https://github.com/DMCApps/NavigationFragment/blob/master/navigation-fragment/src/main/java/com/dmcapps/navigationfragment/fragments/NavigationFragment.java#L32

I believe I actually removed it in 0.2.0. I apologize I should have depreciated it and then warned that it will be removed in a future release instead of explicitly removing it. Let me know if that works properly for you or if there is a reason that you will still need to explicitly set the manager.

jjhesk commented 8 years ago

@DMCApps thank you for the clarification. I had already removed in my project and it just worked.