Search in sources :

Example 1 with PhilmMovieCredit

use of app.philm.in.model.PhilmMovieCredit 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 PhilmMovieCredit

use of app.philm.in.model.PhilmMovieCredit in project philm by chrisbanes.

the class TmdbCrewEntityMapper method mapCredits.

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

Example 3 with PhilmMovieCredit

use of app.philm.in.model.PhilmMovieCredit 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)

Example 4 with PhilmMovieCredit

use of app.philm.in.model.PhilmMovieCredit in project philm by chrisbanes.

the class MovieCreditSectionedListAdapter method bindView.

@Override
protected void bindView(int position, View view, ListItem<PhilmMovieCredit> item) {
    PhilmMovieCredit credit = item.getListItem();
    final TextView nameTextView = (TextView) view.findViewById(R.id.textview_title);
    nameTextView.setText(credit.getPerson().getName());
    final TextView characterTextView = (TextView) view.findViewById(R.id.textview_subtitle_1);
    characterTextView.setText(credit.getJob());
    final PhilmImageView imageView = (PhilmImageView) view.findViewById(R.id.imageview_poster);
    imageView.setAvatarMode(true);
    imageView.loadProfile(credit.getPerson());
}
Also used : PhilmMovieCredit(app.philm.in.model.PhilmMovieCredit) TextView(android.widget.TextView) PhilmImageView(app.philm.in.view.PhilmImageView)

Aggregations

PhilmMovieCredit (app.philm.in.model.PhilmMovieCredit)4 CastMember (com.uwetrottmann.tmdb.entities.CastMember)2 ArrayList (java.util.ArrayList)2 TextView (android.widget.TextView)1 PhilmMovie (app.philm.in.model.PhilmMovie)1 MoviesState (app.philm.in.state.MoviesState)1 PhilmImageView (app.philm.in.view.PhilmImageView)1 CrewMember (com.uwetrottmann.tmdb.entities.CrewMember)1