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


Java EMMessage.Type方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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


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