use of com.faltenreich.diaguard.shared.event.data.EntryDeletedEvent in project Diaguard by Faltenreich.
the class EntryEditFragment method deleteEntry.
private void deleteEntry() {
Entry entry = viewModel.getEntry();
if (entry != null) {
EntryDao.getInstance().delete(entry);
finish();
Events.unregister(this);
Events.post(new EntryDeletedEvent(entry, viewModel.getEntryTags(), getFoodEaten()));
}
}
use of com.faltenreich.diaguard.shared.event.data.EntryDeletedEvent in project Diaguard by Faltenreich.
the class LogSwipeCallback method onSwiped.
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
Object item = adapter.getItem(viewHolder.getAdapterPosition());
if (item instanceof LogEntryListItem) {
LogEntryListItem listItem = (LogEntryListItem) item;
Entry entry = listItem.getEntry();
EntryDao.getInstance().delete(entry);
Events.post(new EntryDeletedEvent(entry, listItem.getEntryTags(), listItem.getFoodEatenList()));
}
}
Aggregations