Search in sources :

Example 1 with CharacterViewModel

use of com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel in project Rosie by Karumi.

the class CharacterRenderer method render.

@Override
public void render() {
    super.render();
    CharacterViewModel character = getContent();
    nameView.setText(character.getName());
    Picasso.with(getRootView().getContext()).load(character.getThumbnailUrl()).fit().centerCrop().into(avatarView);
}
Also used : CharacterViewModel(com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel)

Example 2 with CharacterViewModel

use of com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel in project Rosie by Karumi.

the class CharactersFragment method initializeAdapter.

private void initializeAdapter() {
    RendererBuilder<CharacterViewModel> rendererBuilder = new CharacterRendererBuilder(presenter);
    charactersCollection = new CharactersAdapteeCollection();
    charactersAdapter = new RVRendererAdapter<>(rendererBuilder, charactersCollection);
}
Also used : CharacterRendererBuilder(com.karumi.rosie.sample.characters.view.renderer.CharacterRendererBuilder) CharacterViewModel(com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel) CharactersAdapteeCollection(com.karumi.rosie.sample.characters.view.renderer.CharactersAdapteeCollection)

Example 3 with CharacterViewModel

use of com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel in project Rosie by Karumi.

the class CharacterRenderer method onItemClicked.

@OnClick(R.id.ll_root)
public void onItemClicked() {
    CharacterViewModel character = getContent();
    presenter.onCharacterClicked(character);
}
Also used : CharacterViewModel(com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel) OnClick(butterknife.OnClick)

Example 4 with CharacterViewModel

use of com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel in project Rosie by Karumi.

the class CharacterToCharacterViewModelMapper method mapCharactersToCharacterViewModels.

public List<CharacterViewModel> mapCharactersToCharacterViewModels(PaginatedCollection<Character> characters) {
    List<CharacterViewModel> characterViewModels = new LinkedList<>();
    for (Character character : characters.getItems()) {
        CharacterViewModel characterViewModel = new CharacterViewModel();
        characterViewModel.setKey(character.getKey());
        characterViewModel.setName(character.getName());
        characterViewModel.setThumbnailUrl(character.getThumbnailUrl());
        characterViewModels.add(characterViewModel);
    }
    return characterViewModels;
}
Also used : Character(com.karumi.rosie.sample.characters.domain.model.Character) CharacterViewModel(com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel) LinkedList(java.util.LinkedList)

Aggregations

CharacterViewModel (com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel)4 OnClick (butterknife.OnClick)1 Character (com.karumi.rosie.sample.characters.domain.model.Character)1 CharacterRendererBuilder (com.karumi.rosie.sample.characters.view.renderer.CharacterRendererBuilder)1 CharactersAdapteeCollection (com.karumi.rosie.sample.characters.view.renderer.CharactersAdapteeCollection)1 LinkedList (java.util.LinkedList)1