• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EMConversationType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



EMConversationType类属于com.hyphenate.chat.EMConversation包,在下文中一共展示了EMConversationType类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getConversationType

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
/**
 * change the chat type to EMConversationType
 * @param chatType
 * @return
 */
public static EMConversationType getConversationType(int chatType) {
    if (chatType == EaseConstant.CHATTYPE_SINGLE) {
        return EMConversationType.Chat;
    } else if (chatType == EaseConstant.CHATTYPE_GROUP) {
        return EMConversationType.GroupChat;
    } else {
        return EMConversationType.ChatRoom;
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:15,代码来源:EaseCommonUtils.java


示例2: clearGroupHistory

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
/**
 * 清空群聊天记录
 */
private void clearGroupHistory() {

    EMConversation conversation = EMClient.getInstance().chatManager().getConversation(group.getGroupId(), EMConversationType.GroupChat);
    if (conversation != null) {
        conversation.clearAllMessages();
    }
    Toast.makeText(this, R.string.messages_are_empty, Toast.LENGTH_SHORT).show();
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:12,代码来源:GroupDetailsActivity.java


示例3: clearGroupHistory

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
/**
 * clear conversation history in group
 */
public void clearGroupHistory() {
    EMConversation conversation = EMClient.getInstance().chatManager().getConversation(room.getId(), EMConversationType.ChatRoom);
    if (conversation != null) {
        conversation.clearAllMessages();
    }
    Toast.makeText(this, R.string.messages_are_empty, Toast.LENGTH_SHORT).show();
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:11,代码来源:ChatRoomDetailsActivity.java


示例4: onContextItemSelected

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
@Override
    public boolean onContextItemSelected(MenuItem item) {
        boolean deleteMessage = false;
        if (item.getItemId() == R.id.delete_message) {
            deleteMessage = true;
        } else if (item.getItemId() == R.id.delete_conversation) {
            deleteMessage = false;
        }
        EMConversation tobeDeleteCons = conversationListView.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position -1);
        if (tobeDeleteCons == null) {
            return true;
        }
        if (tobeDeleteCons.getType() == EMConversationType.GroupChat) {
            EaseAtMessageHelper.get().removeAtMeGroup(tobeDeleteCons.conversationId());
        }
        try {
            // delete conversation
            EMClient.getInstance().chatManager().deleteConversation(tobeDeleteCons.conversationId(), deleteMessage);
            InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
            inviteMessgeDao.deleteMessage(tobeDeleteCons.conversationId());
        } catch (Exception e) {
            e.printStackTrace();
        }
        refresh();

        // update unread count
//        ((MainActivity) getActivity()).updateUnreadLabel();
        return true;
    }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:30,代码来源:ConversationListFragment.java


示例5: onContextItemSelected

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
@Override
    public boolean onContextItemSelected(MenuItem item) {
        boolean deleteMessage = false;
        if (item.getItemId() == R.id.delete_message) {
            deleteMessage = true;
        } else if (item.getItemId() == R.id.delete_conversation) {
            deleteMessage = false;
        }
        EMConversation tobeDeleteCons = conversationListView.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
        if (tobeDeleteCons == null) {
            return true;
        }
        if (tobeDeleteCons.getType() == EMConversationType.GroupChat) {
            EaseAtMessageHelper.get().removeAtMeGroup(tobeDeleteCons.conversationId());
        }
        try {
            // delete conversation
            EMClient.getInstance().chatManager().deleteConversation(tobeDeleteCons.conversationId(), deleteMessage);
            InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
            inviteMessgeDao.deleteMessage(tobeDeleteCons.conversationId());
        } catch (Exception e) {
            e.printStackTrace();
        }
        refresh();

        // update unread count
//        ((MainActivity) getActivity()).updateUnreadLabel();
        return true;
    }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:30,代码来源:ConverSearchFragment.java


示例6: getConversationType

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
/**
 * 将应用的会话类型转化为SDK的会话类型
 * @param chatType
 * @return
 */
public static EMConversationType getConversationType(int chatType) {
    if (chatType == EaseConstant.CHATTYPE_SINGLE) {
        return EMConversationType.Chat;
    } else if (chatType == EaseConstant.CHATTYPE_GROUP) {
        return EMConversationType.GroupChat;
    } else {
        return EMConversationType.ChatRoom;
    }
}
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:15,代码来源:EaseCommonUtils.java


示例7: clearGroupHistory

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
/**
 * 清空群聊天记录
 */
private void clearGroupHistory() {

	EMConversation conversation = EMClient.getInstance().chatManager().getConversation(group.getGroupId(), EMConversationType.GroupChat);
	if (conversation != null) {
		conversation.clearAllMessages();
	}
	Toast.makeText(this, R.string.messages_are_empty, 0).show();
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:12,代码来源:GroupDetailsActivity.java


示例8: clearGroupHistory

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
/**
 * clear conversation history in group
 */
public void clearGroupHistory() {
	EMConversation conversation = EMClient.getInstance().chatManager().getConversation(room.getId(), EMConversationType.ChatRoom);
	if (conversation != null) {
		conversation.clearAllMessages();
	}
	Toast.makeText(this, R.string.messages_are_empty, 0).show();
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:11,代码来源:ChatRoomDetailsActivity.java


示例9: getUnreadMsgCountTotal

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
/**
 * get unread message count
 * 
 * @return
 */
public int getUnreadMsgCountTotal() {
	int unreadMsgCountTotal = 0;
	int chatroomUnreadMsgCount = 0;
	unreadMsgCountTotal = EMClient.getInstance().chatManager().getUnreadMsgsCount();
	for(EMConversation conversation:EMClient.getInstance().chatManager().getAllConversations().values()){
		if(conversation.getType() == EMConversationType.ChatRoom)
		chatroomUnreadMsgCount=chatroomUnreadMsgCount+conversation.getUnreadMsgCount();
	}
	return unreadMsgCountTotal-chatroomUnreadMsgCount;
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:16,代码来源:MainActivity.java


示例10: setUpView

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
@Override
protected void setUpView() {
    super.setUpView();
    // register context menu
    registerForContextMenu(conversationListView);
    conversationListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            EMConversation conversation = conversationListView.getItem(position - 1);
            String username = conversation.conversationId();
            if (username.equals(EMClient.getInstance().getCurrentUser()))
                Toast.makeText(getActivity(), R.string.Cant_chat_with_yourself, Toast.LENGTH_SHORT).show();
            else {
                // start chat acitivity
                Intent intent = new Intent(getActivity(), ChatActivity.class);
                if (conversation.isGroup()) {
                    if (conversation.getType() == EMConversationType.ChatRoom) {
                        // it's group chat
                        intent.putExtra(Constant.EXTRA_CHAT_TYPE, Constant.CHATTYPE_CHATROOM);
                    } else {
                        intent.putExtra(Constant.EXTRA_CHAT_TYPE, Constant.CHATTYPE_GROUP);
                    }

                }
                // it's single chat
                intent.putExtra(Constant.EXTRA_USER_ID, username);
                startActivity(intent);
            }
        }
    });
    //red packet code : 红包回执消息在会话列表最后一条消息的展示
    conversationListView.setConversationListHelper(new EaseConversationList.EaseConversationListHelper() {
        @Override
        public String onSetItemSecondaryText(EMMessage lastMessage) {
            if (lastMessage.getBooleanAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_ACK_MESSAGE, false)) {
                String sendNick = lastMessage.getStringAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_NAME, "");
                String receiveNick = lastMessage.getStringAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_NAME, "");
                String msg;
                if (lastMessage.direct() == EMMessage.Direct.RECEIVE) {
                    msg = String.format(getResources().getString(R.string.msg_someone_take_red_packet), receiveNick);
                } else {
                    if (sendNick.equals(receiveNick)) {
                        msg = getResources().getString(R.string.msg_take_red_packet);
                    } else {
                        msg = String.format(getResources().getString(R.string.msg_take_someone_red_packet), sendNick);
                    }
                }
                return msg;
            }
            return null;
        }
    });
    super.setUpView();
    //end of red packet code
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:57,代码来源:ConversationListFragment.java


示例11: setUpView

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
@Override
protected void setUpView() {
    super.setUpView();
    // register context menu
    registerForContextMenu(conversationListView);
    conversationListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            EMConversation conversation = conversationListView.getItem(position);
            String username = conversation.conversationId();
            if (username.equals(EMClient.getInstance().getCurrentUser()))
                Toast.makeText(getActivity(), R.string.Cant_chat_with_yourself, Toast.LENGTH_SHORT).show();
            else {
                // start chat acitivity
                Intent intent = new Intent(getActivity(), ChatActivity.class);
                if (conversation.isGroup()) {
                    if (conversation.getType() == EMConversationType.ChatRoom) {
                        // it's group chat
                        intent.putExtra(Constant.EXTRA_CHAT_TYPE, Constant.CHATTYPE_CHATROOM);
                    } else {
                        intent.putExtra(Constant.EXTRA_CHAT_TYPE, Constant.CHATTYPE_GROUP);
                    }

                }
                // it's single chat
                    intent.putExtra(Constant.EXTRA_USER_ID, username);
                startActivity(intent);
            }
        }
    });
    //red packet code : 红包回执消息在会话列表最后一条消息的展示
    conversationListView.setConversationListHelper(new EaseConversationList.EaseConversationListHelper() {
        @Override
        public String onSetItemSecondaryText(EMMessage lastMessage) {
            if (lastMessage.getBooleanAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_ACK_MESSAGE, false)) {
                String sendNick = lastMessage.getStringAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_NAME, "");
                String receiveNick = lastMessage.getStringAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_NAME, "");
                String msg;
                if (lastMessage.direct() == EMMessage.Direct.RECEIVE) {
                    msg = String.format(getResources().getString(R.string.msg_someone_take_red_packet), receiveNick);
                } else {
                    if (sendNick.equals(receiveNick)) {
                        msg = getResources().getString(R.string.msg_take_red_packet);
                    } else {
                        msg = String.format(getResources().getString(R.string.msg_take_someone_red_packet), sendNick);
                    }
                }
                return msg;
            }
            return null;
        }
    });
    super.setUpView();
    //end of red packet code
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:57,代码来源:ConverSearchFragment.java


示例12: getView

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.ease_row_chat_history, parent, false);
    }
    ViewHolder holder = (ViewHolder) convertView.getTag();
    if (holder == null) {
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.name);
        holder.unreadLabel = (TextView) convertView.findViewById(R.id.unread_msg_number);
        holder.message = (TextView) convertView.findViewById(R.id.message);
        holder.time = (TextView) convertView.findViewById(R.id.time);
        holder.avatar = (ImageView) convertView.findViewById(R.id.avatar);
        holder.msgState = convertView.findViewById(R.id.msg_state);
        holder.list_itease_layout = (RelativeLayout) convertView.findViewById(R.id.list_itease_layout);
        convertView.setTag(holder);
    }
    holder.list_itease_layout.setBackgroundResource(R.drawable.ease_mm_listitem);

    // 获取与此用户/群组的会话
    EMConversation conversation = getItem(position);
    // 获取用户username或者群组groupid
    String username = conversation.getUserName();
    
    if (conversation.getType() == EMConversationType.GroupChat) {
        // 群聊消息,显示群聊头像
        holder.avatar.setImageResource(R.drawable.ease_group_icon);
        EMGroup group = EMClient.getInstance().groupManager().getGroup(username);
        holder.name.setText(group != null ? group.getGroupName() : username);
    } else if(conversation.getType() == EMConversationType.ChatRoom){
        holder.avatar.setImageResource(R.drawable.ease_group_icon);
        EMChatRoom room = EMClient.getInstance().chatroomManager().getChatRoom(username);
        holder.name.setText(room != null && !TextUtils.isEmpty(room.getName()) ? room.getName() : username);
    }else {
        EaseUserUtils.setUserAvatar(getContext(), username, holder.avatar);
        EaseUserUtils.setUserNick(username, holder.name);
    }

    if (conversation.getUnreadMsgCount() > 0) {
        // 显示与此用户的消息未读数
        holder.unreadLabel.setText(String.valueOf(conversation.getUnreadMsgCount()));
        holder.unreadLabel.setVisibility(View.VISIBLE);
    } else {
        holder.unreadLabel.setVisibility(View.INVISIBLE);
    }

    if (conversation.getAllMsgCount() != 0) {
        // 把最后一条消息的内容作为item的message内容
        EMMessage lastMessage = conversation.getLastMessage();
        holder.message.setText(EaseSmileUtils.getSmiledText(getContext(), EaseCommonUtils.getMessageDigest(lastMessage, (this.getContext()))),
                BufferType.SPANNABLE);

        holder.time.setText(DateUtils.getTimestampString(new Date(lastMessage.getMsgTime())));
        if (lastMessage.direct() == EMMessage.Direct.SEND && lastMessage.status() == EMMessage.Status.FAIL) {
            holder.msgState.setVisibility(View.VISIBLE);
        } else {
            holder.msgState.setVisibility(View.GONE);
        }
    }
    
    //设置自定义属性
    holder.name.setTextColor(primaryColor);
    holder.message.setTextColor(secondaryColor);
    holder.time.setTextColor(timeColor);
    if(primarySize != 0)
        holder.name.setTextSize(TypedValue.COMPLEX_UNIT_PX, primarySize);
    if(secondarySize != 0)
        holder.message.setTextSize(TypedValue.COMPLEX_UNIT_PX, secondarySize);
    if(timeSize != 0)
        holder.time.setTextSize(TypedValue.COMPLEX_UNIT_PX, timeSize);

    return convertView;
}
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:74,代码来源:EaseConversationAdapater.java


示例13: setUpView

import com.hyphenate.chat.EMConversation.EMConversationType; //导入依赖的package包/类
@Override
protected void setUpView() {
    super.setUpView();
    // register context menu
    registerForContextMenu(conversationListView);
    conversationListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            EMConversation conversation = conversationListView.getItem(position);
            String username = conversation.getUserName();
            if (username.equals(EMClient.getInstance().getCurrentUser()))
                Toast.makeText(getActivity(), R.string.Cant_chat_with_yourself, 0).show();
            else {
                // start chat acitivity
                Intent intent = new Intent(getActivity(), ChatActivity.class);
                if(conversation.isGroup()){
                    if(conversation.getType() == EMConversationType.ChatRoom){
                        // it's group chat
                        intent.putExtra(Constant.EXTRA_CHAT_TYPE, Constant.CHATTYPE_CHATROOM);
                    }else{
                        intent.putExtra(Constant.EXTRA_CHAT_TYPE, Constant.CHATTYPE_GROUP);
                    }
                    
                }
                // it's single chat
                intent.putExtra(Constant.EXTRA_USER_ID, username);
                startActivity(intent);
            }
        }
    });
    conversationListView.setConversationListHelper(new EaseConversationListHelper() {
        @Override
        public String onSetItemSecondaryText(EMMessage lastMessage) {
            if (lastMessage.getBooleanAttribute(RedPacketConstant.MESSAGE_ATTR_IS_RED_PACKET_ACK_MESSAGE, false)) {
                try {
                    String sendNick = lastMessage.getStringAttribute(RedPacketConstant.EXTRA_RED_PACKET_SENDER_NAME);
                    String receiveNick = lastMessage.getStringAttribute(RedPacketConstant.EXTRA_RED_PACKET_RECEIVER_NAME);
                    String msg;
                    if (lastMessage.direct() == EMMessage.Direct.RECEIVE) {
                        msg = String.format(getResources().getString(R.string.money_msg_someone_take_money),receiveNick);
                    } else {
                        if (sendNick.equals(receiveNick)) {
                            msg = getResources().getString(R.string.money_msg_take_money);
                        } else {
                            msg = String.format(getResources().getString(R.string.money_msg_take_someone_money),sendNick);
                        }
                    }
                    return msg;
                } catch (HyphenateException e) {
                    e.printStackTrace();
                }
            }
            return null;
        }
    });
    super.setUpView();
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:59,代码来源:ConversationListFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AssignementTestable类代码示例发布时间:2022-05-23
下一篇:
Java TagConfig类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap