Search in sources :

Example 1 with ComicSeriesViewModel

use of com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel in project Rosie by Karumi.

the class ComicSeriesFragment method initializeAdapter.

private void initializeAdapter() {
    RendererBuilder<ComicSeriesViewModel> rendererBuilder = new ComicSeriesRendererBuilder(presenter);
    comicsCollection = new ComicsSeriesAdapteeCollection();
    comicSeriesAdapter = new RVRendererAdapter<>(rendererBuilder, comicsCollection);
}
Also used : ComicSeriesRendererBuilder(com.karumi.rosie.sample.comics.view.renderer.ComicSeriesRendererBuilder) ComicsSeriesAdapteeCollection(com.karumi.rosie.sample.comics.view.renderer.ComicsSeriesAdapteeCollection) ComicSeriesViewModel(com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel)

Example 2 with ComicSeriesViewModel

use of com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel in project Rosie by Karumi.

the class ComicSeriesRenderer method render.

@Override
public void render() {
    super.render();
    ComicSeriesViewModel comicSeries = getContent();
    nameView.setText(comicSeries.getTitle());
}
Also used : ComicSeriesViewModel(com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel)

Example 3 with ComicSeriesViewModel

use of com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel in project Rosie by Karumi.

the class ComicSeriesRenderer method onItemClicked.

@OnClick(R.id.ll_root)
public void onItemClicked() {
    ComicSeriesViewModel comicSeries = getContent();
    presenter.onComicSeriesClicked(comicSeries);
}
Also used : ComicSeriesViewModel(com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel) OnClick(butterknife.OnClick)

Example 4 with ComicSeriesViewModel

use of com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel in project Rosie by Karumi.

the class ComicSeriesToComicSeriesViewModelMapper method mapComicSeriesToComicSeriesViewModels.

public List<ComicSeriesViewModel> mapComicSeriesToComicSeriesViewModels(PaginatedCollection<ComicSeries> comics) {
    List<ComicSeriesViewModel> comicSeriesViewModels = new LinkedList<>();
    for (ComicSeries comicSeries : comics.getItems()) {
        ComicSeriesViewModel comicSeriesViewModel = new ComicSeriesViewModel();
        comicSeriesViewModel.setKey(comicSeries.getKey());
        String titleFormatted = String.format("%1$s (%2$s)", comicSeries.getName(), comicSeries.getReleaseYear());
        comicSeriesViewModel.setTitle(titleFormatted);
        comicSeriesViewModel.setCoverUrl(comicSeries.getCoverUrl());
        comicSeriesViewModels.add(comicSeriesViewModel);
    }
    return comicSeriesViewModels;
}
Also used : ComicSeries(com.karumi.rosie.sample.comics.domain.model.ComicSeries) ComicSeriesViewModel(com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel) LinkedList(java.util.LinkedList)

Aggregations

ComicSeriesViewModel (com.karumi.rosie.sample.comics.view.viewmodel.ComicSeriesViewModel)4 OnClick (butterknife.OnClick)1 ComicSeries (com.karumi.rosie.sample.comics.domain.model.ComicSeries)1 ComicSeriesRendererBuilder (com.karumi.rosie.sample.comics.view.renderer.ComicSeriesRendererBuilder)1 ComicsSeriesAdapteeCollection (com.karumi.rosie.sample.comics.view.renderer.ComicsSeriesAdapteeCollection)1 LinkedList (java.util.LinkedList)1