Search in sources :

Example 1 with BookFragment

use of com.orgzly.android.ui.notes.book.BookFragment in project orgzly-android by orgzly.

the class DisplayManager method displayBook.

/**
 * Add fragment for book, unless the same book is already being displayed.
 */
public static void displayBook(FragmentManager fragmentManager, long bookId, long noteId) {
    BookFragment existingFragment = getFragmentDisplayingBook(fragmentManager, bookId);
    if (existingFragment == null) {
        /* Create fragment. */
        Fragment fragment = BookFragment.getInstance(bookId, noteId);
        /* Add fragment. */
        fragmentManager.beginTransaction().setCustomAnimations(R.anim.fragment_enter, R.anim.fragment_exit, R.anim.fragment_enter, R.anim.fragment_exit).addToBackStack(null).replace(R.id.single_pane_container, fragment, BookFragment.FRAGMENT_TAG).commit();
    } else {
        if (noteId > 0) {
            Log.w(TAG, "Fragment displaying book " + bookId + " already exists, jumping to note");
            existingFragment.scrollToNoteIfSet(noteId);
        } else {
            Log.w(TAG, "Fragment displaying book " + bookId + " already exists, ignoring");
        }
    }
}
Also used : BookFragment(com.orgzly.android.ui.notes.book.BookFragment) SearchFragment(com.orgzly.android.ui.notes.query.search.SearchFragment) AgendaFragment(com.orgzly.android.ui.notes.query.agenda.AgendaFragment) SavedSearchesFragment(com.orgzly.android.ui.savedsearches.SavedSearchesFragment) SavedSearchFragment(com.orgzly.android.ui.savedsearch.SavedSearchFragment) Fragment(androidx.fragment.app.Fragment) BookPrefaceFragment(com.orgzly.android.ui.notes.book.BookPrefaceFragment) BooksFragment(com.orgzly.android.ui.books.BooksFragment) NoteFragment(com.orgzly.android.ui.note.NoteFragment) BookFragment(com.orgzly.android.ui.notes.book.BookFragment)

Aggregations

Fragment (androidx.fragment.app.Fragment)1 BooksFragment (com.orgzly.android.ui.books.BooksFragment)1 NoteFragment (com.orgzly.android.ui.note.NoteFragment)1 BookFragment (com.orgzly.android.ui.notes.book.BookFragment)1 BookPrefaceFragment (com.orgzly.android.ui.notes.book.BookPrefaceFragment)1 AgendaFragment (com.orgzly.android.ui.notes.query.agenda.AgendaFragment)1 SearchFragment (com.orgzly.android.ui.notes.query.search.SearchFragment)1 SavedSearchFragment (com.orgzly.android.ui.savedsearch.SavedSearchFragment)1 SavedSearchesFragment (com.orgzly.android.ui.savedsearches.SavedSearchesFragment)1