Java Code Examples for com.hyphenate.chat.EMMessage#createTxtSendMessage()

The following examples show how to use com.hyphenate.chat.EMMessage#createTxtSendMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EaseChatFragment.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
/**
 * send @ message, only support group chat message
 * @param content
 */
@SuppressWarnings("ConstantConditions")
private void sendAtMessage(String content){
    if(chatType != EaseConstant.CHATTYPE_GROUP){
        EMLog.e(TAG, "only support group chat message");
        return;
    }
    EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
    EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername);
    if(EMClient.getInstance().getCurrentUser().equals(group.getOwner()) && EaseAtMessageHelper.get().containsAtAll(content)){
        message.setAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL);
    }else {
        message.setAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG,
                EaseAtMessageHelper.get().atListToJsonArray(EaseAtMessageHelper.get().getAtMessageUsernames(content)));
    }
    sendMessage(message);
    
}
 
Example 2
Source File: EaseCommonUtils.java    From Social with Apache License 2.0 5 votes vote down vote up
public static EMMessage createExpressionMessage(String toChatUsername, String expressioName, String identityCode){
    EMMessage message = EMMessage.createTxtSendMessage("["+expressioName+"]", toChatUsername);
       if(identityCode != null){
           message.setAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, identityCode);
       }
       message.setAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, true);
       return message;
}
 
Example 3
Source File: EaseCommonUtils.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
public static EMMessage createExpressionMessage(String toChatUsername, String expressioName, String identityCode){
    EMMessage message = EMMessage.createTxtSendMessage("["+expressioName+"]", toChatUsername);
       if(identityCode != null){
           message.setAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, identityCode);
       }
       message.setAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, true);
       return message;
}
 
Example 4
Source File: EaseChatFragment.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
protected void sendTextMessage(String content) {
    if(EaseAtMessageHelper.get().containsAtUsername(content)){
        sendAtMessage(content);
    }else{
        EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
        sendMessage(message);
    }
}
 
Example 5
Source File: EaseCommonUtils.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
public static EMMessage createExpressionMessage(String toChatUsername, String expressioName, String identityCode){
    EMMessage message = EMMessage.createTxtSendMessage("["+expressioName+"]", toChatUsername);
       if(identityCode != null){
           message.setAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, identityCode);
       }
       message.setAttribute(EaseConstant.MESSAGE_ATTR_IS_BIG_EXPRESSION, true);
       return message;
}
 
Example 6
Source File: MyEaseChatFragment.java    From Social with Apache License 2.0 4 votes vote down vote up
protected void sendTextMessage(String content) {
    System.out.println(content);
    EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
    sendMessage(message);
}
 
Example 7
Source File: EaseChatFragment.java    From Social with Apache License 2.0 4 votes vote down vote up
protected void sendTextMessage(String content) {
    System.out.println(content);
    EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
    sendMessage(message);
}
 
Example 8
Source File: EaseChatFragment.java    From nono-android with GNU General Public License v3.0 4 votes vote down vote up
protected void sendTextMessage(String content) {
    EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
    sendMessage(message);
}
 
Example 9
Source File: HxChatHelper.java    From FamilyChat with Apache License 2.0 3 votes vote down vote up
/**
 * 创建文本消息
 *
 * @param chatType 聊天类型
 * @param conId    会话id
 * @param content  内容
 * @return 文本消息
 */
public EMMessage createTextMessage(EMMessage.ChatType chatType, String conId, String content)
{
    EMMessage message = EMMessage.createTxtSendMessage(content, conId);
    message.setChatType(chatType);
    return message;
}