Search in sources :

Example 6 with SimpleReview

use of me.zhanghai.android.douya.network.api.info.frodo.SimpleReview in project Douya by DreaminginCodeZH.

the class BaseReviewListResource method onReviewDeleted.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onReviewDeleted(ReviewDeletedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<SimpleReview> reviewList = get();
    for (int i = 0, size = reviewList.size(); i < size; ) {
        SimpleReview review = reviewList.get(i);
        if (review.id == event.reviewId) {
            reviewList.remove(i);
            getListener().onReviewRemoved(getRequestCode(), i);
            --size;
        } else {
            ++i;
        }
    }
}
Also used : SimpleReview(me.zhanghai.android.douya.network.api.info.frodo.SimpleReview) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 7 with SimpleReview

use of me.zhanghai.android.douya.network.api.info.frodo.SimpleReview in project Douya by DreaminginCodeZH.

the class BaseReviewListResource method onLoadFinished.

@Override
protected void onLoadFinished(boolean more, int count, boolean successful, List<SimpleReview> response, ApiError error) {
    if (successful) {
        if (more) {
            append(response);
            getListener().onLoadReviewListFinished(getRequestCode());
            getListener().onReviewListAppended(getRequestCode(), Collections.unmodifiableList(response));
        } else {
            set(response);
            getListener().onLoadReviewListFinished(getRequestCode());
            getListener().onReviewListChanged(getRequestCode(), Collections.unmodifiableList(get()));
        }
        for (SimpleReview review : response) {
            EventBusUtils.postAsync(new ReviewUpdatedEvent(review, this));
        }
    } else {
        getListener().onLoadReviewListFinished(getRequestCode());
        getListener().onLoadReviewListError(getRequestCode(), error);
    }
}
Also used : ReviewUpdatedEvent(me.zhanghai.android.douya.eventbus.ReviewUpdatedEvent) SimpleReview(me.zhanghai.android.douya.network.api.info.frodo.SimpleReview)

Aggregations

SimpleReview (me.zhanghai.android.douya.network.api.info.frodo.SimpleReview)7 Context (android.content.Context)3 BindDimen (butterknife.BindDimen)2 List (java.util.List)2 R (me.zhanghai.android.douya.R)2 GalleryActivity (me.zhanghai.android.douya.gallery.ui.GalleryActivity)2 BaseItemFragmentResource (me.zhanghai.android.douya.item.content.BaseItemFragmentResource)2 ConfirmUncollectItemDialogFragment (me.zhanghai.android.douya.item.content.ConfirmUncollectItemDialogFragment)2 UncollectItemManager (me.zhanghai.android.douya.item.content.UncollectItemManager)2 UriHandler (me.zhanghai.android.douya.link.UriHandler)2 CollectableItem (me.zhanghai.android.douya.network.api.info.frodo.CollectableItem)2 Doulist (me.zhanghai.android.douya.network.api.info.frodo.Doulist)2 ItemAwardItem (me.zhanghai.android.douya.network.api.info.frodo.ItemAwardItem)2 Photo (me.zhanghai.android.douya.network.api.info.frodo.Photo)2 Rating (me.zhanghai.android.douya.network.api.info.frodo.Rating)2 SimpleCelebrity (me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity)2 SimpleItemCollection (me.zhanghai.android.douya.network.api.info.frodo.SimpleItemCollection)2 SimpleItemForumTopic (me.zhanghai.android.douya.network.api.info.frodo.SimpleItemForumTopic)2 BarrierAdapter (me.zhanghai.android.douya.ui.BarrierAdapter)2 CopyTextDialogFragment (me.zhanghai.android.douya.ui.CopyTextDialogFragment)2