Search in sources :

Example 1 with Comment

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

the class CommentListResource method onCommentDeleted.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onCommentDeleted(CommentDeletedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<Comment> commentList = get();
    for (int i = 0, size = commentList.size(); i < size; ) {
        Comment comment = commentList.get(i);
        if (comment.id == event.commentId) {
            commentList.remove(i);
            getListener().onCommentRemoved(getRequestCode(), i);
            --size;
        } else {
            ++i;
        }
    }
}
Also used : Comment(me.zhanghai.android.douya.network.api.info.frodo.Comment) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 2 with Comment

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

the class CommentAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Comment comment = getItem(position);
    ImageUtils.loadAvatar(holder.avatarImage, comment.author.avatar);
    Context context = RecyclerViewUtils.getContext(holder);
    holder.avatarImage.setOnClickListener(view -> context.startActivity(ProfileActivity.makeIntent(comment.author, context)));
    holder.nameText.setText(comment.author.name);
    holder.timeText.setDoubanTime(comment.createTime);
    holder.textText.setText(comment.getTextWithEntities());
}
Also used : Context(android.content.Context) Comment(me.zhanghai.android.douya.network.api.info.frodo.Comment)

Aggregations

Comment (me.zhanghai.android.douya.network.api.info.frodo.Comment)2 Context (android.content.Context)1 Subscribe (org.greenrobot.eventbus.Subscribe)1