Search in sources :

Example 11 with Character

use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.

the class CharactersFakeDataSource method getStorm.

@NonNull
private Character getStorm() {
    Character storm = new Character();
    storm.setKey(STORM_KEY);
    storm.setName("Storm");
    storm.setThumbnailUrl("https://x.annihil.us/u/prod/marvel/i/mg/c/b0/537bc5f8a8df0.jpg");
    storm.setDescription("Ororo Monroe is the descendant of an ancient line of African priestesses, all of whom " + "have white hair, blue eyes, and the potential to wield magic. Her mother, N'dare, " + "was an African princess who married American photojournalist David Monroe and moved " + "with him to Manhattan, where Ororo was born. When Ororo was six months old, she and " + "her parents moved to Cairo, Egypt. Five years later, during the Arab-Israeli " + "conflict, a plane crashed into their home. Ororo's parents were killed, but she " + "survived, buried under rubble near her mother's body. The resultant trauma left " + "Ororo with severe claustrophobia that still affects her today.");
    return storm;
}
Also used : Character(com.karumi.rosie.sample.characters.domain.model.Character) NonNull(android.support.annotation.NonNull)

Example 12 with Character

use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.

the class CharactersFakeDataSource method getWolverine.

@NonNull
private Character getWolverine() {
    Character wolverine = new Character();
    wolverine.setKey(WOLVERINE_KEY);
    wolverine.setName("Wolverine");
    wolverine.setThumbnailUrl("https://i.annihil.us/u/prod/marvel/i/mg/9/00/537bcb1133fd7.jpg");
    wolverine.setDescription("Born the second son of wealthy landowners John and Elizabeth Howlett in Alberta, Canada " + "during the late 19th Century, James Howlett was a frail boy of poor health. James " + "was largely neglected by his mother, who was institutionalized for a time " + "following the death of her first son, John Jr., in 1897. He spent most of " + "his early years on the estate grounds and had two playmates that lived on the " + "Howlett estate with him: Rose, a red-headed girl who was brought in from town " + "to be a companion to young James, and a boy nicknamed \"Dog\" who was the son of " + "the groundskeeper, Thomas Logan. Thomas Logan was an alcoholic and was extremely " + "abusive to his son. The children were close friends but as they reached young " + "adulthood, the abuse inflicted upon Dog warped his mind. His actions would lead to" + " a tragic chain of events. that started as the three neared their adolescent years " + "when Dog made unwanted advances toward Rose and James reported it to his father." + " In retaliation Dog killed James's pet dog. This in turn resulted in the expulsion " + "of Thomas Logan and Dog Logan from the estate.");
    return wolverine;
}
Also used : Character(com.karumi.rosie.sample.characters.domain.model.Character) NonNull(android.support.annotation.NonNull)

Example 13 with Character

use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.

the class CharacterToCharacterDtoMapper method reverseMap.

@Override
public Character reverseMap(CharacterDto value) {
    Character character = new Character();
    character.setKey(value.getId());
    character.setName(value.getName());
    character.setDescription(value.getDescription());
    character.setThumbnailUrl(value.getThumbnail().getImageUrl(MarvelImage.Size.PORTRAIT_UNCANNY));
    return character;
}
Also used : Character(com.karumi.rosie.sample.characters.domain.model.Character)

Example 14 with Character

use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.

the class CharacterDetailsPresenter method loadCharacterDetails.

private void loadCharacterDetails() {
    getView().hideCharacterDetail();
    createUseCaseCall(getCharacterDetails).args(characterKey).onSuccess(new OnSuccessCallback() {

        @Success
        public void onCharacterDetailsLoaded(Character character) {
            hideLoading();
            CharacterDetailViewModel characterDetailViewModel = mapper.mapCharacterToCharacterDetailViewModel(character);
            getView().showCharacterDetail(characterDetailViewModel);
        }
    }).onError(new OnErrorCallback() {

        @Override
        public boolean onError(Error error) {
            getView().hideLoading();
            return false;
        }
    }).execute();
}
Also used : OnErrorCallback(com.karumi.rosie.domain.usecase.error.OnErrorCallback) Character(com.karumi.rosie.sample.characters.domain.model.Character) CharacterDetailViewModel(com.karumi.rosie.sample.characters.view.viewmodel.CharacterDetailViewModel) OnSuccessCallback(com.karumi.rosie.domain.usecase.callback.OnSuccessCallback) Success(com.karumi.rosie.domain.usecase.annotation.Success)

Example 15 with Character

use of com.karumi.rosie.sample.characters.domain.model.Character 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

Character (com.karumi.rosie.sample.characters.domain.model.Character)23 NonNull (android.support.annotation.NonNull)10 Page (com.karumi.rosie.repository.datasource.paginated.Page)4 PaginatedCollection (com.karumi.rosie.repository.PaginatedCollection)3 MarvelApiException (com.karumi.marvelapiclient.MarvelApiException)2 InjectedInstrumentationTest (com.karumi.rosie.sample.InjectedInstrumentationTest)2 LinkedList (java.util.LinkedList)2 Test (org.junit.Test)2 LargeTest (android.test.suitebuilder.annotation.LargeTest)1 CharactersDto (com.karumi.marvelapiclient.model.CharactersDto)1 RosieUseCase (com.karumi.rosie.domain.usecase.RosieUseCase)1 Success (com.karumi.rosie.domain.usecase.annotation.Success)1 UseCase (com.karumi.rosie.domain.usecase.annotation.UseCase)1 OnSuccessCallback (com.karumi.rosie.domain.usecase.callback.OnSuccessCallback)1 OnErrorCallback (com.karumi.rosie.domain.usecase.error.OnErrorCallback)1 CharacterDetailViewModel (com.karumi.rosie.sample.characters.view.viewmodel.CharacterDetailViewModel)1 CharacterViewModel (com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1