Search in sources :

Example 1 with TopFragment

use of im.tny.segvault.disturbances.ui.fragment.TopFragment in project underlx by underlx.

the class MainActivity method replaceFragment.

private void replaceFragment(Fragment newFragment, boolean addToBackStack) {
    Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.main_fragment_container);
    if (currentFragment == null || !currentFragment.isAdded()) {
        currentFragment = getSupportFragmentManager().findFragmentById(R.id.alt_fragment_container);
    }
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    if (currentFragment != null) {
        transaction.remove(currentFragment);
    }
    int destContainer = R.id.main_fragment_container;
    if (newFragment instanceof TopFragment) {
        TopFragment newFrag = (TopFragment) newFragment;
        if (!newFrag.isScrollable()) {
            destContainer = R.id.alt_fragment_container;
        }
    }
    transaction.replace(destContainer, newFragment);
    if (addToBackStack) {
        transaction.addToBackStack(null);
    }
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) TopFragment(im.tny.segvault.disturbances.ui.fragment.TopFragment) DisturbanceFragment(im.tny.segvault.disturbances.ui.fragment.top.DisturbanceFragment) DialogFragment(android.support.v4.app.DialogFragment) HelpFragment(im.tny.segvault.disturbances.ui.fragment.top.HelpFragment) TopFragment(im.tny.segvault.disturbances.ui.fragment.TopFragment) Fragment(android.support.v4.app.Fragment) UnconfirmedTripsFragment(im.tny.segvault.disturbances.ui.fragment.UnconfirmedTripsFragment) RouteFragment(im.tny.segvault.disturbances.ui.fragment.top.RouteFragment) AnnouncementFragment(im.tny.segvault.disturbances.ui.fragment.top.AnnouncementFragment) AboutFragment(im.tny.segvault.disturbances.ui.fragment.top.AboutFragment) MapFragment(im.tny.segvault.disturbances.ui.fragment.top.MapFragment) HomeStatsFragment(im.tny.segvault.disturbances.ui.fragment.HomeStatsFragment) HomeLinesFragment(im.tny.segvault.disturbances.ui.fragment.HomeLinesFragment) GeneralPreferenceFragment(im.tny.segvault.disturbances.ui.fragment.top.GeneralPreferenceFragment) HtmlDialogFragment(im.tny.segvault.disturbances.ui.fragment.HtmlDialogFragment) HomeFragment(im.tny.segvault.disturbances.ui.fragment.top.HomeFragment) TripFragment(im.tny.segvault.disturbances.ui.fragment.TripFragment) TripHistoryFragment(im.tny.segvault.disturbances.ui.fragment.top.TripHistoryFragment) NotifPreferenceFragment(im.tny.segvault.disturbances.ui.fragment.top.NotifPreferenceFragment)

Aggregations

DialogFragment (android.support.v4.app.DialogFragment)1 Fragment (android.support.v4.app.Fragment)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 HomeLinesFragment (im.tny.segvault.disturbances.ui.fragment.HomeLinesFragment)1 HomeStatsFragment (im.tny.segvault.disturbances.ui.fragment.HomeStatsFragment)1 HtmlDialogFragment (im.tny.segvault.disturbances.ui.fragment.HtmlDialogFragment)1 TopFragment (im.tny.segvault.disturbances.ui.fragment.TopFragment)1 TripFragment (im.tny.segvault.disturbances.ui.fragment.TripFragment)1 UnconfirmedTripsFragment (im.tny.segvault.disturbances.ui.fragment.UnconfirmedTripsFragment)1 AboutFragment (im.tny.segvault.disturbances.ui.fragment.top.AboutFragment)1 AnnouncementFragment (im.tny.segvault.disturbances.ui.fragment.top.AnnouncementFragment)1 DisturbanceFragment (im.tny.segvault.disturbances.ui.fragment.top.DisturbanceFragment)1 GeneralPreferenceFragment (im.tny.segvault.disturbances.ui.fragment.top.GeneralPreferenceFragment)1 HelpFragment (im.tny.segvault.disturbances.ui.fragment.top.HelpFragment)1 HomeFragment (im.tny.segvault.disturbances.ui.fragment.top.HomeFragment)1 MapFragment (im.tny.segvault.disturbances.ui.fragment.top.MapFragment)1 NotifPreferenceFragment (im.tny.segvault.disturbances.ui.fragment.top.NotifPreferenceFragment)1 RouteFragment (im.tny.segvault.disturbances.ui.fragment.top.RouteFragment)1 TripHistoryFragment (im.tny.segvault.disturbances.ui.fragment.top.TripHistoryFragment)1