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


Java EMMessage.getBooleanAttribute方法代码示例

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


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

示例1: getCustomChatRow

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
        public EaseChatRow getCustomChatRow(EMMessage message, int position, BaseAdapter adapter) {
            if (message.getType() == EMMessage.Type.TXT) {
                // voice call or video call
                if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false) ||
                        message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)) {
                    return new ChatRowVoiceCall(getActivity(), message, position, adapter);
                }
//                //red packet code : 红包消息、红包回执消息以及转账消息的chat row
//                else if (RedPacketUtil.isRandomRedPacket(message)) {//小额随机红包
//                    return new ChatRowRandomPacket(getActivity(), message, position, adapter);
//                } else if (message.getBooleanAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_MESSAGE, false)) {//红包消息
//                    return new ChatRowRedPacket(getActivity(), message, position, adapter);
//                } else if (message.getBooleanAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_ACK_MESSAGE, false)) {//红包回执消息
//                    return new ChatRowRedPacketAck(getActivity(), message, position, adapter);
//                }
                //end of red packet code
            }
            return null;
        }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:21,代码来源:ChatFragment.java

示例2: getItemViewType

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * get type of item
 */
public int getItemViewType(int position) {
	EMMessage message = getItem(position); 
	if (message == null) {
		return -1;
	}
	
	if(customRowProvider != null && customRowProvider.getCustomChatRowType(message) > 0){
	    return customRowProvider.getCustomChatRowType(message) + 13;
	}
	
	if (message.getType() == EMMessage.Type.TXT) {
	    if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
	        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_EXPRESSION : MESSAGE_TYPE_SENT_EXPRESSION;
	    }
		return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_TXT : MESSAGE_TYPE_SENT_TXT;
	}
	if (message.getType() == EMMessage.Type.IMAGE) {
		return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_IMAGE : MESSAGE_TYPE_SENT_IMAGE;

	}
	if (message.getType() == EMMessage.Type.LOCATION) {
		return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_LOCATION : MESSAGE_TYPE_SENT_LOCATION;
	}
	if (message.getType() == EMMessage.Type.VOICE) {
		return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VOICE : MESSAGE_TYPE_SENT_VOICE;
	}
	if (message.getType() == EMMessage.Type.VIDEO) {
		return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VIDEO : MESSAGE_TYPE_SENT_VIDEO;
	}
	if (message.getType() == EMMessage.Type.FILE) {
		return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_FILE : MESSAGE_TYPE_SENT_FILE;
	}

	return -1;// invalid
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:39,代码来源:EaseMessageAdapter.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:turoDog,项目名称:KTalk,代码行数: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

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

示例6: getItemViewType

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * get type of item
 */
public int getItemViewType(int position) {
    EMMessage message = getItem(position);
    if (message == null) {
        return -1;
    }

    if(customRowProvider != null && customRowProvider.getCustomChatRowType(message) > 0){
        return customRowProvider.getCustomChatRowType(message) + 13;
    }

    if (message.getType() == EMMessage.Type.TXT) {
        if(message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)){
            return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_EXPRESSION : MESSAGE_TYPE_SENT_EXPRESSION;
        }
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_TXT : MESSAGE_TYPE_SENT_TXT;
    }
    if (message.getType() == EMMessage.Type.IMAGE) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_IMAGE : MESSAGE_TYPE_SENT_IMAGE;

    }
    if (message.getType() == EMMessage.Type.LOCATION) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_LOCATION : MESSAGE_TYPE_SENT_LOCATION;
    }
    if (message.getType() == EMMessage.Type.VOICE) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VOICE : MESSAGE_TYPE_SENT_VOICE;
    }
    if (message.getType() == EMMessage.Type.VIDEO) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VIDEO : MESSAGE_TYPE_SENT_VIDEO;
    }
    if (message.getType() == EMMessage.Type.FILE) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_FILE : MESSAGE_TYPE_SENT_FILE;
    }

    return -1;// invalid
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:39,代码来源:EaseMessageAdapter.java

示例7: getItemViewType

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * get type of item
 */
public int getItemViewType(int position) {
    EMMessage message = getItem(position);
    if (message == null) {
        return -1;
    }

    if (customRowProvider != null && customRowProvider.getCustomChatRowType(message) > 0) {
        return customRowProvider.getCustomChatRowType(message) + 13;
    }

    if (message.getType() == EMMessage.Type.TXT) {
        if (message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)) {
            return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_EXPRESSION : MESSAGE_TYPE_SENT_EXPRESSION;
        }
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_TXT : MESSAGE_TYPE_SENT_TXT;
    }
    if (message.getType() == EMMessage.Type.IMAGE) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_IMAGE : MESSAGE_TYPE_SENT_IMAGE;

    }
    if (message.getType() == EMMessage.Type.LOCATION) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_LOCATION : MESSAGE_TYPE_SENT_LOCATION;
    }
    if (message.getType() == EMMessage.Type.VOICE) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VOICE : MESSAGE_TYPE_SENT_VOICE;
    }
    if (message.getType() == EMMessage.Type.VIDEO) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VIDEO : MESSAGE_TYPE_SENT_VIDEO;
    }
    if (message.getType() == EMMessage.Type.FILE) {
        return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_FILE : MESSAGE_TYPE_SENT_FILE;
    }

    return -1;// invalid
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:39,代码来源:EaseMessageAdapter.java

示例8: getMessageDigest

import com.hyphenate.chat.EMMessage; //导入方法依赖的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

示例9: createChatRow

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
protected EaseChatRow createChatRow(Context context, final EMMessage message, int position) {
        EaseChatRow chatRow = null;
        if (customRowProvider != null && customRowProvider.getCustomChatRow(message, position, this) != null) {
            return customRowProvider.getCustomChatRow(message, position, this);
        }
        switch (message.getType()) {
            case TXT:
                if (message.getBooleanAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)) {
                    chatRow = new EaseChatRowBigExpression(context, message, position, this);
                } else {

//                    if (StringUtils.isNotEmpty(message.getStringAttribute("recTransfer", null))) {
//                        chatRow = new EaseChatRowRecSendMoney(context, message, position, this);
////                    } else if (StringUtils.isNotEmpty(message.getStringAttribute("transfer", null))) {
//                        chatRow = new EaseChatRowSendMoney(context, message, position, this, this);
////                    } else if (StringUtils.isNotEmpty(message.getStringAttribute("redPacket", null))) {
//                        chatRow = new EaseChatRowRedPacket(context, message, position, this, this);
////                    } else if (StringUtils.isNotEmpty(message.getStringAttribute("groupRedPacket", null))) {
//                        chatRow = new EaseChatRowRedPacket(context, message, position, this, this);
//                    } else {
                    chatRow = new EaseChatRowText(context, message, position, this, mIRBack);
//                    }

                }
                break;
            case LOCATION:
                chatRow = new EaseChatRowLocation(context, message, position, this);
                break;
            case FILE:
                chatRow = new EaseChatRowFile(context, message, position, this);
                break;
            case IMAGE:
                chatRow = new EaseChatRowImage(context, message, position, this);
                break;
            case VOICE:
                chatRow = new EaseChatRowVoice(context, message, position, this);
                break;
            case VIDEO:
                chatRow = new EaseChatRowVideo(context, message, position, this);
                break;
            default:
                break;
        }
        return chatRow;
    }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:46,代码来源:EaseMessageAdapter.java

示例10: onCreate

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EMMessage message = getIntent().getParcelableExtra("message");
        boolean isChatroom = getIntent().getBooleanExtra("ischatroom", false);

        int type = message.getType().ordinal();
        if (type == EMMessage.Type.TXT.ordinal()) {
//		    if(message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)
//					|| message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false)
//					//red packet code : 屏蔽红包消息的转发功能
//					|| message.getBooleanAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_MESSAGE, false)){
            if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)
                    || message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false)
                //red packet code : 屏蔽红包消息的转发功能
                    ) {
                //end of red packet code
                setContentView(R.layout.em_context_menu_for_location);
            } else if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_BIG_EXPRESSION, false)) {
                setContentView(R.layout.em_context_menu_for_image);
            } else {
                setContentView(R.layout.em_context_menu_for_text);
            }
        } else if (type == EMMessage.Type.LOCATION.ordinal()) {
            setContentView(R.layout.em_context_menu_for_location);
        } else if (type == EMMessage.Type.IMAGE.ordinal()) {
            setContentView(R.layout.em_context_menu_for_image);
        } else if (type == EMMessage.Type.VOICE.ordinal()) {
            setContentView(R.layout.em_context_menu_for_voice);
        } else if (type == EMMessage.Type.VIDEO.ordinal()) {
            setContentView(R.layout.em_context_menu_for_video);
        } else if (type == EMMessage.Type.FILE.ordinal()) {
            setContentView(R.layout.em_context_menu_for_location);
        }
//        if (isChatroom
//                //red packet code : 屏蔽红包消息的撤回功能
//                || message.getBooleanAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_MESSAGE, false)) {
        if (isChatroom
            //red packet code : 屏蔽红包消息的撤回功能
                ) {
            //end of red packet code
            View v = (View) findViewById(R.id.forward);
            if (v != null) {
                v.setVisibility(View.GONE);
            }
        }
    }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:48,代码来源:ContextMenuActivity.java

示例11: isSilentMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * \~chinese
 * 判断是否是免打扰的消息,如果是app中应该不要给用户提示新消息
 * @param message
 * return
 *
 * \~english
 * check if the message is kind of slient message, if that's it, app should not play tone or vibrate
 *
 * @param message
 * @return
 */
public static boolean isSilentMessage(EMMessage message){
    return message.getBooleanAttribute("em_ignore_notification", false);
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:16,代码来源:EaseCommonUtils.java


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