本文整理汇总了Java中com.hyphenate.easeui.EaseConstant.CHATTYPE_GROUP属性的典型用法代码示例。如果您正苦于以下问题:Java EaseConstant.CHATTYPE_GROUP属性的具体用法?Java EaseConstant.CHATTYPE_GROUP怎么用?Java EaseConstant.CHATTYPE_GROUP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.hyphenate.easeui.EaseConstant
的用法示例。
在下文中一共展示了EaseConstant.CHATTYPE_GROUP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inputAtUsername
/**
* input @
* @param username
*/
protected void inputAtUsername(String username, boolean autoAddAtSymbol){
if(EMClient.getInstance().getCurrentUser().equals(username) ||
chatType != EaseConstant.CHATTYPE_GROUP){
return;
}
EaseAtMessageHelper.get().addAtUser(username);
EaseUser user = EaseUserUtils.getUserInfo(username);
if (user != null){
username = user.getNick();
}
if(autoAddAtSymbol)
inputMenu.insertText("@" + username + " ");
else
inputMenu.insertText(username + " ");
}
示例2: sendAtMessage
/**
* 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);
}
示例3: sendMessage
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();
}
}
示例4: toGroupDetails
/**
* open group detail
*
*/
protected void toGroupDetails() {
if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername);
if (group == null) {
Toast.makeText(getActivity(), R.string.gorup_not_found, Toast.LENGTH_SHORT).show();
return;
}
if(chatFragmentHelper != null){
chatFragmentHelper.onEnterToChatDetails();
}
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
if(chatFragmentHelper != null){
chatFragmentHelper.onEnterToChatDetails();
}
}
}
示例5: sendMessage
protected void sendMessage(EMMessage message){
if(chatFragmentListener != null){
//设置扩展属性
chatFragmentListener.onSetMessageAttributes(message);
}
// 如果是群聊,设置chattype,默认是单聊
if (chatType == EaseConstant.CHATTYPE_GROUP){
message.setChatType(ChatType.GroupChat);
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
message.setChatType(ChatType.ChatRoom);
}
//发送消息
EMClient.getInstance().chatManager().sendMessage(message);
//刷新ui
if(isMessageListInited) {
messageList.refreshSelectLast();
}
}
示例6: toGroupDetails
/**
* 点击进入群组详情
*
*/
protected void toGroupDetails() {
if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername);
if (group == null) {
Toast.makeText(getActivity(), R.string.gorup_not_found, 0).show();
return;
}
if(chatFragmentListener != null){
chatFragmentListener.onEnterToChatDetails();
}
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
if(chatFragmentListener != null){
chatFragmentListener.onEnterToChatDetails();
}
}
}
示例7: inputAtUsername
/**
* input @
* @param username
*/
protected void inputAtUsername(String username, boolean autoAddAtSymbol){
if(EMClient.getInstance().getCurrentUser().equals(username) ||
chatType != EaseConstant.CHATTYPE_GROUP){
return;
}
EaseAtMessageHelper.get().addAtUser(username);
if(EaseUserUtils.getUserInfo(username) != null){
if(autoAddAtSymbol)
inputMenu.insertText("@" + EaseUserUtils.getUserInfo(username) + " ");
else
inputMenu.insertText(EaseUserUtils.getUserInfo(username) + " ");
}else{
if(autoAddAtSymbol)
inputMenu.insertText("@" + username + " ");
else
inputMenu.insertText(username + " ");
}
}
示例8: toGroupDetails
/**
* open group detail
*
*/
protected void toGroupDetails() {
if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername);
if (group == null) {
Toast.makeText(getActivity(), R.string.gorup_not_found, 0).show();
return;
}
if(chatFragmentHelper != null){
chatFragmentHelper.onEnterToChatDetails();
}
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
if(chatFragmentHelper != null){
chatFragmentHelper.onEnterToChatDetails();
}
}
}
示例9: getConversationType
/**
* 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;
}
}
示例10: onResume
@Override
public void onResume() {
super.onResume();
if(isMessageListInited)
messageList.refresh();
EaseUI.getInstance().pushActivity(getActivity());
// register the event listener when enter the foreground
EMClient.getInstance().chatManager().addMessageListener(this);
if(chatType == EaseConstant.CHATTYPE_GROUP){
EaseAtMessageHelper.get().removeAtMeGroup(toChatUsername);
}
}
示例11: onBackPressed
public void onBackPressed() {
if (inputMenu.onBackPressed()) {
getActivity().finish();
if(chatType == EaseConstant.CHATTYPE_GROUP){
EaseAtMessageHelper.get().removeAtMeGroup(toChatUsername);
EaseAtMessageHelper.get().cleanToAtUserList();
}
if (chatType == EaseConstant.CHATTYPE_CHATROOM) {
EMClient.getInstance().chatroomManager().leaveChatRoom(toChatUsername);
}
}
}
示例12: onResume
@Override
public void onResume() {
super.onResume();
if(isMessageListInited)
messageList.refresh();
EaseUI.getInstance().pushActivity(getActivity());
// 进入前台时注册事件监听器
EMClient.getInstance().chatManager().addMessageListener(this);
if(chatType == EaseConstant.CHATTYPE_GROUP){
EaseAtMessageHelper.get().removeAtMeGroup(toChatUsername);
}
}
示例13: getConversationType
/**
* 将应用的会话类型转化为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;
}
}
示例14: sendAtMessage
/**
* send @ message, only support group chat message
* @param content
*/
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);
message.setAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG,
EaseAtMessageHelper.get().atListToString(EaseAtMessageHelper.get().getAtMessageUsername(content)));
sendMessage(message);
}
示例15: startRedPacketActivityForResult
/**
* 进入发红包页面
*
* @param fragment
* @param chatType
* @param toChatUsername
* @param requestCode
*/
public static void startRedPacketActivityForResult(Fragment fragment, int chatType, String toChatUsername, int requestCode) {
//发送者头像url
String fromAvatarUrl = "";
//发送者昵称 设置了昵称就传昵称 否则传id
String fromNickname = "";
EaseUser easeUser = EaseUserUtils.getUserInfo(EMClient.getInstance().getCurrentUser());
if (easeUser != null) {
fromAvatarUrl = TextUtils.isEmpty(easeUser.getAvatar()) ? "none" : easeUser.getAvatar();
fromNickname = TextUtils.isEmpty(easeUser.getNick()) ? easeUser.getUsername() : easeUser.getNick();
}
RedPacketInfo redPacketInfo = new RedPacketInfo();
redPacketInfo.fromAvatarUrl = fromAvatarUrl;
redPacketInfo.fromNickName = fromNickname;
//接收者Id或者接收的群Id
if (chatType == EaseConstant.CHATTYPE_SINGLE) {
redPacketInfo.toUserId = toChatUsername;
redPacketInfo.chatType = 1;
} else if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername);
redPacketInfo.toGroupId = group.getGroupId();
redPacketInfo.groupMemberCount = group.getAffiliationsCount();
redPacketInfo.chatType = 2;
}
Intent intent = new Intent(fragment.getContext(), RPRedPacketActivity.class);
intent.putExtra(RPConstant.EXTRA_MONEY_INFO, redPacketInfo);
fragment.startActivityForResult(intent, requestCode);
}