use of m.co.rh.id.anavigator.NavRoute in project a-medic-log by rh-id.
the class NoteDetailPage method onClick.
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.input_text_entry_date_time) {
NavExtDialogConfig navExtDialogConfig = mSvProvider.get(NavExtDialogConfig.class);
mNavigator.push(navExtDialogConfig.route_dateTimePickerDialog(), navExtDialogConfig.args_dateTimePickerDialog(true, mNoteState.getNoteEntryDateTime()), (navigator, navRoute, activity, currentView) -> {
Provider provider = (Provider) navigator.getNavConfiguration().getRequiredComponent();
NavExtDialogConfig navExtDialogConfig1 = provider.get(NavExtDialogConfig.class);
Date result = navExtDialogConfig1.result_dateTimePickerDialog(navRoute);
if (result != null) {
updateEntryDateTime(result);
}
});
} else if (id == R.id.button_clear_entry_date_time) {
updateEntryDateTime(null);
} else if (id == R.id.button_share_medicine) {
mRxDisposer.add("onClick_shareMedicine", mQueryNoteCmd.createShareMedicineText(mNoteState).observeOn(AndroidSchedulers.mainThread()).subscribe((s, throwable) -> {
if (throwable != null) {
Throwable cause = throwable.getCause();
if (cause == null)
cause = throwable;
mLogger.e(TAG, cause.getMessage(), cause);
} else {
Context context = mSvProvider.getContext();
UiUtils.shareText(context, s, context.getString(R.string.share_text));
}
}));
} else if (id == R.id.button_add_medicine) {
MedicineDetailPage.Args args;
if (isUpdate()) {
args = MedicineDetailPage.Args.save(getNoteId());
} else {
args = MedicineDetailPage.Args.dontSave();
}
mNavigator.push(Routes.MEDICINE_DETAIL_PAGE, args, (navigator, navRoute, activity, currentView) -> {
MedicineDetailPage.Result result = MedicineDetailPage.Result.of(navRoute);
if (result != null) {
addMedicineState(result.getMedicineState());
}
});
} else if (id == R.id.container_medicine_text || id == R.id.button_expand_medicine) {
mMedicineListShow.onNext(!mMedicineListShow.getValue());
} else if (id == R.id.button_add_note_tag) {
NoteTagDetailSVDialog.Args args;
if (isUpdate()) {
args = NoteTagDetailSVDialog.Args.save(getNoteId());
} else {
args = NoteTagDetailSVDialog.Args.dontSave();
}
mNavigator.push(Routes.NOTE_TAG_DETAIL_DIALOG, args, (navigator, navRoute, activity, currentView) -> {
NoteTagDetailSVDialog.Result result = NoteTagDetailSVDialog.Result.of(navRoute);
if (result != null) {
addNoteTag(result.getNoteTag());
}
});
} else if (id == R.id.container_note_tag_text || id == R.id.button_expand_note_tag) {
mNoteTagShow.onNext(!mNoteTagShow.getValue());
} else if (id == R.id.button_add_attachment) {
NoteAttachmentDetailPage.Args args;
if (isUpdate()) {
args = NoteAttachmentDetailPage.Args.save(getNoteId());
} else {
args = NoteAttachmentDetailPage.Args.dontSave();
}
mNavigator.push(Routes.NOTE_ATTACHMENT_DETAIL_PAGE, args, (navigator, navRoute, activity, currentView) -> {
NoteAttachmentDetailPage.Result result = NoteAttachmentDetailPage.Result.of(navRoute);
if (result != null) {
addNoteAttachment(result.getNoteAttachmentState());
}
});
} else if (id == R.id.container_attachment_text || id == R.id.button_expand_attachment) {
mAttachmentShow.onNext(!mAttachmentShow.getValue());
}
}
Aggregations