use of com.avos.avoscloud.im.v2.messages.AVIMTextMessage in project ride-read-android by Ride-Read.
the class LeftMsgHolder method bindData.
@Override
public void bindData(Object o) {
AVIMMessage message = (AVIMMessage) o;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
String time = dateFormat.format(message.getTimestamp());
String content = getContext().getString(R.string.unsupport_message_type);
if (message instanceof AVIMTextMessage) {
content = ((AVIMTextMessage) message).getText();
}
mTvChatTxtLeft.setText(content);
mTvChatTime.setText(time);
// nameView.setText(message.getFrom());
}
use of com.avos.avoscloud.im.v2.messages.AVIMTextMessage 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.messages.AVIMTextMessage 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.messages.AVIMTextMessage in project ride-read-android by Ride-Read.
the class RightMsgHolder method bindData.
@Override
public void bindData(Object msg) {
message = (AVIMMessage) msg;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String time = dateFormat.format(message.getTimestamp());
String content = getContext().getString(R.string.unsupport_message_type);
;
if (message instanceof AVIMTextMessage) {
content = ((AVIMTextMessage) message).getText();
}
mTvChatTxtRight.setText(content);
mTvChatTime.setText(time);
if (AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed == message.getMessageStatus()) {
mImgChatStatusRight.setVisibility(View.VISIBLE);
mPbChatProgressbarRight.setVisibility(View.GONE);
mFlChatStatusRight.setVisibility(View.VISIBLE);
} else if (AVIMMessage.AVIMMessageStatus.AVIMMessageStatusSending == message.getMessageStatus()) {
mImgChatStatusRight.setVisibility(View.GONE);
mPbChatProgressbarRight.setVisibility(View.VISIBLE);
mFlChatStatusRight.setVisibility(View.VISIBLE);
} else {
mFlChatStatusRight.setVisibility(View.GONE);
}
}
use of com.avos.avoscloud.im.v2.messages.AVIMTextMessage in project ride-read-android by Ride-Read.
the class MessageHandler method sendNotification.
private void sendNotification(AVIMTypedMessage message, AVIMConversation conversation) {
String notificationContent = message instanceof AVIMTextMessage ? ((AVIMTextMessage) message).getText() : context.getString(R.string.unspport_message_type);
Intent intent = new Intent(context, NotificationBroadcastReceiver.class);
intent.putExtra(Constants.CONVERSATION_ID, conversation.getConversationId());
intent.putExtra(Constants.MEMBER_ID, message.getFrom());
NotificationUtils.showNotification(context, "", notificationContent, null, intent);
}
Aggregations