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");
}
}
}
Aggregations