use of m.co.rh.id.aprovider.Provider 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.aprovider.Provider in project a-medic-log by rh-id.
the class NotificationDeleteReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
Provider provider = BaseApplication.of(context).getProvider();
AppNotificationHandler appNotificationHandler = provider.get(AppNotificationHandler.class);
appNotificationHandler.removeNotification(intent);
}
use of m.co.rh.id.aprovider.Provider in project a-medic-log by rh-id.
the class NotificationDisableMedicineReminderReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
Provider provider = BaseApplication.of(context).getProvider();
AppNotificationHandler appNotificationHandler = provider.get(AppNotificationHandler.class);
appNotificationHandler.disableMedicineReminder(intent);
}
use of m.co.rh.id.aprovider.Provider 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();
}));
}
});
}
}
use of m.co.rh.id.aprovider.Provider in project a-medic-log by rh-id.
the class ProfileItemSV method onClick.
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.root_layout) {
if (mListMode != null) {
mIsSelected = true;
if (mSelectedUiButton != null) {
mSelectedUiButton.setChecked(mIsSelected);
}
if (mOnItemSelectListener != null) {
mOnItemSelectListener.onItemSelect(mProfile, mIsSelected);
}
} else {
mNavigator.push(Routes.NOTES_PAGE, NoteListPage.Args.withProfileId(mProfile.id));
}
} else if (id == R.id.button_edit) {
mNavigator.push(Routes.PROFILE_DETAIL_PAGE, ProfileDetailPage.Args.forUpdate(mProfile.clone()), (navigator, navRoute, activity, currentView) -> {
ProfileDetailPage.Result result = ProfileDetailPage.Result.of(navRoute.getRouteResult());
if (result != null) {
setProfile(result.getProfile());
}
});
} 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_profile, mProfile.name);
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(DeleteProfileCmd.class).execute(mProfile).observeOn(AndroidSchedulers.mainThread()).subscribe((card, throwable) -> {
Context deleteContext = provider.getContext();
if (throwable != null) {
provider.get(ILogger.class).e(TAG, deleteContext.getString(R.string.error_deleting_profile), throwable);
} else {
provider.get(ILogger.class).i(TAG, deleteContext.getString(R.string.success_deleting_profile, card.name));
}
compositeDisposable.dispose();
}));
}
});
}
}
Aggregations