Java Code Examples for com.easemob.chat.EMMessage.ChatType#GroupChat
The following examples show how to use
com.easemob.chat.EMMessage.ChatType#GroupChat .
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: EaseChatRowImage.java From monolog-android with MIT License | 6 votes |
@Override protected void onBubbleClick() { Intent intent = new Intent(context, EaseShowBigImageActivity.class); File file = new File(imgBody.getLocalUrl()); if (file.exists()) { Uri uri = Uri.fromFile(file); intent.putExtra("uri", uri); } else { // The local full size pic does not exist yet. // ShowBigImage needs to download it from the server // first intent.putExtra("secret", imgBody.getSecret()); intent.putExtra("remotepath", imgBody.getRemoteUrl()); } if (message != null && message.direct == EMMessage.Direct.RECEIVE && !message.isAcked && message.getChatType() != ChatType.GroupChat) { try { EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId()); message.isAcked = true; } catch (Exception e) { e.printStackTrace(); } } context.startActivity(intent); }
Example 2
Source File: EaseChatRowVideo.java From monolog-android with MIT License | 6 votes |
@Override protected void onBubbleClick() { VideoMessageBody videoBody = (VideoMessageBody) message.getBody(); EMLog.d(TAG, "video view is on click"); Intent intent = new Intent(context, EaseShowVideoActivity.class); intent.putExtra("localpath", videoBody.getLocalUrl()); intent.putExtra("secret", videoBody.getSecret()); intent.putExtra("remotepath", videoBody.getRemoteUrl()); if (message != null && message.direct == EMMessage.Direct.RECEIVE && !message.isAcked && message.getChatType() != ChatType.GroupChat) { message.isAcked = true; try { EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (Exception e) { e.printStackTrace(); } } activity.startActivity(intent); }
Example 3
Source File: MainActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { // 主页面收到消息后,主要为了提示未读,实际消息内容需要到chat页面查看 String from = intent.getStringExtra("from"); // 消息id String msgId = intent.getStringExtra("msgid"); EMMessage message = EMChatManager.getInstance().getMessage(msgId); // 2014-10-22 修复在某些机器上,在聊天页面对方发消息过来时不立即显示内容的bug if (ChatActivity.activityInstance != null) { if (message.getChatType() == ChatType.GroupChat) { if (message.getTo().equals( ChatActivity.activityInstance.getToChatUsername())) return; } else { if (from.equals(ChatActivity.activityInstance .getToChatUsername())) return; } } // 注销广播接收者,否则在ChatActivity中会收到这个广播 abortBroadcast(); notifyNewMessage(message); // 刷新bottom bar消息未读数 updateUnreadLabel(); if (currentTabIndex == 0) { // 当前页面如果为聊天历史页面,刷新此页面 if (homefragment != null) { homefragment.refresh(); } } }
Example 4
Source File: EaseChatFragment.java From monolog-android with MIT License | 4 votes |
/** * 事件监听,registerEventListener后的回调事件 * * see {@link EMNotifierEvent} */ @Override public void onEvent(EMNotifierEvent event) { switch (event.getEvent()) { case EventNewMessage: // 获取到message EMMessage message = (EMMessage) event.getData(); String username = null; // 群组消息 if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) { username = message.getTo(); } else { // 单聊消息 username = message.getFrom(); } // 如果是当前会话的消息,刷新聊天页面 if (username.equals(toChatUsername)) { messageList.refreshSelectLast(); // 声音和震动提示有新消息 EaseUI.getInstance().getNotifier().viberateAndPlayTone(message); } else { // 如果消息不是和当前聊天ID的消息 EaseUI.getInstance().getNotifier().onNewMsg(message); } break; case EventDeliveryAck: case EventReadAck: // 获取到message messageList.refresh(); break; case EventOfflineMessage: // a list of offline messages // List<EMMessage> offlineMessages = (List<EMMessage>) // event.getData(); messageList.refresh(); break; default: break; } }
Example 5
Source File: ChatActivity.java From school_shop with MIT License | 4 votes |
/** * 事件监听 * * see {@link EMNotifierEvent} */ @Override public void onEvent(EMNotifierEvent event) { switch (event.getEvent()) { case EventNewMessage: { //获取到message EMMessage message = (EMMessage) event.getData(); String username = null; //群组消息 if(message.getChatType() == ChatType.GroupChat){ username = message.getTo(); } else{ //单聊消息 username = message.getFrom(); } //如果是当前会话的消息,刷新聊天页面 if(username.equals(getToChatUsername())){ refreshUIWithNewMessage(); //声音和震动提示有新消息 HXSDKHelper.getInstance().getNotifier().viberateAndPlayTone(message); }else{ //如果消息不是和当前聊天ID的消息 HXSDKHelper.getInstance().getNotifier().onNewMsg(message); } break; } // case EventDeliveryAck: // { // //获取到message // EMMessage message = (EMMessage) event.getData(); // refreshUI(); // break; // } // case EventReadAck: // { // //获取到message // EMMessage message = (EMMessage) event.getData(); // refreshUI(); // break; // } case EventOfflineMessage: { //a list of offline messages //List<EMMessage> offlineMessages = (List<EMMessage>) event.getData(); refreshUI(); break; } default: break; } }