当前位置: 首页>>代码示例>>Java>>正文


Java EMMessage.getChatType方法代码示例

本文整理汇总了Java中com.hyphenate.chat.EMMessage.getChatType方法的典型用法代码示例。如果您正苦于以下问题:Java EMMessage.getChatType方法的具体用法?Java EMMessage.getChatType怎么用?Java EMMessage.getChatType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hyphenate.chat.EMMessage的用法示例。


在下文中一共展示了EMMessage.getChatType方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMessageReceived

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
    for (EMMessage message : messages) {
        String username = null;
        // group message
        if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {
            username = message.getTo();
        } else {
            // single chat message
            username = message.getFrom();
        }

        // if the message is for current conversation
        if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername)) {
            messageList.refreshSelectLast();
            EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
            conversation.markMessageAsRead(message.getMsgId());
        } else {
            EaseUI.getInstance().getNotifier().onNewMsg(message);
        }
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:23,代码来源:EaseChatFragment.java

示例2: onMessageReceived

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
    for (EMMessage message : messages) {
        String username = null;
        // group message
        if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {
            username = message.getTo();
        } else {
            // single chat message
            username = message.getFrom();
        }

        // if the message is for current conversation
        if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername) || message.conversationId().equals(toChatUsername)) {
            messageList.refreshSelectLast();
            EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
            conversation.markMessageAsRead(message.getMsgId());
        } else {
            EaseUI.getInstance().getNotifier().onNewMsg(message);
        }
    }
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:23,代码来源:EaseChatFragment.java

示例3: onMessageReceived

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
    for (EMMessage message : messages) {
        String username = null;
        // group message
        if (message.getChatType() == EMMessage.ChatType.GroupChat || message.getChatType() == EMMessage.ChatType.ChatRoom) {
            username = message.getTo();
        } else {
            // single chat message
            username = message.getFrom();
        }

        // if the message is for current conversation
        if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername) || message.conversationId().equals(toChatUsername)) {
            messageList.refreshSelectLast();
            EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
            conversation.markMessageAsRead(message.getMsgId());
        } else {
            EaseUI.getInstance().getNotifier().onNewMsg(message);
        }
    }
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:23,代码来源:EaseChatFragment.java

示例4: onMessageReceived

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onMessageReceived(List<EMMessage> messages) {
    for (EMMessage message : messages) {
        String username = null;
        // group message
        if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {
            username = message.getTo();
        } else {
            // single chat message
            username = message.getFrom();
        }

        // if the message is for current conversation
        if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername)) {
            messageList.refreshSelectLast();
            EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);
        } else {
            EaseUI.getInstance().getNotifier().onNewMsg(message);
        }
    }
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:22,代码来源:EaseChatFragment.java

示例5: parseMessages

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * parse the message, get and save group id if I was mentioned(@)
 * @param messages
 */
public void parseMessages(List<EMMessage> messages) {
    int size = atMeGroupList.size();
    EMMessage[] msgs = messages.toArray(new EMMessage[messages.size()]);
    for(EMMessage msg : msgs){
        if(msg.getChatType() == ChatType.GroupChat){
            String groupId = msg.getTo();
            try {
                JSONArray jsonArray = msg.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
                for(int i = 0; i < jsonArray.length(); i++){
                    String username = jsonArray.getString(i);
                    if(EMClient.getInstance().getCurrentUser().equals(username)){
                        if(!atMeGroupList.contains(groupId)){
                            atMeGroupList.add(groupId);
                            break;
                        }
                    }
                }
            } catch (Exception e1) {
                //Determine whether is @ all message
                String usernameStr = msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
                if(usernameStr != null){
                    if(usernameStr.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)){
                        if(!atMeGroupList.contains(groupId)){
                            atMeGroupList.add(groupId);
                        }
                    }
                }
            }
            
            if(atMeGroupList.size() != size){
                EasePreferenceManager.getInstance().setAtMeGroups(atMeGroupList);
            }
        }
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:40,代码来源:EaseAtMessageHelper.java

示例6: forwardMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * forward message
 * 
 * @param forward_msg_id
 */
protected void forwardMessage(String forward_msg_id) {
    final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id);
    EMMessage.Type type = forward_msg.getType();
    switch (type) {
    case TXT:
        if(forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
            sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(),
                    forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null));
        }else{
            // get the content and send it
            String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage();
            sendTextMessage(content);
        }
        break;
    case IMAGE:
        // send image
        String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl();
        if (filePath != null) {
            File file = new File(filePath);
            if (!file.exists()) {
                // send thumb nail if original image does not exist
                filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath();
            }
            sendImageMessage(filePath);
        }
        break;
    default:
        break;
    }
    
    if(forward_msg.getChatType() == EMMessage.ChatType.ChatRoom){
        EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo());
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:40,代码来源:EaseChatFragment.java

示例7: EaseChatRowVoicePlayClickListener

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
public EaseChatRowVoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity context) {
	this.message = message;
	voiceBody = (EMVoiceMessageBody) message.getBody();
	this.iv_read_status = iv_read_status;
	this.adapter = adapter;
	voiceIconView = v;
	this.activity = context;
	this.chatType = message.getChatType();
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:10,代码来源:EaseChatRowVoicePlayClickListener.java

示例8: forwardMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * forward message
 * 
 * @param forward_msg_id
 */
protected void forwardMessage(String forward_msg_id) {
    final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id);
    EMMessage.Type type = forward_msg.getType();
    switch (type) {
    case TXT:
        if(forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
            sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(),
                    forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null));
        }else{
            // get the content and send it
            String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage();
            sendTextMessage(content);
        }
        break;
    case IMAGE:
        // send image
        String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl();
        if (filePath != null) {
            File file = new File(filePath);
            if (!file.exists()) {
                // send thumb nail if original image does not exist
                filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath();
            }
            sendImageMessage(filePath);
        }
        break;
    default:
        break;
    }
    
    if(forward_msg.getChatType() == ChatType.ChatRoom){
        EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo());
    }
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:40,代码来源:EaseChatFragment.java

示例9: forwardMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * forward message
 *
 * @param forward_msg_id
 */
protected void forwardMessage(String forward_msg_id) {
    final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id);
    EMMessage.Type type = forward_msg.getType();
    switch (type) {
        case TXT:
            if(forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
                sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(),
                        forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null));
            }else{
                // get the content and send it
                String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage();
                sendTextMessage(content);
            }
            break;
        case IMAGE:
            // send image
            String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl();
            if (filePath != null) {
                File file = new File(filePath);
                if (!file.exists()) {
                    // send thumb nail if original image does not exist
                    filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath();
                }
                sendImageMessage(filePath);
            }
            break;
        default:
            break;
    }

    if(forward_msg.getChatType() == EMMessage.ChatType.ChatRoom){
        EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo());
    }
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:40,代码来源:EaseChatFragment.java

示例10: parseMessages

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * parse the message, get and save group id if I was mentioned(@)
 * @param messages
 */
public void parseMessages(List<EMMessage> messages) {
    int size = atMeGroupList.size();
    EMMessage[] msgs = messages.toArray(new EMMessage[messages.size()]);
    for(EMMessage msg : msgs){
        if(msg.getChatType() == EMMessage.ChatType.GroupChat){
            String groupId = msg.getTo();
            try {
                JSONArray jsonArray = msg.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
                for(int i = 0; i < jsonArray.length(); i++){
                    String username = jsonArray.getString(i);
                    if(EMClient.getInstance().getCurrentUser().equals(username)){
                        if(!atMeGroupList.contains(groupId)){
                            atMeGroupList.add(groupId);
                            break;
                        }
                    }
                }
            } catch (Exception e1) {
                //Determine whether is @ all message
                String usernameStr = msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
                if(usernameStr != null){
                    if(usernameStr.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)){
                        if(!atMeGroupList.contains(groupId)){
                            atMeGroupList.add(groupId);
                        }
                    }
                }
            }

            if(atMeGroupList.size() != size){
                EasePreferenceManager.getInstance().setAtMeGroups(atMeGroupList);
            }
        }
    }
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:40,代码来源:EaseAtMessageHelper.java

示例11: parseMessages

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * parse the message, get and save group id if I was mentioned(@)
 *
 * @param messages
 */
public void parseMessages(List<EMMessage> messages) {
    int size = atMeGroupList.size();
    EMMessage[] msgs = messages.toArray(new EMMessage[messages.size()]);
    for (EMMessage msg : msgs) {
        if (msg.getChatType() == ChatType.GroupChat) {
            String groupId = msg.getTo();
            try {
                JSONArray jsonArray = msg.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
                for (int i = 0; i < jsonArray.length(); i++) {
                    String username = jsonArray.getString(i);
                    if (EMClient.getInstance().getCurrentUser().equals(username)) {
                        if (!atMeGroupList.contains(groupId)) {
                            atMeGroupList.add(groupId);
                            break;
                        }
                    }
                }
            } catch (Exception e1) {
                //Determine whether is @ all message
                String usernameStr = msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
                if (usernameStr != null) {
                    if (usernameStr.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)) {
                        if (!atMeGroupList.contains(groupId)) {
                            atMeGroupList.add(groupId);
                        }
                    }
                }
            }

            if (atMeGroupList.size() != size) {
               EasePreferenceManager.getInstance().setAtMeGroups(atMeGroupList);
            }
        }
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:41,代码来源:EaseAtMessageHelper.java

示例12: forwardMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * forward message
 *
 * @param forward_msg_id
 */
protected void forwardMessage(String forward_msg_id) {
    final EMMessage forward_msg = EMClient.getInstance().chatManager().getMessage(forward_msg_id);
    EMMessage.Type type = forward_msg.getType();
    switch (type) {
        case TXT:
            if (forward_msg.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)) {
                sendBigExpressionMessage(((EMTextMessageBody) forward_msg.getBody()).getMessage(),
                        forward_msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null));
            } else {
                // get the content and send it
                String content = ((EMTextMessageBody) forward_msg.getBody()).getMessage();
                sendTextMessage(content);
            }
            break;
        case IMAGE:
            // send image
            String filePath = ((EMImageMessageBody) forward_msg.getBody()).getLocalUrl();
            if (filePath != null) {
                File file = new File(filePath);
                if (!file.exists()) {
                    // send thumb nail if original image does not exist
                    filePath = ((EMImageMessageBody) forward_msg.getBody()).thumbnailLocalPath();
                }
                sendImageMessage(filePath);
            }
            break;
        default:
            break;
    }

    if (forward_msg.getChatType() == ChatType.ChatRoom) {
        EMClient.getInstance().chatroomManager().leaveChatRoom(forward_msg.getTo());
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:40,代码来源:EaseChatFragment.java

示例13: EaseChatRowVoicePlayClickListener

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
public EaseChatRowVoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity context) {
    this.message = message;
    voiceBody = (EMVoiceMessageBody) message.getBody();
    this.iv_read_status = iv_read_status;
    this.adapter = adapter;
    voiceIconView = v;
    this.activity = context;
    this.chatType = message.getChatType();
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:10,代码来源:EaseChatRowVoicePlayClickListener.java


注:本文中的com.hyphenate.chat.EMMessage.getChatType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。