use of com.faltenreich.diaguard.shared.data.database.entity.EntryTag in project Diaguard by Faltenreich.
the class BaseFragment method onEvent.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(final EntryDeletedEvent event) {
if (getView() == null) {
return;
}
ViewUtils.showSnackbar(getView(), getString(R.string.entry_deleted), v -> {
Entry entry = event.context;
EntryDao.getInstance().createOrUpdate(entry);
for (Measurement measurement : entry.getMeasurementCache()) {
measurement.setEntry(entry);
// noinspection unchecked
MeasurementDao.getInstance(measurement.getClass()).createOrUpdate(measurement);
}
for (EntryTag entryTag : event.entryTags) {
entryTag.setEntry(entry);
EntryTagDao.getInstance().createOrUpdate(entryTag);
}
Events.post(new EntryAddedEvent(entry, event.entryTags, event.foodEatenList));
});
}
Aggregations