use of org.fossasia.openevent.core.about.AboutFragment in project open-event-android by fossasia.
the class MainActivity method onBackPressed.
@Override
public void onBackPressed() {
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame);
if (!isTwoPane && (drawerLayout != null && drawerLayout.isDrawerOpen(GravityCompat.START))) {
drawerLayout.closeDrawer(GravityCompat.START);
} else if (atHome) {
if (backPressedOnce) {
super.onBackPressed();
} else if (fragment instanceof AboutFragment) {
backPressedOnce = true;
Snackbar snackbar = Snackbar.make(mainFrame, R.string.press_back_again, 2000);
snackbar.show();
new Handler().postDelayed(() -> backPressedOnce = false, 2000);
} else if (isMapFragment) {
replaceFragment(AboutFragment.newInstance(onMapSelectedListener), R.string.menu_home);
addShadowToAppBar(true);
}
} else {
replaceFragment(AboutFragment.newInstance(onMapSelectedListener), R.string.menu_home);
navigationView.setCheckedItem(R.id.nav_home);
addShadowToAppBar(true);
}
}
Aggregations