use of m.co.rh.id.a_medic_log.app.ui.component.note.attachment.NoteAttachmentRecyclerViewAdapter in project a-medic-log by rh-id.
the class NoteDetailPage method provideComponent.
@Override
public void provideComponent(Provider provider) {
mExecutorService = provider.get(ExecutorService.class);
mSvProvider = provider.get(StatefulViewProvider.class);
mLogger = mSvProvider.get(ILogger.class);
mRxDisposer = mSvProvider.get(RxDisposer.class);
mMedicineReminderChangeNotifier = mSvProvider.get(MedicineReminderChangeNotifier.class);
mNoteAttachmentFileChangeNotifier = mSvProvider.get(NoteAttachmentFileChangeNotifier.class);
mQueryNoteCmd = mSvProvider.get(QueryNoteCmd.class);
boolean isUpdate = isUpdate();
if (isUpdate) {
mNewNoteCmd = mSvProvider.get(UpdateNoteCmd.class);
} else {
mNewNoteCmd = mSvProvider.get(NewNoteCmd.class);
}
mDeleteNoteTagCmd = mSvProvider.get(DeleteNoteTagCmd.class);
mDeleteNoteAttachmentCmd = mSvProvider.get(DeleteNoteAttachmentCmd.class);
if (mNoteState == null) {
mNoteState = new NoteState();
if (isUpdate) {
mNoteState.setNoteId(getNoteId());
mRxDisposer.add("provideComponent_queryNoteInfo", mQueryNoteCmd.queryNoteInfo(mNoteState).subscribe((noteState, throwable) -> {
if (throwable != null) {
mLogger.e(TAG, throwable.getMessage(), throwable);
}
}));
} else {
mNoteState.setNoteProfileId(getProfileId());
}
}
if (mAppBarSv == null) {
mAppBarSv = new AppBarSV(R.menu.page_note_detail);
}
if (isUpdate) {
mAppBarSv.setTitle(mNavigator.getActivity().getString(R.string.title_update_note));
} else {
mAppBarSv.setTitle(mNavigator.getActivity().getString(R.string.title_add_note));
}
mAppBarSv.setMenuItemListener(this);
initTextWatcher();
mMedicineRecyclerViewAdapter = new MedicineRecyclerViewAdapter(mNoteState, this, this, this, this, mNavigator, this);
mNoteAttachmentRecyclerViewAdapter = new NoteAttachmentRecyclerViewAdapter(mNoteState, this, this, mNavigator, this);
mCompositeDisposable = new CompositeDisposable();
}
Aggregations