Search in sources :

Example 1 with Show

use of butter.droid.provider.base.model.Show in project butter-android by butterproject.

the class RecommendationService method buildShowRecommendations.

private void buildShowRecommendations(@NonNull RecommendationBuilder builder) {
    Timber.d("building show recommendations");
    try {
        int count = 0;
        for (Media media : shows) {
            Show show = (Show) media;
            Timber.d("Recommendation - " + show.getTitle());
            Episode latestEpisode = findLatestEpisode(show);
            priority--;
            totalCount--;
            builder.setBackgroundContentUri(RecommendationContentProvider.CONTENT_URI + URLEncoder.encode(show.getBackdrop(), "UTF-8")).setId(totalCount).setPriority(priority).setTitle(show.getTitle()).setDescription(latestEpisode == null ? "" : getString(R.string.episode_number_format, latestEpisode.getEpisode())).setImage(show.getPoster()).build();
            if (++count >= MAX_SHOW_RECOMMENDATIONS) {
                break;
            }
        }
    } catch (IOException e) {
        Timber.e("Unable to update recommendation", e);
    }
}
Also used : Episode(butter.droid.provider.base.model.Episode) Media(butter.droid.provider.base.model.Media) Show(butter.droid.provider.base.model.Show) IOException(java.io.IOException)

Aggregations

Episode (butter.droid.provider.base.model.Episode)1 Media (butter.droid.provider.base.model.Media)1 Show (butter.droid.provider.base.model.Show)1 IOException (java.io.IOException)1