use of me.zhanghai.android.douya.network.api.info.frodo.Doulist in project Douya by DreaminginCodeZH.
the class ItemRelatedDoulistListAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Doulist doulist = getItem(position);
holder.titleText.setText(doulist.title);
holder.followerCountText.setText(holder.followerCountText.getContext().getString(R.string.item_related_doulist_follower_count_format, doulist.followerCount));
holder.itemView.setOnClickListener(view -> {
// TODO
UriHandler.open(doulist.url, view.getContext());
});
}
use of me.zhanghai.android.douya.network.api.info.frodo.Doulist 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.Doulist in project Douya by DreaminginCodeZH.
the class BaseDoulistResource method onDoulistUpdated.
@Subscribe(threadMode = ThreadMode.POSTING)
public void onDoulistUpdated(DoulistUpdatedEvent event) {
if (event.isFromMyself(this) || isEmpty()) {
return;
}
List<Doulist> doulistList = get();
for (int i = 0, size = doulistList.size(); i < size; ++i) {
Doulist doulist = doulistList.get(i);
if (doulist.id == event.doulist.id) {
doulistList.set(i, event.doulist);
getListener().onDoulistChanged(getRequestCode(), i, doulistList.get(i));
}
}
}
use of me.zhanghai.android.douya.network.api.info.frodo.Doulist in project Douya by DreaminginCodeZH.
the class BaseDoulistResource method onLoadFinished.
@Override
protected void onLoadFinished(boolean more, int count, boolean successful, List<Doulist> response, ApiError error) {
if (successful) {
if (more) {
append(response);
getListener().onLoadDoulistListFinished(getRequestCode());
getListener().onDoulistListAppended(getRequestCode(), Collections.unmodifiableList(response));
} else {
set(response);
getListener().onLoadDoulistListFinished(getRequestCode());
getListener().onDoulistListChanged(getRequestCode(), Collections.unmodifiableList(get()));
}
for (Doulist doulist : response) {
EventBusUtils.postAsync(new DoulistUpdatedEvent(doulist, this));
}
} else {
getListener().onLoadDoulistListFinished(getRequestCode());
getListener().onLoadDoulistListError(getRequestCode(), error);
}
}
use of me.zhanghai.android.douya.network.api.info.frodo.Doulist in project Douya by DreaminginCodeZH.
the class BaseDoulistResource method onDoulistDeleted.
@Subscribe(threadMode = ThreadMode.POSTING)
public void onDoulistDeleted(DoulistDeletedEvent event) {
if (event.isFromMyself(this) || isEmpty()) {
return;
}
List<Doulist> doulistList = get();
for (int i = 0, size = doulistList.size(); i < size; ) {
Doulist doulist = doulistList.get(i);
if (doulist.id == event.doulistId) {
doulistList.remove(i);
getListener().onDoulistRemoved(getRequestCode(), i);
--size;
} else {
++i;
}
}
}
Aggregations