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;
}
}
}
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);
}
}
Aggregations