Search in sources :

Example 1 with NoteFragment

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);
    }
}
Also used : NotePlace(com.orgzly.android.ui.NotePlace) IOException(java.io.IOException) NoteFragment(com.orgzly.android.ui.note.NoteFragment)

Aggregations

NotePlace (com.orgzly.android.ui.NotePlace)1 NoteFragment (com.orgzly.android.ui.note.NoteFragment)1 IOException (java.io.IOException)1