use of de.djuelg.neuronizer.domain.model.preview.Preview in project Neuronizer by djuelg.
the class PreviewRepositoryImplTest method testGetPreviewManyItemsPerPreview.
@Test
public void testGetPreviewManyItemsPerPreview() {
Iterable<Preview> previews = repository.getAll(new ItemsPerPreview(100));
assertEquals("Header 1", previews.iterator().next().getSubtitle());
assertEquals(1, Lists.newArrayList(previews).size());
}
use of de.djuelg.neuronizer.domain.model.preview.Preview in project Neuronizer by djuelg.
the class DisplayPreviewInteractorImpl method run.
@Override
public void run() {
Iterable<Preview> previews = repository.preview().getAll(new ItemsPerPreview(MAX_DISPLAYED_ITEMS));
postPreviews(previews);
}
use of de.djuelg.neuronizer.domain.model.preview.Preview in project Neuronizer by djuelg.
the class PreviewRepositoryImpl method getAll.
@Override
public Iterable<Preview> getAll(ItemsPerPreview itemsPerPreview) {
Realm realm = Realm.getInstance(configuration);
RealmResults<TodoListDAO> allTodoListDAO = realm.where(TodoListDAO.class).findAllSorted("position", Sort.DESCENDING);
RealmResults<NoteDAO> allNoteDAO = realm.where(NoteDAO.class).findAllSorted("position", Sort.DESCENDING);
List<Preview> previews = new ArrayList<>(allTodoListDAO.size() + allNoteDAO.size());
for (TodoListDAO todoListDAO : allTodoListDAO) {
previews.add(constructPreview(realm, todoListDAO, itemsPerPreview));
}
for (NoteDAO noteDAO : allNoteDAO) {
previews.add(new NotePreview(RealmConverter.convert(noteDAO)));
}
realm.close();
return previews;
}
use of de.djuelg.neuronizer.domain.model.preview.Preview in project Neuronizer by djuelg.
the class DisplayPreviewPresenterImpl method onPreviewsRetrieved.
@Override
public void onPreviewsRetrieved(List<Preview> previews) {
List<PreviewViewModel> previewVMs = new ArrayList<>();
for (Preview preview : previews) {
previewVMs.add(new PreviewViewModel(preview));
}
mView.onPreviewsLoaded(previewVMs);
}
use of de.djuelg.neuronizer.domain.model.preview.Preview in project Neuronizer by djuelg.
the class PreviewRepositoryImplTest method testEmptyGetPreview.
@Test
public void testEmptyGetPreview() {
clearRealm();
Iterable<Preview> previews = repository.getAll(new ItemsPerPreview(0));
assertEquals(false, previews.iterator().hasNext());
fillRealm();
}
Aggregations