Search in sources :

Example 6 with BroadcastUpdatedEvent

use of me.zhanghai.android.douya.eventbus.BroadcastUpdatedEvent in project Douya by DreaminginCodeZH.

the class RebroadcastBroadcastWriter method onResponse.

@Override
public void onResponse(Broadcast response) {
    ToastUtils.show(mRebroadcast ? R.string.broadcast_rebroadcast_successful : R.string.broadcast_unrebroadcast_successful, getContext());
    if (!mRebroadcast) {
        // old one.
        if (mBroadcast != null && mBroadcast.rebroadcastId != null) {
            EventBusUtils.postAsync(new BroadcastDeletedEvent(mBroadcast.rebroadcastId, this));
        }
    }
    EventBusUtils.postAsync(new BroadcastUpdatedEvent(response, this));
    stopSelf();
}
Also used : BroadcastDeletedEvent(me.zhanghai.android.douya.eventbus.BroadcastDeletedEvent) BroadcastUpdatedEvent(me.zhanghai.android.douya.eventbus.BroadcastUpdatedEvent)

Example 7 with BroadcastUpdatedEvent

use of me.zhanghai.android.douya.eventbus.BroadcastUpdatedEvent in project Douya by DreaminginCodeZH.

the class BroadcastCommentCountFixer method onCommentRemoved.

public static void onCommentRemoved(Broadcast broadcast, Object eventSource) {
    if (broadcast == null) {
        return;
    }
    --broadcast.commentCount;
    EventBusUtils.postAsync(new BroadcastUpdatedEvent(broadcast, eventSource));
}
Also used : BroadcastUpdatedEvent(me.zhanghai.android.douya.eventbus.BroadcastUpdatedEvent)

Example 8 with BroadcastUpdatedEvent

use of me.zhanghai.android.douya.eventbus.BroadcastUpdatedEvent in project Douya by DreaminginCodeZH.

the class BroadcastCommentCountFixer method onCommentListChanged.

public static void onCommentListChanged(Broadcast broadcast, List<Comment> commentList, Object eventSource) {
    if (broadcast == null || commentList == null) {
        return;
    }
    if (broadcast.commentCount < commentList.size()) {
        broadcast.commentCount = commentList.size();
        EventBusUtils.postAsync(new BroadcastUpdatedEvent(broadcast, eventSource));
    }
}
Also used : BroadcastUpdatedEvent(me.zhanghai.android.douya.eventbus.BroadcastUpdatedEvent)

Aggregations

BroadcastUpdatedEvent (me.zhanghai.android.douya.eventbus.BroadcastUpdatedEvent)8 Context (android.content.Context)2 BroadcastWriteFinishedEvent (me.zhanghai.android.douya.eventbus.BroadcastWriteFinishedEvent)2 ApiError (me.zhanghai.android.douya.network.api.ApiError)2 BroadcastDeletedEvent (me.zhanghai.android.douya.eventbus.BroadcastDeletedEvent)1 Broadcast (me.zhanghai.android.douya.network.api.info.apiv2.Broadcast)1