Java Code Examples for com.hyphenate.chat.EMMessage#ChatType

The following examples show how to use com.hyphenate.chat.EMMessage#ChatType . 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: HxChatPresenter.java    From FamilyChat with Apache License 2.0 5 votes vote down vote up
/**
 * 根据EMConversationType获取ChatType
 */
private EMMessage.ChatType getChatTypeFromConType(EMConversation.EMConversationType conType)
{
    if (conType == EMConversation.EMConversationType.Chat)
        return EMMessage.ChatType.Chat;
    else if (conType == EMConversation.EMConversationType.GroupChat)
        return EMMessage.ChatType.GroupChat;
    else if (conType == EMConversation.EMConversationType.ChatRoom)
        return EMMessage.ChatType.ChatRoom;
    else
        return EMMessage.ChatType.Chat;
}
 
Example 2
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;
}
 
Example 3
Source File: HxChatHelper.java    From FamilyChat with Apache License 2.0 3 votes vote down vote up
/**
 * 创建语音消息
 *
 * @param chatType 聊天类型
 * @param conId    会话id
 * @param filePath 语音文件地址
 * @param seconds  语音时长【秒】
 * @return 语音消息
 */
public EMMessage createVoiceMessage(EMMessage.ChatType chatType, String conId, String filePath, int seconds)
{
    EMMessage message = EMMessage.createVoiceSendMessage(filePath, seconds, conId);
    message.setChatType(chatType);
    return message;
}
 
Example 4
Source File: HxChatHelper.java    From FamilyChat with Apache License 2.0 3 votes vote down vote up
/**
 * 创建图片消息
 *
 * @param chatType      聊天类型
 * @param conId         会话id
 * @param filePath      图片文件地址
 * @param sendOriginPic 是否发送原图【false为不发送,超过100K会被压缩发送】
 * @return 图片消息
 */
public EMMessage createImageMessage(EMMessage.ChatType chatType, String conId, String filePath, boolean sendOriginPic)
{
    EMMessage message = EMMessage.createImageSendMessage(filePath, sendOriginPic, conId);
    message.setChatType(chatType);
    return message;
}
 
Example 5
Source File: HxChatHelper.java    From FamilyChat with Apache License 2.0 3 votes vote down vote up
/**
 * 创建视频消息
 *
 * @param chatType    聊天类型
 * @param conId       会话id
 * @param filePath    视频文件地址
 * @param thumbPath   预览图文件地址
 * @param videoLength 视频时长【秒1】
 * @return 视频消息
 */
public EMMessage createVideoMessage(EMMessage.ChatType chatType, String conId, String filePath, String thumbPath, int videoLength)
{
    EMMessage message = EMMessage.createVideoSendMessage(filePath, thumbPath, videoLength, conId);
    message.setChatType(chatType);
    return message;
}
 
Example 6
Source File: HxChatHelper.java    From FamilyChat with Apache License 2.0 3 votes vote down vote up
/**
 * 创建位置消息
 *
 * @param chatType        聊天类型
 * @param conId           会话id
 * @param latitude        纬度
 * @param longitude       经度
 * @param locationAddress 地址
 * @return 位置消息
 */
public EMMessage createLocationMessage(EMMessage.ChatType chatType, String conId, long latitude, long longitude, String locationAddress)
{
    EMMessage message = EMMessage.createLocationSendMessage(latitude, longitude, locationAddress, conId);
    message.setChatType(EMMessage.ChatType.GroupChat);
    return message;
}
 
Example 7
Source File: HxChatHelper.java    From FamilyChat with Apache License 2.0 3 votes vote down vote up
/**
 * 创建文件消息
 *
 * @param chatType 聊天类型
 * @param conId    会话id
 * @param filePath 文件地址
 * @return 文件消息
 */
public EMMessage createFileMessage(EMMessage.ChatType chatType, String conId, String filePath)
{
    EMMessage message = EMMessage.createFileSendMessage(filePath, conId);
    message.setChatType(chatType);
    return message;
}