ChatManager.Instance().sendMessage(msg, new SendMessageCallback() {
@Override
public void onSuccess(long messageUid, long timestamp) {
msg.direction = MessageDirection.Send;
msg.serverTime = timestamp;
msg.messageUid = messageUid;
UiMessage uiMessage = new UiMessage(msg);
mMsgList.add(uiMessage);
mAdapter.notifyDataSetChanged();
}
@Override
public void onFail(int errorCode) {
showToast("发送失败!");
}
@Override
public void onPrepare(long messageId, long savedTime) {
msg.messageId = messageId;
msg.serverTime = savedTime;
}
});