use of m.co.rh.id.anavigator.extension.dialog.ui.NavExtDialogConfig in project a-medic-log by rh-id.
the class NoteDetailPage method noteAttachment_onDeleteClick.
@Override
public void noteAttachment_onDeleteClick(NoteAttachmentState noteAttachmentState) {
if (isUpdate()) {
Context context = mSvProvider.getContext();
String title = context.getString(R.string.title_confirm);
String content = context.getString(R.string.confirm_delete_attachment);
NavExtDialogConfig navExtDialogConfig = mSvProvider.get(NavExtDialogConfig.class);
mNavigator.push(navExtDialogConfig.route_confirmDialog(), navExtDialogConfig.args_confirmDialog(title, content), (navigator, navRoute, activity, currentView) -> {
Provider provider = (Provider) navigator.getNavConfiguration().getRequiredComponent();
Boolean result = provider.get(NavExtDialogConfig.class).result_confirmDialog(navRoute);
if (result != null && result) {
deleteNoteAttachment(noteAttachmentState);
}
});
} else {
mNoteAttachmentRecyclerViewAdapter.notifyItemDeleted(noteAttachmentState);
}
}
use of m.co.rh.id.anavigator.extension.dialog.ui.NavExtDialogConfig in project a-medic-log by rh-id.
the class NoteDetailPage method medicineItem_onDeleteClick.
@Override
public void medicineItem_onDeleteClick(MedicineState medicineState) {
if (isUpdate()) {
Context context = mSvProvider.getContext();
String title = context.getString(R.string.title_confirm);
String content = context.getString(R.string.confirm_delete_medicine, medicineState.getMedicineName());
NavExtDialogConfig navExtDialogConfig = mSvProvider.get(NavExtDialogConfig.class);
mNavigator.push(navExtDialogConfig.route_confirmDialog(), navExtDialogConfig.args_confirmDialog(title, content), (navigator, navRoute, activity, currentView) -> {
Provider provider = (Provider) navigator.getNavConfiguration().getRequiredComponent();
Boolean result = provider.get(NavExtDialogConfig.class).result_confirmDialog(navRoute);
if (result != null && result) {
confirmDeleteMedicine(medicineState);
}
});
} else {
mMedicineRecyclerViewAdapter.notifyItemDeleted(medicineState);
}
}
use of m.co.rh.id.anavigator.extension.dialog.ui.NavExtDialogConfig in project a-medic-log by rh-id.
the class MedicineIntakeDetailPage method onClick.
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.input_text_taken_date_time) {
NavExtDialogConfig navExtDialogConfig = mSvProvider.get(NavExtDialogConfig.class);
mNavigator.push(navExtDialogConfig.route_dateTimePickerDialog(), navExtDialogConfig.args_dateTimePickerDialog(true, mMedicineIntakeSubject.getValue().takenDateTime), (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) {
updateTakenDateTime(result);
}
});
}
}
use of m.co.rh.id.anavigator.extension.dialog.ui.NavExtDialogConfig in project a-medic-log by rh-id.
the class MedicineIntakeListSV method onDeleteClick.
@Override
public void onDeleteClick(MedicineIntake medicineIntake) {
Context context = mSvProvider.getContext();
String title = context.getString(R.string.title_confirm);
String content = context.getString(R.string.confirm_delete_medicine_intake, medicineIntake.description);
NavExtDialogConfig navExtDialogConfig = mSvProvider.get(NavExtDialogConfig.class);
mNavigator.push(navExtDialogConfig.route_confirmDialog(), navExtDialogConfig.args_confirmDialog(title, content), (navigator, navRoute, activity, currentView) -> {
Provider provider = (Provider) navigator.getNavConfiguration().getRequiredComponent();
Boolean result = provider.get(NavExtDialogConfig.class).result_confirmDialog(navRoute);
if (result != null && result) {
confirmDeleteMedicineIntake(medicineIntake);
}
});
}
use of m.co.rh.id.anavigator.extension.dialog.ui.NavExtDialogConfig in project a-medic-log by rh-id.
the class NoteItemSV method onClick.
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.button_edit) {
mNavigator.push(Routes.NOTE_DETAIL_PAGE, NoteDetailPage.Args.forUpdate(mNoteSubject.getValue().id));
} else if (id == R.id.button_delete) {
Context context = mSvProvider.getContext();
String title = context.getString(R.string.title_confirm);
String content = context.getString(R.string.confirm_delete_note);
NavExtDialogConfig navExtDialogConfig = mSvProvider.get(NavExtDialogConfig.class);
mNavigator.push(navExtDialogConfig.route_confirmDialog(), navExtDialogConfig.args_confirmDialog(title, content), (navigator, navRoute, activity, currentView) -> {
Provider provider = (Provider) navigator.getNavConfiguration().getRequiredComponent();
Boolean result = provider.get(NavExtDialogConfig.class).result_confirmDialog(navRoute);
if (result != null && result) {
CompositeDisposable compositeDisposable = new CompositeDisposable();
compositeDisposable.add(provider.get(DeleteNoteCmd.class).execute(mNoteSubject.getValue()).observeOn(AndroidSchedulers.mainThread()).subscribe((note, throwable) -> {
Context deleteContext = provider.getContext();
if (throwable != null) {
provider.get(ILogger.class).e(TAG, deleteContext.getString(R.string.error_deleting_note), throwable);
} else {
provider.get(ILogger.class).i(TAG, deleteContext.getString(R.string.success_deleting_note));
}
compositeDisposable.dispose();
}));
}
});
}
}
Aggregations