Search in sources :

Example 6 with PhilmMovie

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

the class FetchTmdbDetailMovieRunnable method onError.

@Override
public void onError(RetrofitError re) {
    if (re.getResponse() != null && re.getResponse().getStatus() == 404) {
        PhilmMovie movie = mMoviesState.getMovie(mId);
        if (movie != null) {
            getDbHelper().put(movie);
            getEventBus().post(new MoviesState.MovieInformationUpdatedEvent(getCallingId(), movie));
        }
    }
    super.onError(re);
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) MoviesState(app.philm.in.state.MoviesState)

Example 7 with PhilmMovie

use of app.philm.in.model.PhilmMovie 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 8 with PhilmMovie

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

the class FetchTmdbMovieImagesRunnable method onSuccess.

@Override
public void onSuccess(Images result) {
    PhilmMovie movie = mMoviesState.getMovie(mId);
    if (movie != null) {
        if (!PhilmCollections.isEmpty(result.backdrops)) {
            List<PhilmMovie.BackdropImage> backdrops = new ArrayList<>();
            for (Image image : result.backdrops) {
                backdrops.add(new PhilmMovie.BackdropImage(image));
            }
            movie.setBackdropImages(backdrops);
        }
        getEventBus().post(new MoviesState.MovieImagesUpdatedEvent(getCallingId(), movie));
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) ArrayList(java.util.ArrayList) Image(com.uwetrottmann.tmdb.entities.Image) MoviesState(app.philm.in.state.MoviesState)

Example 9 with PhilmMovie

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

the class FetchTmdbMovieTrailersRunnable method onSuccess.

@Override
public void onSuccess(Videos result) {
    PhilmMovie movie = mMoviesState.getMovie(mId);
    if (movie != null) {
        movie.updateWithVideos(result);
        getEventBus().post(new MoviesState.MovieVideosItemsUpdatedEvent(getCallingId(), movie));
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) MoviesState(app.philm.in.state.MoviesState)

Example 10 with PhilmMovie

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

the class FetchTmdbRelatedMoviesRunnable method onError.

@Override
public void onError(RetrofitError re) {
    super.onError(re);
    PhilmMovie movie = mMoviesState.getMovie(String.valueOf(mId));
    if (movie != null) {
        getEventBus().post(new MoviesState.MovieRelatedItemsUpdatedEvent(getCallingId(), movie));
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) MoviesState(app.philm.in.state.MoviesState)

Aggregations

PhilmMovie (app.philm.in.model.PhilmMovie)39 MoviesState (app.philm.in.state.MoviesState)17 ArrayList (java.util.ArrayList)4 TextView (android.widget.TextView)2 WatchingMovie (app.philm.in.model.WatchingMovie)2 PhilmImageView (app.philm.in.view.PhilmImageView)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1 Bitmap (android.graphics.Bitmap)1 Bundle (android.os.Bundle)1 View (android.view.View)1 Display (app.philm.in.Display)1 ColorScheme (app.philm.in.model.ColorScheme)1 PhilmMovieCredit (app.philm.in.model.PhilmMovieCredit)1 PhilmMovieVideo (app.philm.in.model.PhilmMovieVideo)1 PhilmPerson (app.philm.in.model.PhilmPerson)1 PhilmPersonCredit (app.philm.in.model.PhilmPersonCredit)1 PhilmUserProfile (app.philm.in.model.PhilmUserProfile)1 FetchTmdbDetailMovieRunnable (app.philm.in.tasks.FetchTmdbDetailMovieRunnable)1 FetchTmdbMovieImagesRunnable (app.philm.in.tasks.FetchTmdbMovieImagesRunnable)1 FetchTraktDetailMovieRunnable (app.philm.in.tasks.FetchTraktDetailMovieRunnable)1