Search in sources :

Example 1 with RebroadcastItem

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

the class BroadcastRebroadcastListResource method onBroadcastDeleted.

@Subscribe(threadMode = ThreadMode.POSTING)
public void onBroadcastDeleted(BroadcastDeletedEvent event) {
    if (event.isFromMyself(this) || isEmpty()) {
        return;
    }
    List<RebroadcastItem> rebroadcastList = get();
    for (int i = 0, size = rebroadcastList.size(); i < size; ) {
        RebroadcastItem rebroadcastItem = rebroadcastList.get(i);
        if (rebroadcastItem.getBroadcastId() == event.broadcastId) {
            rebroadcastList.remove(i);
            getListener().onRebroadcastItemRemoved(getRequestCode(), i);
            --size;
        }
    }
}
Also used : RebroadcastItem(me.zhanghai.android.douya.network.api.info.frodo.RebroadcastItem) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 2 with RebroadcastItem

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

the class RebroadcastItemAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
    RebroadcastItem rebroadcastItem = getItem(position);
    holder.itemView.setOnClickListener(view -> {
        if (!rebroadcastItem.hasBroadcast()) {
            return;
        }
        Context context = view.getContext();
        context.startActivity(BroadcastActivity.makeIntent(rebroadcastItem.getBroadcastId(), context));
    });
    ImageUtils.loadAvatar(holder.avatarImage, rebroadcastItem.author.avatar);
    holder.avatarImage.setOnClickListener(view -> {
        Context context = view.getContext();
        context.startActivity(ProfileActivity.makeIntent(rebroadcastItem.author, context));
    });
    holder.nameText.setText(rebroadcastItem.author.name);
    holder.timeText.setDoubanTime(rebroadcastItem.createTime);
    holder.textText.setText(rebroadcastItem.getText(holder.textText.getContext()));
}
Also used : Context(android.content.Context) RebroadcastItem(me.zhanghai.android.douya.network.api.info.frodo.RebroadcastItem)

Aggregations

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