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


Java EMTextMessageBody.getMessage方法代码示例

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


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

示例1: getView

import com.hyphenate.chat.EMTextMessageBody; //导入方法依赖的package包/类
@Override
public View getView(int i, View view, ViewGroup viewGroup) {

    Holder holder;
    if(view ==null){
        view = LayoutInflater.from(getActivity()).inflate(R.layout.item_msg,viewGroup,false);
        holder = new Holder(view);
        view.setTag(holder);
    }else{
        holder = (Holder) view.getTag();
    }
    EMConversation conversation = EMClient.getInstance().chatManager().getConversation(list.get(i));
    EMMessage message = conversation.getLastMessage();
    String msg = "";
    if (message.getType().name().equals("TXT")) {
        EMTextMessageBody body = (EMTextMessageBody) message.getBody();
        msg = body.getMessage();

    }
    int count = conversation.getUnreadMsgCount();
    if(count == 0){
        holder.tvCount.setVisibility(View.GONE);
    }else{
        holder.tvCount.setVisibility(View.VISIBLE);
        holder.tvCount.setText(count+"");
    }
    holder.tvName.setText(list.get(i));
    holder.tvMsg.setText(msg);
    holder.tvTime.setText(T.getTime(message.getMsgTime()));


    return view;
}
 
开发者ID:jiangzehui,项目名称:HX,代码行数:34,代码来源:MsgFragment.java

示例2: getMessageDigest

import com.hyphenate.chat.EMTextMessageBody; //导入方法依赖的package包/类
/**
 * Get digest according message type and content
 * 
 * @param message
 * @param context
 * @return
 */
public static String getMessageDigest(EMMessage message, Context context) {
    String digest = "";
    switch (message.getType()) {
    case LOCATION:
        if (message.direct() == EMMessage.Direct.RECEIVE) {
            digest = getString(context, R.string.location_recv);
            digest = String.format(digest, message.getFrom());
            return digest;
        } else {
            digest = getString(context, R.string.location_prefix);
        }
        break;
    case IMAGE:
        digest = getString(context, R.string.picture);
        break;
    case VOICE:
        digest = getString(context, R.string.voice_prefix);
        break;
    case VIDEO:
        digest = getString(context, R.string.video);
        break;
    case TXT:
        EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
        if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_VOICE_CALL, false)){
            digest = getString(context, R.string.voice_call) + txtBody.getMessage();
        }else if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_VIDEO_CALL, false)){
            digest = getString(context, R.string.video_call) + txtBody.getMessage();
        }else if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
            if(!TextUtils.isEmpty(txtBody.getMessage())){
                digest = txtBody.getMessage();
            }else{
                digest = getString(context, R.string.dynamic_expression);
            }
        }else{
            digest = txtBody.getMessage();
        }
        break;
    case FILE:
        digest = getString(context, R.string.file);
        break;
    default:
        EMLog.e(TAG, "error, unknow type");
        return "";
    }

    return digest;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:55,代码来源:EaseCommonUtils.java

示例3: getMessageDigest

import com.hyphenate.chat.EMTextMessageBody; //导入方法依赖的package包/类
/**
     * 根据消息内容和消息类型获取消息内容提示
     * 
     * @param message
     * @param context
     * @return
     */
    public static String getMessageDigest(EMMessage message, Context context) {
        String digest = "";
        switch (message.getType()) {
        case LOCATION: // 位置消息
            if (message.direct() == EMMessage.Direct.RECEIVE) {
                //从sdk中提到了ui中,使用更简单不犯错的获取string方法
//              digest = EasyUtils.getAppResourceString(context, "location_recv");
                digest = getString(context, R.string.location_recv);
                digest = String.format(digest, message.getFrom());
                return digest;
            } else {
//              digest = EasyUtils.getAppResourceString(context, "location_prefix");
                digest = getString(context, R.string.location_prefix);
            }
            break;
        case IMAGE: // 图片消息
            digest = getString(context, R.string.picture);
            break;
        case VOICE:// 语音消息
            digest = getString(context, R.string.voice_prefix);
            break;
        case VIDEO: // 视频消息
            digest = getString(context, R.string.video);
            break;
        case TXT: // 文本消息
            EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
            /*if(((DemoHXSDKHelper)HXSDKHelper.getInstance()).isRobotMenuMessage(message)){
                digest = ((DemoHXSDKHelper)HXSDKHelper.getInstance()).getRobotMenuMessageDigest(message);
            }else */if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_VOICE_CALL, false)){
                digest = getString(context, R.string.voice_call) + txtBody.getMessage();
            }else if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_VIDEO_CALL, false)){
                digest = getString(context, R.string.video_call) + txtBody.getMessage();
            }else if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
                if(!TextUtils.isEmpty(txtBody.getMessage())){
                    digest = txtBody.getMessage();
                }else{
                    digest = getString(context, R.string.dynamic_expression);
                }
            }else{
                digest = txtBody.getMessage();
            }
            break;
        case FILE: //普通文件消息
            digest = getString(context, R.string.file);
            break;
        default:
            EMLog.e(TAG, "error, unknow type");
            return "";
        }

        return digest;
    }
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:60,代码来源:EaseCommonUtils.java

示例4: getMessageDigest

import com.hyphenate.chat.EMTextMessageBody; //导入方法依赖的package包/类
/**
     * 根据消息内容和消息类型获取消息内容提示
     * 
     * @param message
     * @param context
     * @return
     */
    public static String getMessageDigest(EMMessage message, Context context) {
        String digest = "";
        switch (message.getType()) {
        case LOCATION: // 位置消息
            if (message.direct() == EMMessage.Direct.RECEIVE) {
                //从sdk中提到了ui中,使用更简单不犯错的获取string方法
//              digest = EasyUtils.getAppResourceString(context, "location_recv");
                digest = getString(context, R.string.location_recv);
                digest = String.format(digest, message.getFrom());
                return digest;
            } else {
//              digest = EasyUtils.getAppResourceString(context, "location_prefix");
                digest = getString(context, R.string.location_prefix);
            }
            break;
        case IMAGE: // 图片消息
            digest = getString(context, R.string.picture);
            break;
        case VOICE:// 语音消息
            digest = getString(context, R.string.voice_prefix);
            break;
        case VIDEO: // 视频消息
            digest = getString(context, R.string.video);
            break;
        case TXT: // 文本消息
            EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
            /*if(((DemoHXSDKHelper)HXSDKHelper.getInstance()).isRobotMenuMessage(message)){
                digest = ((DemoHXSDKHelper)HXSDKHelper.getInstance()).getRobotMenuMessageDigest(message);
            }else */if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_VOICE_CALL, false)){
                digest = getString(context, R.string.voice_call) + txtBody.getMessage();
            }else if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
                if(!TextUtils.isEmpty(txtBody.getMessage())){
                    digest = txtBody.getMessage();
                }else{
                    digest = getString(context, R.string.dynamic_expression);
                }
            }else{
                digest = txtBody.getMessage();
            }
            break;
        case FILE: //普通文件消息
            digest = getString(context, R.string.file);
            break;
        default:
            EMLog.e(TAG, "error, unknow type");
            return "";
        }

        return digest;
    }
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:58,代码来源:EaseCommonUtils.java


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