use of m.co.rh.id.aprovider.Provider in project a-medic-log by rh-id.
the class NotificationTakeMedicineReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
Provider provider = BaseApplication.of(context).getProvider();
AppNotificationHandler appNotificationHandler = provider.get(AppNotificationHandler.class);
appNotificationHandler.takeMedicine(intent);
}
use of m.co.rh.id.aprovider.Provider in project a-medic-log by rh-id.
the class MedicineReminderDetailPage method onClick.
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.input_text_start_date_time) {
NavExtDialogConfig navExtDialogConfig = mSvProvider.get(NavExtDialogConfig.class);
mNavigator.push(navExtDialogConfig.route_dateTimePickerDialog(), navExtDialogConfig.args_dateTimePickerDialog(true, mMedicineReminderSubject.getValue().startDateTime), (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) {
updateStartDateTime(result);
}
});
} else if (id == R.id.reminder_days_mon) {
LinkedHashSet<Integer> reminderDays = mReminderDaysSubject.getValue();
if (!reminderDays.add(Calendar.MONDAY)) {
reminderDays.remove(Calendar.MONDAY);
}
mReminderDaysSubject.onNext(reminderDays);
} else if (id == R.id.reminder_days_tue) {
LinkedHashSet<Integer> reminderDays = mReminderDaysSubject.getValue();
if (!reminderDays.add(Calendar.TUESDAY)) {
reminderDays.remove(Calendar.TUESDAY);
}
mReminderDaysSubject.onNext(reminderDays);
} else if (id == R.id.reminder_days_wed) {
LinkedHashSet<Integer> reminderDays = mReminderDaysSubject.getValue();
if (!reminderDays.add(Calendar.WEDNESDAY)) {
reminderDays.remove(Calendar.WEDNESDAY);
}
mReminderDaysSubject.onNext(reminderDays);
} else if (id == R.id.reminder_days_thu) {
LinkedHashSet<Integer> reminderDays = mReminderDaysSubject.getValue();
if (!reminderDays.add(Calendar.THURSDAY)) {
reminderDays.remove(Calendar.THURSDAY);
}
mReminderDaysSubject.onNext(reminderDays);
} else if (id == R.id.reminder_days_fri) {
LinkedHashSet<Integer> reminderDays = mReminderDaysSubject.getValue();
if (!reminderDays.add(Calendar.FRIDAY)) {
reminderDays.remove(Calendar.FRIDAY);
}
mReminderDaysSubject.onNext(reminderDays);
} else if (id == R.id.reminder_days_sat) {
LinkedHashSet<Integer> reminderDays = mReminderDaysSubject.getValue();
if (!reminderDays.add(Calendar.SATURDAY)) {
reminderDays.remove(Calendar.SATURDAY);
}
mReminderDaysSubject.onNext(reminderDays);
} else if (id == R.id.reminder_days_sun) {
LinkedHashSet<Integer> reminderDays = mReminderDaysSubject.getValue();
if (!reminderDays.add(Calendar.SUNDAY)) {
reminderDays.remove(Calendar.SUNDAY);
}
mReminderDaysSubject.onNext(reminderDays);
}
}
use of m.co.rh.id.aprovider.Provider 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());
}
}
use of m.co.rh.id.aprovider.Provider in project a-medic-log by rh-id.
the class MedicineDetailPage method onDeleteClick.
@Override
public void onDeleteClick(MedicineReminder medicineReminder) {
if (isUpdate() && shouldSave()) {
Context context = mSvProvider.getContext();
String title = context.getString(R.string.title_confirm);
String content = context.getString(R.string.confirm_delete_medicine_reminder, medicineReminder.message);
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) {
confirmDeleteMedicineReminder(medicineReminder);
}
});
} else {
mMedicineReminderRecyclerViewAdapter.notifyItemDeleted(medicineReminder);
}
}
Aggregations