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


Java EMMessage.direct方法代码示例

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


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

示例1: getCustomChatRowType

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public int getCustomChatRowType(EMMessage message) {
    if (message.getType() == EMMessage.Type.TXT) {
        //voice call
        if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false)) {
            return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VOICE_CALL : MESSAGE_TYPE_SENT_VOICE_CALL;
        } else if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)) {
            //video call
            return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VIDEO_CALL : MESSAGE_TYPE_SENT_VIDEO_CALL;
        }
        //red packet code : 红包消息、红包回执消息以及转账消息的chatrow type
        else if (RedPacketUtil.isRandomRedPacket(message)) {
            //小额随机红包
            return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_RANDOM : MESSAGE_TYPE_SEND_RANDOM;
        } else if (message.getBooleanAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_MESSAGE, false)) {
            //发送红包消息
            return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_RED_PACKET : MESSAGE_TYPE_SEND_RED_PACKET;
        } else if (message.getBooleanAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_ACK_MESSAGE, false)) {
            //领取红包消息
            return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_RED_PACKET_ACK : MESSAGE_TYPE_SEND_RED_PACKET_ACK;
        }
        //end of red packet code
    }
    return 0;
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:26,代码来源: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: 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

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

示例5: getMessageDirect

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
private static String getMessageDirect(EMMessage message) {
    String messageDirect;
    if (message.direct() == EMMessage.Direct.SEND) {
        messageDirect = RPConstant.MESSAGE_DIRECT_SEND;
    } else {
        messageDirect = RPConstant.MESSAGE_DIRECT_RECEIVE;
    }
    return messageDirect;
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:10,代码来源:RedPacketUtil.java

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

示例7: getItemViewType

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public int getItemViewType(int position) {
    EMMessage message = mMessages.get(position);
    return message.direct() == EMMessage.Direct.SEND ? ITEM_TYPE_SEND_MESSAGE : ITEM_TYPE_RECEIVE_MESSAGE;
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:6,代码来源:MessageListAdapter.java


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