use of de.djuelg.neuronizer.domain.model.preview.TodoListPreview in project Neuronizer by djuelg.
the class PreviewFragment method permanentDeleteItem.
private void permanentDeleteItem(int position) {
if (mAdapter == null || mPresenter == null)
return;
PreviewViewModel adapterItem = mAdapter.getItem(position);
mAdapter.clearSelection();
if (adapterItem != null) {
if (adapterItem.getPreview() instanceof TodoListPreview) {
mPresenter.deleteTodoList(adapterItem.getUuid());
} else if (adapterItem.getPreview() instanceof NotePreview) {
mPresenter.deleteNote(adapterItem.getUuid());
}
mAdapter.removeItem(position);
}
}
use of de.djuelg.neuronizer.domain.model.preview.TodoListPreview in project Neuronizer by djuelg.
the class PreviewRepositoryImpl method constructPreview.
private TodoListPreview constructPreview(Realm realm, TodoListDAO todoListDAO, ItemsPerPreview itemsPerPreview) {
TodoList todoList = RealmConverter.convert(todoListDAO);
Optional<TodoListHeaderDAO> headerDAO = Optional.fromNullable(realm.where(TodoListHeaderDAO.class).equalTo("parentTodoListUuid", todoListDAO.getUuid()).sort("position", Sort.DESCENDING).findFirst());
TodoListHeader header = headerDAO.transform(new TodoListHeaderDAOConverter()).orNull();
List<TodoListItem> items = getItemPreviewOfHeader(realm, header, itemsPerPreview);
return new TodoListPreview(todoList, header, items);
}
Aggregations