use of me.zhanghai.android.douya.network.api.info.frodo.Rating in project Douya by DreaminginCodeZH.
the class MovieFragment method update.
private void update(Movie movie, Rating rating, List<Photo> photoList, List<SimpleCelebrity> celebrityList, List<ItemAwardItem> awardList, List<SimpleItemCollection> itemCollectionList, List<SimpleReview> reviewList, List<SimpleItemForumTopic> forumTopicList, List<CollectableItem> recommendationList, List<Doulist> relatedDoulistList) {
if (movie != null) {
super.updateWithSimpleItem(movie);
}
if (movie == null || photoList == null) {
return;
}
if (!mBackdropBound) {
boolean hasTrailer = movie.trailer != null;
mExcludeFirstPhoto = false;
String backdropUrl = null;
if (hasTrailer) {
backdropUrl = movie.trailer.coverUrl;
mBackdropLayout.setOnClickListener(view -> {
// TODO
UriHandler.open(movie.trailer.videoUrl, view.getContext());
});
} else if (!photoList.isEmpty()) {
backdropUrl = photoList.get(0).getLargeUrl();
mExcludeFirstPhoto = true;
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeImageListIntent(photoList, 0, context));
});
} else if (movie.poster != null) {
backdropUrl = movie.poster.getLargeUrl();
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeIntent(movie.poster, context));
});
} else if (movie.cover != null) {
backdropUrl = movie.cover.getLargeUrl();
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeIntent(movie.cover, context));
});
}
if (backdropUrl != null) {
ImageUtils.loadItemBackdropAndFadeIn(mBackdropImage, backdropUrl, hasTrailer ? mBackdropPlayImage : null);
} else {
mBackdropImage.setBackgroundColor(movie.getThemeColor());
ViewUtils.fadeIn(mBackdropImage);
}
mBackdropBound = true;
}
mAdapter.setData(new MovieDataAdapter.Data(movie, rating, photoList, mExcludeFirstPhoto, celebrityList, awardList, itemCollectionList, reviewList, forumTopicList, recommendationList, relatedDoulistList));
if (mAdapter.getItemCount() > 0) {
mContentStateLayout.setLoaded(true);
}
}
use of me.zhanghai.android.douya.network.api.info.frodo.Rating in project Douya by DreaminginCodeZH.
the class BaseItemFragmentResource method notifyChanged.
public void notifyChanged() {
// HACK: Add SimpleRating to Rating.
ItemType item = getItem();
Rating rating = mRatingResource != null ? mRatingResource.get() : null;
if (rating != null && item != null) {
rating.rating = item.rating;
// noinspection deprecation
rating.ratingUnavailableReason = item.ratingUnavailableReason;
}
notifyChanged(getRequestCode(), item, rating, mPhotoListResource != null ? mPhotoListResource.get() : null, mCelebrityListResource != null ? mCelebrityListResource.get() : null, mAwardListResource != null ? mAwardListResource.get() : null, mItemCollectionListResource != null ? mItemCollectionListResource.get() : null, mGameGuideListResource != null ? mGameGuideListResource.get() : null, mReviewListResource != null ? mReviewListResource.get() : null, mForumTopicListResource != null ? mForumTopicListResource.get() : null, mRecommendationListResource != null ? mRecommendationListResource.get() : null, mRelatedDoulistListResource != null ? mRelatedDoulistListResource.get() : null);
}
use of me.zhanghai.android.douya.network.api.info.frodo.Rating in project Douya by DreaminginCodeZH.
the class GameFragment method update.
private void update(Game game, Rating rating, List<Photo> photoList, List<SimpleItemCollection> itemCollectionList, List<SimpleReview> gameGuideList, List<SimpleReview> reviewList, List<SimpleItemForumTopic> forumTopicList, List<CollectableItem> recommendationList, List<Doulist> relatedDoulistList) {
if (game != null) {
super.updateWithSimpleItem(game);
}
if (game == null || photoList == null) {
return;
}
if (!mBackdropBound) {
// TODO: Add game videos like movie trailer.
mExcludeFirstPhoto = false;
String backdropUrl = null;
if (!photoList.isEmpty()) {
backdropUrl = photoList.get(0).getLargeUrl();
mExcludeFirstPhoto = true;
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeImageListIntent(photoList, 0, context));
});
} else if (game.cover != null) {
backdropUrl = game.cover.getLargeUrl();
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeIntent(game.cover, context));
});
}
if (backdropUrl != null) {
ImageUtils.loadItemBackdropAndFadeIn(mBackdropImage, backdropUrl, null);
} else {
mBackdropImage.setBackgroundColor(game.getThemeColor());
ViewUtils.fadeIn(mBackdropImage);
}
mBackdropBound = true;
}
mAdapter.setData(new GameDataAdapter.Data(game, rating, photoList, mExcludeFirstPhoto, itemCollectionList, gameGuideList, reviewList, forumTopicList, recommendationList, relatedDoulistList));
if (mAdapter.getItemCount() > 0) {
mContentStateLayout.setLoaded(true);
}
}
Aggregations