Search in sources :

Example 1 with MovieTools

use of com.battlelancer.seriesguide.ui.movies.MovieTools in project SeriesGuide by UweTrottmann.

the class SgPicassoRequestHandler method load.

@Override
public Result load(Request request, int networkPolicy) throws IOException {
    String scheme = request.uri.getScheme();
    String host = request.uri.getHost();
    if (host == null)
        return null;
    if (SCHEME_SHOW_TMDB.equals(scheme)) {
        int showTmdbId = Integer.parseInt(host);
        String language = request.uri.getQueryParameter(QUERY_LANGUAGE);
        if (language == null || language.length() == 0) {
            language = DisplaySettings.LANGUAGE_EN;
        }
        TvShow showDetails = new TmdbTools2().getShowDetails(showTmdbId, language, context);
        if (showDetails != null) {
            String url = ImageTools.tmdbOrTvdbPosterUrl(showDetails.poster_path, context, false);
            if (url != null) {
                return loadFromNetwork(Uri.parse(url), networkPolicy);
            }
        }
    }
    if (SCHEME_MOVIE_TMDB.equals(scheme)) {
        int movieTmdbId = Integer.valueOf(host);
        MovieTools movieTools = SgApp.getServicesComponent(context).movieTools();
        Movie movieSummary = movieTools.getMovieSummary(movieTmdbId);
        if (movieSummary != null && movieSummary.poster_path != null) {
            final String imageUrl = TmdbSettings.getImageBaseUrl(context) + TmdbSettings.POSTER_SIZE_SPEC_W342 + movieSummary.poster_path;
            return loadFromNetwork(Uri.parse(imageUrl), networkPolicy);
        }
    }
    return null;
}
Also used : Movie(com.uwetrottmann.tmdb2.entities.Movie) TvShow(com.uwetrottmann.tmdb2.entities.TvShow) MovieTools(com.battlelancer.seriesguide.ui.movies.MovieTools) TmdbTools2(com.battlelancer.seriesguide.tmdbapi.TmdbTools2)

Aggregations

TmdbTools2 (com.battlelancer.seriesguide.tmdbapi.TmdbTools2)1 MovieTools (com.battlelancer.seriesguide.ui.movies.MovieTools)1 Movie (com.uwetrottmann.tmdb2.entities.Movie)1 TvShow (com.uwetrottmann.tmdb2.entities.TvShow)1