Search in sources :

Example 1 with AdvancedFragment

use of com.farmerbb.taskbar.fragment.AdvancedFragment in project Taskbar by farmerbb.

the class MainActivity method onBackPressed.

@Override
public void onBackPressed() {
    Fragment oldFragment = getFragmentManager().findFragmentById(R.id.fragmentContainer);
    if (oldFragment instanceof AboutFragment)
        super.onBackPressed();
    else {
        Fragment newFragment;
        if (oldFragment instanceof ManageAppDataFragment)
            newFragment = new AdvancedFragment();
        else
            newFragment = new AboutFragment();
        getFragmentManager().beginTransaction().replace(R.id.fragmentContainer, newFragment, newFragment.getClass().getSimpleName()).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE).commit();
    }
}
Also used : AboutFragment(com.farmerbb.taskbar.fragment.AboutFragment) AdvancedFragment(com.farmerbb.taskbar.fragment.AdvancedFragment) ManageAppDataFragment(com.farmerbb.taskbar.fragment.ManageAppDataFragment) DesktopModeFragment(com.farmerbb.taskbar.fragment.DesktopModeFragment) SettingsFragment(com.farmerbb.taskbar.fragment.SettingsFragment) FreeformModeFragment(com.farmerbb.taskbar.fragment.FreeformModeFragment) AboutFragment(com.farmerbb.taskbar.fragment.AboutFragment) ManageAppDataFragment(com.farmerbb.taskbar.fragment.ManageAppDataFragment) Fragment(android.app.Fragment) AdvancedFragment(com.farmerbb.taskbar.fragment.AdvancedFragment) AppearanceFragment(com.farmerbb.taskbar.fragment.AppearanceFragment)

Aggregations

Fragment (android.app.Fragment)1 AboutFragment (com.farmerbb.taskbar.fragment.AboutFragment)1 AdvancedFragment (com.farmerbb.taskbar.fragment.AdvancedFragment)1 AppearanceFragment (com.farmerbb.taskbar.fragment.AppearanceFragment)1 DesktopModeFragment (com.farmerbb.taskbar.fragment.DesktopModeFragment)1 FreeformModeFragment (com.farmerbb.taskbar.fragment.FreeformModeFragment)1 ManageAppDataFragment (com.farmerbb.taskbar.fragment.ManageAppDataFragment)1 SettingsFragment (com.farmerbb.taskbar.fragment.SettingsFragment)1