use of com.orgzly.android.ui.note.NoteFragment in project orgzly-android by orgzly.
the class ShareActivity method setupFragments.
private void setupFragments(Bundle savedInstanceState, Data data) {
NoteFragment noteFragment;
if (savedInstanceState == null) {
/* Create and add fragments. */
mSyncFragment = SyncFragment.getInstance();
getSupportFragmentManager().beginTransaction().add(mSyncFragment, SyncFragment.FRAGMENT_TAG).commit();
try {
long bookId;
if (data.bookId == null) {
bookId = dataRepository.getTargetBook(this).getBook().getId();
} else {
bookId = data.bookId;
}
noteFragment = NoteFragment.forNewNote(new NotePlace(bookId), data.title, data.content);
getSupportFragmentManager().beginTransaction().replace(R.id.activity_share_main, noteFragment, NoteFragment.FRAGMENT_TAG).commit();
} catch (IOException ex) {
ex.printStackTrace();
// bail out here
finish();
}
} else {
/* Get existing fragments. */
mSyncFragment = (SyncFragment) getSupportFragmentManager().findFragmentByTag(SyncFragment.FRAGMENT_TAG);
}
}
Aggregations