Search in sources :

Example 1 with CastMember

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

the class FetchTmdbMovieCreditsRunnable method onSuccess.

@Override
public void onSuccess(Credits result) {
    PhilmMovie movie = mMoviesState.getMovie(mId);
    if (movie != null) {
        if (!PhilmCollections.isEmpty(result.cast)) {
            // Sort the Cast based on order first
            Collections.sort(result.cast, new Comparator<CastMember>() {

                @Override
                public int compare(CastMember castMember, CastMember castMember2) {
                    return castMember.order - castMember2.order;
                }
            });
            movie.setCast(getTmdbCastEntityMapper().mapCredits(result.cast));
        }
        if (!PhilmCollections.isEmpty(result.crew)) {
            List<PhilmMovieCredit> crew = getTmdbCrewEntityMapper().mapCredits(result.crew);
            Collections.sort(crew);
            movie.setCrew(crew);
        }
        getEventBus().post(new MoviesState.MovieCastItemsUpdatedEvent(getCallingId(), movie));
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) CastMember(com.uwetrottmann.tmdb.entities.CastMember) PhilmMovieCredit(app.philm.in.model.PhilmMovieCredit) MoviesState(app.philm.in.state.MoviesState)

Example 2 with CastMember

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

the class TmdbCastEntityMapper method mapCredits.

public List<PhilmMovieCredit> mapCredits(List<CastMember> entities) {
    final ArrayList<PhilmMovieCredit> credits = new ArrayList<>(entities.size());
    for (CastMember entity : entities) {
        credits.add(new PhilmMovieCredit(map(entity), entity.character, entity.order));
    }
    Collections.sort(credits);
    return credits;
}
Also used : CastMember(com.uwetrottmann.tmdb.entities.CastMember) PhilmMovieCredit(app.philm.in.model.PhilmMovieCredit) ArrayList(java.util.ArrayList)

Aggregations

PhilmMovieCredit (app.philm.in.model.PhilmMovieCredit)2 CastMember (com.uwetrottmann.tmdb.entities.CastMember)2 PhilmMovie (app.philm.in.model.PhilmMovie)1 MoviesState (app.philm.in.state.MoviesState)1 ArrayList (java.util.ArrayList)1