@Override public void onEventMainThread(AddNote2Main event) { FragMain fragMain = adapter.getItem(mPosition); FragMainAdapter fmad = fragMain.getAdapter(); LinearLayoutManager llmng = fragMain.getLinearLayoutManager(); if (!event.isEdit()) { fmad.insert(event.getNote(), 0); llmng.scrollToPosition(0); } else { int editPosition = fragMain.getEditPosition(); Note editNote = event.getNote(); fmad.setItem(editNote, editPosition); llmng.scrollToPosition(editPosition); } }
private void initFrag() { fragMains[0] = FragMain.newInstance(0); fragMains[1] = FragMain.newInstance(1); }