use of net.iGap.story.liststories.StoryFragment in project iGap-Android by KianIranian-STDG.
the class BottomNavigationFragment method loadFragment.
private void loadFragment(int position) {
currentTab = position;
hideKeyboard();
FragmentManager fragmentManager = getChildFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Fragment fragment;
switch(position) {
case STORY_FRAGMENT:
HelperTracker.sendTracker(HelperTracker.TRACKER_MOMENTS_TAB);
fragment = fragmentManager.findFragmentByTag(StoryFragment.class.getName());
if (fragment == null) {
fragment = new StoryFragment();
fragmentTransaction.addToBackStack(fragment.getClass().getName());
}
replaceFragment(fragmentTransaction, fragment, fragment.getClass().getName());
break;
case CALL_FRAGMENT:
fragment = fragmentManager.findFragmentByTag(FragmentCall.class.getName());
if (fragment == null) {
fragment = FragmentCall.newInstance(true);
fragmentTransaction.addToBackStack(fragment.getClass().getName());
}
replaceFragment(fragmentTransaction, fragment, fragment.getClass().getName());
break;
case CHAT_FRAGMENT:
fragment = fragmentManager.findFragmentByTag(MainFragment.class.getName());
if (fragment == null) {
fragment = MainFragment.newInstance();
fragmentTransaction.addToBackStack(fragment.getClass().getName());
}
replaceFragment(fragmentTransaction, fragment, fragment.getClass().getName());
break;
case DISCOVERY_FRAGMENT:
fragment = fragmentManager.findFragmentByTag(DiscoveryFragment.class.getName());
if (fragment == null) {
fragment = DiscoveryFragment.newInstance(0);
fragmentTransaction.addToBackStack(fragment.getClass().getName());
}
if (crawlerStruct != null && !crawlerStruct.isWorkDone()) {
((DiscoveryFragment) fragment).setNeedToCrawl(true);
}
replaceFragment(fragmentTransaction, fragment, fragment.getClass().getName());
break;
case PROFILE_FRAGMENT:
fragment = fragmentManager.findFragmentByTag(FragmentUserProfile.class.getName());
if (fragment == null) {
fragment = new FragmentUserProfile();
fragmentTransaction.addToBackStack(fragment.getClass().getName());
}
replaceFragment(fragmentTransaction, fragment, fragment.getClass().getName());
break;
}
}
Aggregations