use of org.greenrobot.eventbus.Subscribe in project PhotoNoter by yydcdut.
the class HomePresenterImpl method onCategoryDeleteEvent.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCategoryDeleteEvent(CategoryDeleteEvent categoryDeleteEvent) {
mRxCategory.getAllCategories().observeOn(AndroidSchedulers.mainThread()).subscribe(categories -> {
int beforeCategoryId = mCategoryId;
for (Category category : categories) {
if (category.isCheck()) {
mCategoryId = category.getId();
break;
}
}
mHomeView.updateCategoryList(categories);
if (mCategoryId != beforeCategoryId) {
mHomeView.changePhotos4Category(mCategoryId);
}
}, (throwable -> YLog.e(throwable)));
}
use of org.greenrobot.eventbus.Subscribe in project ride-read-android by Ride-Read.
the class ChatActivity method onEvent.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(ImTypeMessageEvent event) {
if (null != imConversation && null != event && imConversation.getConversationId().equals(event.conversation.getConversationId())) {
if (event.message instanceof AVIMTextMessage) {
String msg = ((AVIMTextMessage) event.message).getText();
ChatMessage chatMessage = new ChatMessage(0, R.mipmap.me, menberId, msg, null);
adapter.addMessage(chatMessage);
adapter.notifyDataSetChanged();
chatlist.smoothScrollToPosition(adapter.getCount() - 1);
}
}
}
use of org.greenrobot.eventbus.Subscribe in project ride-read-android by Ride-Read.
the class ChatSingleActivity method onResendMsg.
/**
* 重新发送已经发送失败的消息
*/
@Subscribe(threadMode = MAIN)
public void onResendMsg(ImTypeMsgResendEvent event) {
if (null != mImConversation && null != event) {
if (AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed == event.message.getMessageStatus() && mImConversation.getConversationId().equals(event.message.getConversationId())) {
mImConversation.sendMessage(event.message, new AVIMConversationCallback() {
@Override
public void done(AVIMException e) {
mMsgAdapter.notifyDataSetChanged();
}
});
mMsgAdapter.notifyDataSetChanged();
}
}
}
Aggregations