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


Java EMMessage.setChatType方法代码示例

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


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

示例1: sendMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
protected void sendMessage(EMMessage message){
    if (message == null) {
        return;
    }
    if(chatFragmentHelper != null){
        //set extension
        chatFragmentHelper.onSetMessageAttributes(message);
    }
    if (chatType == EaseConstant.CHATTYPE_GROUP){
        message.setChatType(ChatType.GroupChat);
    }else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
        message.setChatType(ChatType.ChatRoom);
    }
    //send message
    EMClient.getInstance().chatManager().sendMessage(message);
    //refresh ui
    if(isMessageListInited) {
        messageList.refreshSelectLast();
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:21,代码来源:EaseChatFragment.java

示例2: sendMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
protected void sendMessage(EMMessage message){
    if (message == null) {
        return;
    }
    if(chatFragmentHelper != null){
        //set extension
        chatFragmentHelper.onSetMessageAttributes(message);
    }
    if (chatType == EaseConstant.CHATTYPE_GROUP){
        message.setChatType(EMMessage.ChatType.GroupChat);
    }else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
        message.setChatType(EMMessage.ChatType.ChatRoom);
    }
    //send message
    EMClient.getInstance().chatManager().sendMessage(message);
    //refresh ui
    if(isMessageListInited) {
        messageList.refreshSelectLast();
    }
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:21,代码来源:EaseChatFragment.java

示例3: sendMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
protected void sendMessage(EMMessage message) {
    if (message == null) {
        return;
    }
    if (chatFragmentHelper != null) {
        //set extension
        chatFragmentHelper.onSetMessageAttributes(message);
    }
    if (chatType == EaseConstant.CHATTYPE_GROUP) {
        message.setChatType(ChatType.GroupChat);
    } else if (chatType == EaseConstant.CHATTYPE_CHATROOM) {
        message.setChatType(ChatType.ChatRoom);
    }
    //send message
    EMClient.getInstance().chatManager().sendMessage(message);
    //refresh ui
    if (isMessageListInited) {
        messageList.refreshSelectLast();
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:21,代码来源:EaseChatFragment.java

示例4: onRequestToJoinAccepted

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onRequestToJoinAccepted(String groupId, String groupName, String accepter) {

    String st4 = appContext.getString(R.string.Agreed_to_your_group_chat_application);
    // your application was accepted
    EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
    msg.setChatType(ChatType.GroupChat);
    msg.setFrom(accepter);
    msg.setTo(groupId);
    msg.setMsgId(UUID.randomUUID().toString());
    msg.addBody(new EMTextMessageBody(accepter + " " + st4));
    msg.setStatus(Status.SUCCESS);
    // save accept message
    EMClient.getInstance().chatManager().saveMessage(msg);
    // notify the accept message
    getNotifier().vibrateAndPlayTone(msg);

    broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:20,代码来源:DemoHelper.java

示例5: onAutoAcceptInvitationFromGroup

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onAutoAcceptInvitationFromGroup(String groupId, String inviter, String inviteMessage) {
    // got an invitation
    String st3 = appContext.getString(R.string.Invite_you_to_join_a_group_chat);
    EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
    msg.setChatType(ChatType.GroupChat);
    msg.setFrom(inviter);
    msg.setTo(groupId);
    msg.setMsgId(UUID.randomUUID().toString());
    msg.addBody(new EMTextMessageBody(inviter + " " + st3));
    msg.setStatus(EMMessage.Status.SUCCESS);
    // save invitation as messages
    EMClient.getInstance().chatManager().saveMessage(msg);
    // notify invitation message
    getNotifier().vibrateAndPlayTone(msg);
    EMLog.d(TAG, "onAutoAcceptInvitationFromGroup groupId:" + groupId);
    broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:19,代码来源:DemoHelper.java

示例6: receiveRedPacketAckMessage

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * 使用cmd消息收取领到红包之后的回执消息
 */
public static void receiveRedPacketAckMessage(EMMessage message) {
    String senderNickname = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_NAME, "");
    String receiverNickname = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_NAME, "");
    String senderId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_ID, "");
    String receiverId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_ID, "");
    String groupId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_GROUP_ID, "");
    String currentUser = EMClient.getInstance().getCurrentUser();
    //更新UI为 xx领取了你的红包
    if (currentUser.equals(senderId) && !receiverId.equals(senderId)) {//如果不是自己领取的红包更新此类消息UI
        EMMessage msg = EMMessage.createTxtSendMessage("content", groupId);
        msg.setChatType(EMMessage.ChatType.GroupChat);
        msg.setFrom(message.getFrom());
        if (TextUtils.isEmpty(groupId)) {
            msg.setTo(message.getTo());
        } else {
            msg.setTo(groupId);
        }
        msg.setMsgId(UUID.randomUUID().toString());
        msg.setMsgTime(message.getMsgTime());
        msg.setDirection(EMMessage.Direct.RECEIVE);
        msg.setUnread(false);//去掉未读的显示
        msg.setAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_ACK_MESSAGE, true);
        msg.setAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_NAME, senderNickname);
        msg.setAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_NAME, receiverNickname);
        msg.setAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_ID, senderId);
        //保存消息
        EMClient.getInstance().chatManager().saveMessage(msg);
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:33,代码来源:RedPacketUtil.java


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