Search in sources :

Example 1 with NoteFragment

use of com.orgzly.android.ui.fragments.NoteFragment in project orgzly-android by orgzly.

the class MainActivity method onBackPressed.

@Override
public void onBackPressed() {
    if (BuildConfig.LOG_DEBUG)
        LogUtils.d(TAG);
    /* Close drawer if opened. */
    if (mDrawerLayout != null) {
        if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
            mDrawerLayout.closeDrawer(GravityCompat.START);
            return;
        }
    }
    /* Handle back press when editing note - check for changes */
    Fragment fragment = getSupportFragmentManager().findFragmentByTag(NoteFragment.FRAGMENT_TAG);
    if (fragment != null && fragment instanceof NoteFragment && fragment.isVisible()) {
        final NoteFragment noteFragment = (NoteFragment) fragment;
        if (noteFragment.isAskingForConfirmationForModifiedNote()) {
            return;
        }
    }
    super.onBackPressed();
}
Also used : NoteFragment(com.orgzly.android.ui.fragments.NoteFragment) FilterFragment(com.orgzly.android.ui.fragments.FilterFragment) BookPrefaceFragment(com.orgzly.android.ui.fragments.BookPrefaceFragment) Fragment(android.support.v4.app.Fragment) BookFragment(com.orgzly.android.ui.fragments.BookFragment) SyncFragment(com.orgzly.android.ui.fragments.SyncFragment) NoteListFragment(com.orgzly.android.ui.fragments.NoteListFragment) BooksFragment(com.orgzly.android.ui.fragments.BooksFragment) NoteFragment(com.orgzly.android.ui.fragments.NoteFragment) FiltersFragment(com.orgzly.android.ui.fragments.FiltersFragment)

Aggregations

Fragment (android.support.v4.app.Fragment)1 BookFragment (com.orgzly.android.ui.fragments.BookFragment)1 BookPrefaceFragment (com.orgzly.android.ui.fragments.BookPrefaceFragment)1 BooksFragment (com.orgzly.android.ui.fragments.BooksFragment)1 FilterFragment (com.orgzly.android.ui.fragments.FilterFragment)1 FiltersFragment (com.orgzly.android.ui.fragments.FiltersFragment)1 NoteFragment (com.orgzly.android.ui.fragments.NoteFragment)1 NoteListFragment (com.orgzly.android.ui.fragments.NoteListFragment)1 SyncFragment (com.orgzly.android.ui.fragments.SyncFragment)1