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);
}
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));
}
}
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));
}
}
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));
}
}
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));
}
}
Aggregations