Search in sources :

Example 1 with AboutFragment

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);
    }
}
Also used : AboutFragment(org.fossasia.openevent.core.about.AboutFragment) Handler(android.os.Handler) DownloadCompleteHandler(org.fossasia.openevent.common.api.DownloadCompleteHandler) Fragment(android.support.v4.app.Fragment) LocationsFragment(org.fossasia.openevent.core.location.LocationsFragment) SponsorsFragment(org.fossasia.openevent.core.sponsor.SponsorsFragment) TracksFragment(org.fossasia.openevent.core.track.TracksFragment) DiscountCodeFragment(org.fossasia.openevent.core.discount.DiscountCodeFragment) ScheduleFragment(org.fossasia.openevent.core.schedule.ScheduleFragment) AboutFragment(org.fossasia.openevent.core.about.AboutFragment) FAQFragment(org.fossasia.openevent.core.faqs.FAQFragment) NotificationsFragment(org.fossasia.openevent.core.notifications.NotificationsFragment) FeedFragment(org.fossasia.openevent.core.feed.FeedFragment) SpeakersListFragment(org.fossasia.openevent.core.speaker.SpeakersListFragment) Snackbar(android.support.design.widget.Snackbar)

Aggregations

Handler (android.os.Handler)1 Snackbar (android.support.design.widget.Snackbar)1 Fragment (android.support.v4.app.Fragment)1 DownloadCompleteHandler (org.fossasia.openevent.common.api.DownloadCompleteHandler)1 AboutFragment (org.fossasia.openevent.core.about.AboutFragment)1 DiscountCodeFragment (org.fossasia.openevent.core.discount.DiscountCodeFragment)1 FAQFragment (org.fossasia.openevent.core.faqs.FAQFragment)1 FeedFragment (org.fossasia.openevent.core.feed.FeedFragment)1 LocationsFragment (org.fossasia.openevent.core.location.LocationsFragment)1 NotificationsFragment (org.fossasia.openevent.core.notifications.NotificationsFragment)1 ScheduleFragment (org.fossasia.openevent.core.schedule.ScheduleFragment)1 SpeakersListFragment (org.fossasia.openevent.core.speaker.SpeakersListFragment)1 SponsorsFragment (org.fossasia.openevent.core.sponsor.SponsorsFragment)1 TracksFragment (org.fossasia.openevent.core.track.TracksFragment)1