Search in sources :

Example 1 with PersonCrewCredit

use of com.uwetrottmann.tmdb.entities.PersonCrewCredit in project philm by chrisbanes.

the class FetchTmdbPersonRunnable method onSuccess.

@Override
public void onSuccess(Person result) {
    PhilmPerson person = getTmdbPersonEntityMapper().map(result);
    if (person != null && result.movie_credits != null) {
        if (!PhilmCollections.isEmpty(result.movie_credits.cast)) {
            List<PhilmPersonCredit> credits = new ArrayList<>();
            for (PersonCastCredit credit : result.movie_credits.cast) {
                credits.add(new PhilmPersonCredit(credit));
            }
            Collections.sort(credits, PhilmPersonCredit.COMPARATOR_SORT_DATE);
            person.setCastCredits(credits);
        }
        if (!PhilmCollections.isEmpty(result.movie_credits.crew)) {
            List<PhilmPersonCredit> credits = new ArrayList<>();
            for (PersonCrewCredit credit : result.movie_credits.crew) {
                credits.add(new PhilmPersonCredit(credit));
            }
            Collections.sort(credits, PhilmPersonCredit.COMPARATOR_SORT_DATE);
            person.setCrewCredits(credits);
        }
        person.setFetchedCredits(true);
        getEventBus().post(new MoviesState.PersonChangedEvent(getCallingId(), person));
    }
}
Also used : PersonCastCredit(com.uwetrottmann.tmdb.entities.PersonCastCredit) PersonCrewCredit(com.uwetrottmann.tmdb.entities.PersonCrewCredit) ArrayList(java.util.ArrayList) PhilmPerson(app.philm.in.model.PhilmPerson) PhilmPersonCredit(app.philm.in.model.PhilmPersonCredit) MoviesState(app.philm.in.state.MoviesState)

Example 2 with PersonCrewCredit

use of com.uwetrottmann.tmdb.entities.PersonCrewCredit in project philm by chrisbanes.

the class FetchTmdbPersonCreditsRunnable method onSuccess.

@Override
public void onSuccess(PersonCredits result) {
    PhilmPerson person = mMoviesState.getPerson(mId);
    if (person != null) {
        if (!PhilmCollections.isEmpty(result.cast)) {
            List<PhilmPersonCredit> credits = new ArrayList<>();
            for (PersonCastCredit credit : result.cast) {
                credits.add(new PhilmPersonCredit(credit));
            }
            Collections.sort(credits, PhilmPersonCredit.COMPARATOR_SORT_DATE);
            person.setCastCredits(credits);
        }
        if (!PhilmCollections.isEmpty(result.crew)) {
            List<PhilmPersonCredit> credits = new ArrayList<>();
            for (PersonCrewCredit credit : result.crew) {
                credits.add(new PhilmPersonCredit(credit));
            }
            Collections.sort(credits, PhilmPersonCredit.COMPARATOR_SORT_DATE);
            person.setCrewCredits(credits);
        }
        person.setFetchedCredits(true);
        getEventBus().post(new MoviesState.PersonChangedEvent(getCallingId(), person));
    }
}
Also used : PersonCastCredit(com.uwetrottmann.tmdb.entities.PersonCastCredit) PersonCrewCredit(com.uwetrottmann.tmdb.entities.PersonCrewCredit) ArrayList(java.util.ArrayList) PhilmPerson(app.philm.in.model.PhilmPerson) PhilmPersonCredit(app.philm.in.model.PhilmPersonCredit) MoviesState(app.philm.in.state.MoviesState)

Aggregations

PhilmPerson (app.philm.in.model.PhilmPerson)2 PhilmPersonCredit (app.philm.in.model.PhilmPersonCredit)2 MoviesState (app.philm.in.state.MoviesState)2 PersonCastCredit (com.uwetrottmann.tmdb.entities.PersonCastCredit)2 PersonCrewCredit (com.uwetrottmann.tmdb.entities.PersonCrewCredit)2 ArrayList (java.util.ArrayList)2