List<AVIMTypedMessage> filterTypedMessages(List<AVIMMessage> messages) { List<AVIMTypedMessage> resultMessages = new ArrayList<>(); for (AVIMMessage msg : messages) { if (msg instanceof AVIMTypedMessage) { resultMessages.add((AVIMTypedMessage) msg); } else { LogUtils.i("unexpected message " + msg.getContent()); } } return resultMessages; }
@Override public void onMessage(AVIMMessage message, AVIMConversation conversation, AVIMClient client) { String clientId; clientId = AVImClientManager.getInstance().getClientId(); if (client.getClientId().equals(clientId)) { if (!message.getFrom().equals(clientId)) { // mChatAdapter.addData(message); EventBus.getDefault().post(new EventReceiveMessage(message, conversation)); } } }