use of com.avos.avoscloud.im.v2.callback.AVIMConversationCallback in project ride-read-android by Ride-Read.
the class ChatActivity method sendTextMessage.
private void sendTextMessage(String text) {
final AVIMTextMessage message = new AVIMTextMessage();
message.setText(text);
datas.add(new ChatMessage(1, R.mipmap.me, null, text, null));
adapter.notifyDataSetChanged();
chatlist.smoothScrollToPosition(adapter.getCount() - 1);
editor.setText("");
imConversation.sendMessage(message, new AVIMConversationCallback() {
@Override
public void done(AVIMException e) {
if (filterException(e)) {
Log.e("信息发送", "信息发送成功");
} else {
Log.e("信息发送", "信息发送失败");
}
}
});
}
use of com.avos.avoscloud.im.v2.callback.AVIMConversationCallback in project ride-read-android by Ride-Read.
the class ChatSingleActivity method sendMsg.
private void sendMsg() {
String msg = mEdtChatInput.getText().toString();
AVIMTextMessage message = new AVIMTextMessage();
if (!TextUtils.isEmpty(msg)) {
message.setText(msg);
mMsgAdapter.addMessage(message);
mMsgAdapter.notifyDataSetChanged();
scrollToBottom();
mEdtChatInput.setText("");
mImConversation.sendMessage(message, new AVIMConversationCallback() {
@Override
public void done(AVIMException e) {
mMsgAdapter.notifyDataSetChanged();
MsgUtils.addMsgInfo(mUser, msg, System.currentTimeMillis());
}
});
}
}
use of com.avos.avoscloud.im.v2.callback.AVIMConversationCallback 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