Actualizado
@Override
public void onBackPressed() {
if (mDrawer.isDrawerOpen(GravityCompat.START)) {
mDrawer.closeDrawer(GravityCompat.START);
}
super.onBackPressed();
boolean disableBack = (getSupportFragmentManager().getFragments().size() > 1);
if (disableBack) {
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_home_tab_layout);
if (fragment instanceof HomeTabLayoutFragment) {
mBottomNavigationView.setSelectedItemId(R.id.nav_home);
} else if (fragment instanceof SearchFragment) {
mBottomNavigationView.setSelectedItemId(R.id.nav_search);
} else if (fragment instanceof AttendingEventFragment) {
mBottomNavigationView.setSelectedItemId(R.id.nav_save);
} else if (fragment instanceof NotificationsFragment) {
mBottomNavigationView.setSelectedItemId(R.id.nav_notifications);
} else if (fragment instanceof ProfileFragment) {
mBottomNavigationView.setSelectedItemId(R.id.nav_profile);
}
} else {
super.onBackPressed();
}
}