Search in sources :

Example 11 with PhilmMovie

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

the class FetchTraktDetailMovieRunnable method onSuccess.

@Override
public void onSuccess(Movie result) {
    PhilmMovie movie = getTraktMovieEntityMapper().map(result);
    movie.markFullFetchCompleted(PhilmModel.TYPE_TRAKT);
    checkPhilmState(movie);
    getDbHelper().put(movie);
    getEventBus().post(new MoviesState.MovieInformationUpdatedEvent(getCallingId(), movie));
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) MoviesState(app.philm.in.state.MoviesState)

Example 12 with PhilmMovie

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

the class FetchTraktDetailMovieRunnable 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 13 with PhilmMovie

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

the class FetchTraktRelatedMoviesRunnable method onSuccess.

@Override
public void onSuccess(List<Movie> result) {
    PhilmMovie movie = mMoviesState.getMovie(mId);
    movie.setRelated(getTraktMovieEntityMapper().mapAll(result));
    getEventBus().post(new MoviesState.MovieRelatedItemsUpdatedEvent(getCallingId(), movie));
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) MoviesState(app.philm.in.state.MoviesState)

Example 14 with PhilmMovie

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

the class FetchTraktWatchingRunnable method onSuccess.

@Override
public void onSuccess(WatchingBase result) {
    if (result.type == ActivityType.Movie && WatchingMovie.validAction(result.action)) {
        PhilmMovie movie = getTraktMovieEntityMapper().map(result.movie);
        if (movie != null) {
            // TODO Fix timestamps
            WatchingMovie watching = new WatchingMovie(movie, WatchingMovie.from(result.action), 0, 0);
            mMoviesState.setWatchingMovie(watching);
        }
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) WatchingMovie(app.philm.in.model.WatchingMovie)

Example 15 with PhilmMovie

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

the class BaseTraktActionRunnable method onSuccessfulAction.

private PhilmMovie onSuccessfulAction(final String movieId) {
    PhilmMovie movie = mMoviesState.getMovie(movieId);
    if (movie != null) {
        movieRequiresModifying(movie);
        checkPhilmState(movie);
        return movie;
    }
    return null;
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie)

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