Search in sources :

Example 1 with OnBackPressListener

use of chat.rocket.android.helper.OnBackPressListener in project Rocket.Chat.Android by RocketChat.

the class AbstractFragmentActivity method onBackPress.

protected boolean onBackPress() {
    FragmentManager fragmentManager = getSupportFragmentManager();
    Fragment fragment = fragmentManager.findFragmentById(getLayoutContainerForFragment());
    if (fragment instanceof OnBackPressListener && ((OnBackPressListener) fragment).onBackPressed()) {
        return true;
    }
    if (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStack();
        return true;
    }
    return false;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Fragment(android.support.v4.app.Fragment) OnBackPressListener(chat.rocket.android.helper.OnBackPressListener)

Aggregations

Fragment (android.support.v4.app.Fragment)1 FragmentManager (android.support.v4.app.FragmentManager)1 OnBackPressListener (chat.rocket.android.helper.OnBackPressListener)1