Search in sources :

Example 1 with Renderer

use of com.pedrogomez.renderers.Renderer in project DraggablePanel by pedrovgs.

the class MainModule method providePlaceCollectionRendererBuilder.

/**
   * Provisioning of a RendererBuilder implementation to work with places ListView. More
   * information in this library: {@link https://github.com/pedrovgs/Renderers}
   */
@Provides
protected PlacesCollectionRendererBuilder providePlaceCollectionRendererBuilder(Context context) {
    List<Renderer<PlaceViewModel>> prototypes = new LinkedList<Renderer<PlaceViewModel>>();
    prototypes.add(new PlaceRenderer(context));
    return new PlacesCollectionRendererBuilder(prototypes);
}
Also used : PlacesCollectionRendererBuilder(com.github.pedrovgs.sample.renderer.rendererbuilder.PlacesCollectionRendererBuilder) PlaceViewModel(com.github.pedrovgs.sample.viewmodel.PlaceViewModel) PlaceRenderer(com.github.pedrovgs.sample.renderer.PlaceRenderer) PlaceRenderer(com.github.pedrovgs.sample.renderer.PlaceRenderer) Renderer(com.pedrogomez.renderers.Renderer) TvShowRenderer(com.github.pedrovgs.sample.renderer.TvShowRenderer) LinkedList(java.util.LinkedList) Provides(dagger.Provides)

Example 2 with Renderer

use of com.pedrogomez.renderers.Renderer in project DraggablePanel by pedrovgs.

the class TvShowsActivity method renderEpisodes.

/**
   * Render a list of episodes using a tv show view model with the information. This method create
   * an adapter with the episodes information to be inserted in the ListView.
   *
   * @param tvShow to render
   */
private void renderEpisodes(final TvShowViewModel tvShow) {
    List<Renderer<EpisodeViewModel>> episodeRenderers = new LinkedList<Renderer<EpisodeViewModel>>();
    episodeRenderers.add(new EpisodeRenderer());
    EpisodeRendererBuilder episodeRendererBuilder = new EpisodeRendererBuilder(episodeRenderers);
    EpisodeRendererAdapter episodesAdapter = new EpisodeRendererAdapter(getLayoutInflater(), episodeRendererBuilder, tvShow.getEpisodes());
    episodesListView.setAdapter(episodesAdapter);
}
Also used : EpisodeViewModel(com.github.pedrovgs.sample.viewmodel.EpisodeViewModel) EpisodeRenderer(com.github.pedrovgs.sample.renderer.EpisodeRenderer) Renderer(com.pedrogomez.renderers.Renderer) EpisodeRenderer(com.github.pedrovgs.sample.renderer.EpisodeRenderer) EpisodeRendererBuilder(com.github.pedrovgs.sample.renderer.rendererbuilder.EpisodeRendererBuilder) EpisodeRendererAdapter(com.github.pedrovgs.sample.renderer.EpisodeRendererAdapter) LinkedList(java.util.LinkedList)

Example 3 with Renderer

use of com.pedrogomez.renderers.Renderer in project DraggablePanel by pedrovgs.

the class MainModule method provideTvShowCollectionRendererBuilder.

/**
   * Provisioning of a RendererBuilder implementation to work with tv shows ListView. More
   * information in this library: {@link https://github.com/pedrovgs/Renderers}
   */
@Provides
protected TvShowCollectionRendererBuilder provideTvShowCollectionRendererBuilder(Context context) {
    List<Renderer<TvShowViewModel>> prototypes = new LinkedList<Renderer<TvShowViewModel>>();
    prototypes.add(new TvShowRenderer(context));
    return new TvShowCollectionRendererBuilder(prototypes);
}
Also used : PlaceRenderer(com.github.pedrovgs.sample.renderer.PlaceRenderer) Renderer(com.pedrogomez.renderers.Renderer) TvShowRenderer(com.github.pedrovgs.sample.renderer.TvShowRenderer) TvShowViewModel(com.github.pedrovgs.sample.viewmodel.TvShowViewModel) TvShowCollectionRendererBuilder(com.github.pedrovgs.sample.renderer.rendererbuilder.TvShowCollectionRendererBuilder) TvShowRenderer(com.github.pedrovgs.sample.renderer.TvShowRenderer) LinkedList(java.util.LinkedList) Provides(dagger.Provides)

Aggregations

Renderer (com.pedrogomez.renderers.Renderer)3 LinkedList (java.util.LinkedList)3 PlaceRenderer (com.github.pedrovgs.sample.renderer.PlaceRenderer)2 TvShowRenderer (com.github.pedrovgs.sample.renderer.TvShowRenderer)2 Provides (dagger.Provides)2 EpisodeRenderer (com.github.pedrovgs.sample.renderer.EpisodeRenderer)1 EpisodeRendererAdapter (com.github.pedrovgs.sample.renderer.EpisodeRendererAdapter)1 EpisodeRendererBuilder (com.github.pedrovgs.sample.renderer.rendererbuilder.EpisodeRendererBuilder)1 PlacesCollectionRendererBuilder (com.github.pedrovgs.sample.renderer.rendererbuilder.PlacesCollectionRendererBuilder)1 TvShowCollectionRendererBuilder (com.github.pedrovgs.sample.renderer.rendererbuilder.TvShowCollectionRendererBuilder)1 EpisodeViewModel (com.github.pedrovgs.sample.viewmodel.EpisodeViewModel)1 PlaceViewModel (com.github.pedrovgs.sample.viewmodel.PlaceViewModel)1 TvShowViewModel (com.github.pedrovgs.sample.viewmodel.TvShowViewModel)1