Java Code Examples for com.easemob.chat.EMMessage#Type
The following examples show how to use
com.easemob.chat.EMMessage#Type .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChatActivity.java From school_shop with MIT License | 6 votes |
/** * 转发消息 * * @param forward_msg_id */ protected void forwardMessage(String forward_msg_id) { EMMessage forward_msg = EMChatManager.getInstance().getMessage(forward_msg_id); EMMessage.Type type = forward_msg.getType(); switch (type) { case TXT: // 获取消息内容,发送消息 String content = ((TextMessageBody) forward_msg.getBody()).getMessage(); sendText(content); break; case IMAGE: // 发送图片 String filePath = ((ImageMessageBody) forward_msg.getBody()).getLocalUrl(); if (filePath != null) { File file = new File(filePath); if (!file.exists()) { // 不存在大图发送缩略图 filePath = ImageUtils.getThumbnailImagePath(filePath); } sendPicture(filePath); } break; default: break; } }
Example 2
Source File: EaseChatFragment.java From monolog-android with MIT License | 5 votes |
/** * 转发消息 * * @param forward_msg_id */ protected void forwardMessage(String forward_msg_id) { final EMMessage forward_msg = EMChatManager.getInstance().getMessage(forward_msg_id); EMMessage.Type type = forward_msg.getType(); switch (type) { case TXT: // 获取消息内容,发送消息 String content = ((TextMessageBody) forward_msg.getBody()).getMessage(); sendTextMessage(content); break; case IMAGE: // 发送图片 String filePath = ((ImageMessageBody) forward_msg.getBody()).getLocalUrl(); if (filePath != null) { File file = new File(filePath); if (!file.exists()) { // 不存在大图发送缩略图 filePath = EaseImageUtils.getThumbnailImagePath(filePath); } sendImageMessage(filePath); } break; default: break; } if(forward_msg.getChatType() == EMMessage.ChatType.ChatRoom){ EMChatManager.getInstance().leaveChatRoom(forward_msg.getTo()); } }
Example 3
Source File: ChatActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
/** * 转发消息 * * @param forward_msg_id */ protected void forwardMessage(String forward_msg_id) { EMMessage forward_msg = EMChatManager.getInstance().getMessage( forward_msg_id); EMMessage.Type type = forward_msg.getType(); switch (type) { case TXT: // 获取消息内容,发送消息 String content = ((TextMessageBody) forward_msg.getBody()) .getMessage(); sendText(content); break; case IMAGE: // 发送图片 String filePath = ((ImageMessageBody) forward_msg.getBody()) .getLocalUrl(); if (filePath != null) { File file = new File(filePath); if (!file.exists()) { // 不存在大图发送缩略图 filePath = ImageUtils.getThumbnailImagePath(filePath); } sendPicture(filePath, false); } break; default: break; } }