Search in sources :

Example 1 with EpisodeViewModel

use of com.github.pedrovgs.sample.viewmodel.EpisodeViewModel in project DraggablePanel by pedrovgs.

the class EpisodeRenderer method render.

/**
   * Render the EpisodeViewModel information.
   */
@Override
protected void render() {
    EpisodeViewModel episode = getContent();
    episodeNumberTextView.setText(String.format("%02d", position + 1));
    episodeTitleTextView.setText(episode.getTitle());
    episodeDateTextView.setText(episode.getPublishDate());
}
Also used : EpisodeViewModel(com.github.pedrovgs.sample.viewmodel.EpisodeViewModel)

Example 2 with EpisodeViewModel

use of com.github.pedrovgs.sample.viewmodel.EpisodeViewModel 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)

Aggregations

EpisodeViewModel (com.github.pedrovgs.sample.viewmodel.EpisodeViewModel)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 Renderer (com.pedrogomez.renderers.Renderer)1 LinkedList (java.util.LinkedList)1