Search in sources :

Example 36 with PhilmMovie

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

the class MovieController method filterMovies.

private List<PhilmMovie> filterMovies(List<PhilmMovie> movies, Set<MovieFilter> filters) {
    Preconditions.checkNotNull(movies, "movies cannot be null");
    ArrayList<PhilmMovie> filteredMovies = new ArrayList<>(movies.size());
    for (PhilmMovie movie : movies) {
        boolean included = true;
        if (!PhilmCollections.isEmpty(filters)) {
            for (MovieFilter filter : filters) {
                if (filter.isFiltered(movie)) {
                    included = false;
                    break;
                }
            }
        }
        if (included && IGNORE_ADULT && movie.isAdult()) {
            included = false;
        }
        if (included) {
            filteredMovies.add(movie);
        }
    }
    return filteredMovies;
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) ArrayList(java.util.ArrayList)

Example 37 with PhilmMovie

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

the class MovieController method populateDetailUi.

private void populateDetailUi(MovieDetailUi ui) {
    final PhilmMovie movie = mMoviesState.getMovie(ui.getRequestParameter());
    if (movie != null) {
        final boolean canUpdateTrakt = isLoggedIn() && movie.isLoadedFromTrakt();
        ui.setRateCircleEnabled(canUpdateTrakt);
        ui.setButtonsEnabled(canUpdateTrakt, canUpdateTrakt, canUpdateTrakt, canUpdateTrakt && canCheckin(movie), canUpdateTrakt && canCancelCheckin(movie));
        ui.setMovie(movie);
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie)

Example 38 with PhilmMovie

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

the class MovieController method populateRateUi.

private void populateRateUi(MovieRateUi ui) {
    final PhilmMovie movie = mMoviesState.getMovie(ui.getRequestParameter());
    ui.setMovie(movie);
    ui.setMarkMovieWatchedCheckboxVisible(!movie.isWatched());
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie)

Example 39 with PhilmMovie

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

the class MovieController method fetchRelatedIfNeeded.

private void fetchRelatedIfNeeded(final int callingId, String id) {
    Preconditions.checkNotNull(id, "id cannot be null");
    PhilmMovie movie = mMoviesState.getMovie(id);
    if (movie != null && PhilmCollections.isEmpty(movie.getRelated())) {
        fetchRelatedMovies(callingId, movie);
    }
}
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