use of de.djuelg.neuronizer.domain.model.todolist.TodoListSection in project Neuronizer by djuelg.
the class DisplayTodoListPresenterImpl method onTodoListRetrieved.
@Override
public void onTodoListRetrieved(List<TodoListSection> sections) {
Collections.sort(sections, new PositionComparator());
List<AbstractFlexibleItem> headerVMs = new ArrayList<>(sections.size());
for (TodoListSection section : sections) {
TodoListHeaderViewModel headerVM = new TodoListHeaderViewModel(section.getHeader());
headerVM.setSubItems(createSubItemList(headerVM, Lists.newArrayList(section.getItems())));
headerVMs.add(headerVM);
}
mView.onTodoListLoaded(headerVMs);
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListSection in project Neuronizer by djuelg.
the class WidgetListFactory method onDataSetChanged.
@Override
public void onDataSetChanged() {
itemList.clear();
List<TodoListSection> sections = Lists.newArrayList(repository.getSectionsOfTodoListId(uuid));
Collections.sort(sections, new PositionComparator());
for (TodoListSection section : sections) {
itemList.add(section.getHeader());
List<TodoListItem> items = Lists.newArrayList(section.getItems());
Collections.sort(items, new PositionComparator());
itemList.addAll(items);
}
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListSection in project Neuronizer by djuelg.
the class TodoListRepositoryImpl method getSectionsOfTodoListId.
@Override
public List<TodoListSection> getSectionsOfTodoListId(String uuid) {
Realm realm = Realm.getInstance(configuration);
RealmResults<TodoListHeaderDAO> headerDAOs = realm.where(TodoListHeaderDAO.class).equalTo("parentTodoListUuid", uuid).findAll();
List<TodoListSection> sections = new ArrayList<>(headerDAOs.size());
for (TodoListHeaderDAO dao : headerDAOs) {
sections.add(constructSection(realm, dao));
}
realm.close();
return sections;
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListSection in project Neuronizer by djuelg.
the class TodoListRepositoryImpl method constructSection.
private TodoListSection constructSection(Realm realm, TodoListHeaderDAO headerDAO) {
RealmResults<TodoListItemDAO> itemDAOs = realm.where(TodoListItemDAO.class).equalTo("parentTodoListUuid", headerDAO.getParentTodoListUuid()).equalTo("parentHeaderUuid", headerDAO.getUuid()).findAll();
List<TodoListItem> items = new ArrayList<>(itemDAOs.size());
TodoListHeader header = RealmConverter.convert(headerDAO);
for (TodoListItemDAO dao : itemDAOs) {
items.add(RealmConverter.convert(dao));
}
return new TodoListSection(header, items);
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListSection in project Neuronizer by djuelg.
the class TodoListRepositoryMock method getSectionsOfTodoListId.
@Override
public // - are presenters tested? if yes then test DisplayTodoListPresenter
List<TodoListSection> getSectionsOfTodoListId(String uuid) {
List<TodoListSection> sections = new ArrayList<>(1);
List<TodoListItem> items = new ArrayList<TodoListItem>(1);
items.add(alwaysSameItem);
sections.add(new TodoListSection(alwaysSameHeader, items));
return sections;
}
Aggregations