本文整理汇总了Java中com.easemob.chat.EMGroup类的典型用法代码示例。如果您正苦于以下问题:Java EMGroup类的具体用法?Java EMGroup怎么用?Java EMGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMGroup类属于com.easemob.chat包,在下文中一共展示了EMGroup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onContextItemSelected
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
if (item.getItemId() == R.id.delete_message) {
EMContact tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
boolean isGroup = false;
if(tobeDeleteUser instanceof EMGroup)
isGroup = true;
// 删除此会话
EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getUsername(),isGroup);
InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
inviteMessgeDao.deleteMessage(tobeDeleteUser.getUsername());
adapter.remove(tobeDeleteUser);
adapter.notifyDataSetChanged();
// 更新消息未读数
((MainActivity) getActivity()).updateUnreadLabel();
return true;
}
return super.onContextItemSelected(item);
}
开发者ID:macyuan,项目名称:TAG,代码行数:22,代码来源:ChatHistoryFragment.java
示例2: toGroupDetails
import com.easemob.chat.EMGroup; //导入依赖的package包/类
/**
* 点击进入群组详情
*
*/
protected void toGroupDetails() {
if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMGroupManager.getInstance().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();
}
}
}
开发者ID:easemob,项目名称:easeui,代码行数:21,代码来源:EaseChatFragment.java
示例3: toGroupDetails
import com.easemob.chat.EMGroup; //导入依赖的package包/类
/**
* 点击进入群组详情
*/
protected void toGroupDetails() {
if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMGroupManager.getInstance().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();
}
}
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:20,代码来源:EaseChatFragment.java
示例4: updateGroup
import com.easemob.chat.EMGroup; //导入依赖的package包/类
protected void updateGroup() {
new Thread(new Runnable() {
public void run() {
try {
EMGroup returnGroup = EMGroupManager.getInstance().getGroupFromServer(groupId);
//更新本地数据
EMGroupManager.getInstance().createOrUpdateLocalGroup(returnGroup);
runOnUiThread(new Runnable() {
public void run() {
((TextView) findViewById(R.id.group_name)).setText(group.getGroupName()+"("+group.getAffiliationsCount()+"人)");
loadingPB.setVisibility(View.INVISIBLE);
adapter.notifyDataSetChanged();
if (EMChatManager.getInstance().getCurrentUser().equals(group.getOwner())) {
//显示解散按钮
exitBtn.setVisibility(View.GONE);
deleteBtn.setVisibility(View.VISIBLE);
}else{
//显示退出按钮
exitBtn.setVisibility(View.VISIBLE);
deleteBtn.setVisibility(View.GONE);
}
}
});
} catch (Exception e) {
runOnUiThread(new Runnable() {
public void run() {
loadingPB.setVisibility(View.INVISIBLE);
}
});
}
}
}).start();
}
开发者ID:macyuan,项目名称:TAG,代码行数:37,代码来源:GroupDetailsActivity.java
示例5: onInvitationReceived
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public void onInvitationReceived(String groupId, String groupName, String inviter, String reason) {
boolean hasGroup = false;
for(EMGroup group : EMGroupManager.getInstance().getAllGroups()){
if(group.getGroupId().equals(groupId)){
hasGroup = true;
break;
}
}
if(!hasGroup)
return;
// 被邀请
EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
msg.setChatType(ChatType.GroupChat);
msg.setFrom(inviter);
msg.setTo(groupId);
msg.setMsgId(UUID.randomUUID().toString());
msg.addBody(new TextMessageBody(inviter + "邀请你加入了群聊"));
// 保存邀请消息
EMChatManager.getInstance().saveMessage(msg);
// 提醒新消息
EMNotifier.getInstance(getApplicationContext()).notifyOnNewMsg();
runOnUiThread(new Runnable() {
public void run() {
updateUnreadLabel();
// 刷新ui
if (currentTabIndex == CHATHISTORYFRAGMENT)
chatHistoryFragment.refresh();
if (CommonUtils.getTopActivity(MainActivity_0903.this).equals(GroupsActivity.class.getName())) {
GroupsActivity.instance.onResume();
}
}
});
}
开发者ID:macyuan,项目名称:TAG,代码行数:38,代码来源:MainActivity_0903.java
示例6: onInvitationReceived
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public void onInvitationReceived(String groupId, String groupName, String inviter, String reason) {
boolean hasGroup = false;
for(EMGroup group : EMGroupManager.getInstance().getAllGroups()){
if(group.getGroupId().equals(groupId)){
hasGroup = true;
break;
}
}
if(!hasGroup)
return;
// 被邀请
EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
msg.setChatType(ChatType.GroupChat);
msg.setFrom(inviter);
msg.setTo(groupId);
msg.setMsgId(UUID.randomUUID().toString());
msg.addBody(new TextMessageBody(inviter + "邀请你加入了群聊"));
// 保存邀请消息
EMChatManager.getInstance().saveMessage(msg);
// 提醒新消息
EMNotifier.getInstance(getApplicationContext()).notifyOnNewMsg();
runOnUiThread(new Runnable() {
public void run() {
updateUnreadLabel();
// 刷新ui
if (currentTabIndex == CHATHISTORYFRAGMENT)
chatHistoryFragment.refresh();
if (CommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) {
GroupsActivity.instance.onResume();
}
}
});
}
开发者ID:macyuan,项目名称:TAG,代码行数:38,代码来源:MainActivity.java
示例7: toGroupDetails
import com.easemob.chat.EMGroup; //导入依赖的package包/类
/**
* 点击进入群组详情
*
*/
protected void toGroupDetails() {
if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMGroupManager.getInstance().getGroup(toChatUsername);
if (group == null) {
Toast.makeText(getActivity(), R.string.gorup_not_found, Toast.LENGTH_SHORT).show();
return;
}
if(chatFragmentListener != null){
chatFragmentListener.onEnterToChatDetails();
}
}
}
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:17,代码来源:EaseChatFragment.java
示例8: onInvitationReceived
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public void onInvitationReceived(String groupId, String groupName, String inviter, String reason) {
boolean hasGroup = false;
for (EMGroup group : EMGroupManager.getInstance().getAllGroups()) {
if (group.getGroupId().equals(groupId)) {
hasGroup = true;
break;
}
}
if (!hasGroup)
return;
// 被邀请
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 TextMessageBody(inviter + " " +st3));
// 保存邀请消息
EMChatManager.getInstance().saveMessage(msg);
// 提醒新消息
getNotifier().viberateAndPlayTone(msg);
//发送local广播
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:29,代码来源:DemoHelper.java
示例9: onEnterToChatDetails
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public void onEnterToChatDetails() {
if (chatType == Constant.CHATTYPE_GROUP) {
EMGroup group = EMGroupManager.getInstance().getGroup(toChatUsername);
if (group == null) {
Toast.makeText(getActivity(), R.string.gorup_not_found, 0).show();
return;
}
startActivityForResult(
(new Intent(getActivity(), GroupDetailsActivity.class).putExtra("groupId", toChatUsername)),
REQUEST_CODE_GROUP_DETAIL);
}else if(chatType == Constant.CHATTYPE_CHATROOM){
startActivityForResult(new Intent(getActivity(), ChatRoomDetailsActivity.class).putExtra("roomId", toChatUsername), REQUEST_CODE_GROUP_DETAIL);
}
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:16,代码来源:ChatFragment.java
示例10: onInvitationReceived
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public void onInvitationReceived(String groupId, String groupName, String inviter, String reason) {
boolean hasGroup = false;
for (EMGroup group : EMGroupManager.getInstance().getAllGroups()) {
if (group.getGroupId().equals(groupId)) {
hasGroup = true;
break;
}
}
if (!hasGroup)
return;
// 被邀请
String st3 = getResources().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 TextMessageBody(inviter + " " +st3));
// 保存邀请消息
EMChatManager.getInstance().saveMessage(msg);
// 提醒新消息
HXSDKHelper.getInstance().getNotifier().viberateAndPlayTone(msg);
runOnUiThread(new Runnable() {
public void run() {
updateUnreadLabel();
// 刷新ui
if (currentTabIndex == 0)
chatHistoryFragment.refresh();
// if (CommonUtils.getTopActivity(EMChatMainActivity.this).equals(GroupsActivity.class.getName())) {
// GroupsActivity.instance.onResume();
// }
}
});
}
开发者ID:chenjunqian,项目名称:here,代码行数:40,代码来源:EMChatMainActivity.java
示例11: onInvitationReceived
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public void onInvitationReceived(String groupId, String groupName, String inviter, String reason) {
boolean hasGroup = false;
for (EMGroup group : EMGroupManager.getInstance().getAllGroups()) {
if (group.getGroupId().equals(groupId)) {
hasGroup = true;
break;
}
}
if (!hasGroup)
return;
// 被邀请
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 TextMessageBody(inviter + " " + st3));
// 保存邀请消息
EMChatManager.getInstance().saveMessage(msg);
// 提醒新消息
getNotifier().viberateAndPlayTone(msg);
//发送local广播
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:29,代码来源:DemoHelper.java
示例12: onEnterToChatDetails
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public void onEnterToChatDetails() {
if (chatType == Constant.CHATTYPE_GROUP) {
EMGroup group = EMGroupManager.getInstance().getGroup(toChatUsername);
if (group == null) {
Toast.makeText(getActivity(), R.string.gorup_not_found, 0).show();
return;
}
startActivityForResult(
(new Intent(getActivity(), GroupDetailsActivity.class).putExtra("groupId", toChatUsername)),
REQUEST_CODE_GROUP_DETAIL);
} else if (chatType == Constant.CHATTYPE_CHATROOM) {
startActivityForResult(new Intent(getActivity(), ChatRoomDetailsActivity.class).putExtra("roomId", toChatUsername), REQUEST_CODE_GROUP_DETAIL);
}
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:16,代码来源:ChatFragment.java
示例13: getView
import com.easemob.chat.EMGroup; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.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_item_layout=(RelativeLayout) convertView.findViewById(R.id.list_item_layout);
convertView.setTag(holder);
}
if(position%2==0)
{
holder.list_item_layout.setBackgroundResource(R.drawable.mm_listitem);
}else{
holder.list_item_layout.setBackgroundResource(R.drawable.mm_listitem_grey);
}
EMContact user = getItem(position);
if(user instanceof EMGroup){
//群聊消息,显示群聊头像
holder.avatar.setImageResource(R.drawable.group_icon);
}else{
holder.avatar.setImageResource(R.drawable.default_avatar);
}
String username = user.getUsername();
// 获取与此用户/群组的会话
EMConversation conversation = EMChatManager.getInstance().getConversation(username);
holder.name.setText(user.getNick() != null ? user.getNick() : username);
if (conversation.getUnreadMsgCount() > 0) {
// 显示与此用户的消息未读数
holder.unreadLabel.setText(String.valueOf(conversation.getUnreadMsgCount()));
holder.unreadLabel.setVisibility(View.VISIBLE);
} else {
holder.unreadLabel.setVisibility(View.INVISIBLE);
}
if (conversation.getMsgCount() != 0) {
// 把最后一条消息的内容作为item的message内容
EMMessage lastMessage = conversation.getLastMessage();
holder.message.setText(SmileUtils.getSmiledText(getContext(), 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);
}
}
return convertView;
}
开发者ID:macyuan,项目名称:TAG,代码行数:62,代码来源:ChatHistoryAdapter.java
示例14: GroupAdapter
import com.easemob.chat.EMGroup; //导入依赖的package包/类
public GroupAdapter(Context context, int res, List<EMGroup> groups) {
super(context, res, groups);
this.inflater = LayoutInflater.from(context);
}
开发者ID:macyuan,项目名称:TAG,代码行数:5,代码来源:GroupAdapter.java
示例15: getView
import com.easemob.chat.EMGroup; //导入依赖的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 = EMGroupManager.getInstance().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 = EMChatManager.getInstance().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.getMsgCount() != 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:huijimuhe,项目名称:monolog-android,代码行数:74,代码来源:EaseConversationAdapater.java
示例16: GroupsListEventType
import com.easemob.chat.EMGroup; //导入依赖的package包/类
public GroupsListEventType(List<EMGroup> groups) {
this.groups = groups;
}
开发者ID:tengbinlive,项目名称:info_demo,代码行数:4,代码来源:GroupsListEventType.java
示例17: getGroups
import com.easemob.chat.EMGroup; //导入依赖的package包/类
public List<EMGroup> getGroups() {
return groups;
}
开发者ID:tengbinlive,项目名称:info_demo,代码行数:4,代码来源:GroupsListEventType.java
示例18: setGroups
import com.easemob.chat.EMGroup; //导入依赖的package包/类
public void setGroups(List<EMGroup> groups) {
this.groups = groups;
}
开发者ID:tengbinlive,项目名称:info_demo,代码行数:4,代码来源:GroupsListEventType.java
示例19: GroupAdapter
import com.easemob.chat.EMGroup; //导入依赖的package包/类
public GroupAdapter(Context context, int res, List<EMGroup> groups) {
super(context, res, groups);
this.inflater = LayoutInflater.from(context);
newGroup = context.getResources().getString(R.string.The_new_group_chat);
addPublicGroup = context.getResources().getString(R.string.add_public_group_chat);
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:7,代码来源:GroupAdapter.java
示例20: updateGroup
import com.easemob.chat.EMGroup; //导入依赖的package包/类
protected void updateGroup() {
new Thread(new Runnable() {
public void run() {
try {
final EMGroup returnGroup = EMGroupManager.getInstance().getGroupFromServer(groupId);
// 更新本地数据
EMGroupManager.getInstance().createOrUpdateLocalGroup(returnGroup);
runOnUiThread(new Runnable() {
public void run() {
((TextView) findViewById(R.id.group_name)).setText(group.getGroupName() + "(" + group.getAffiliationsCount()
+ ")");
loadingPB.setVisibility(View.INVISIBLE);
refreshMembers();
if (EMChatManager.getInstance().getCurrentUser().equals(group.getOwner())) {
// 显示解散按钮
exitBtn.setVisibility(View.GONE);
deleteBtn.setVisibility(View.VISIBLE);
} else {
// 显示退出按钮
exitBtn.setVisibility(View.VISIBLE);
deleteBtn.setVisibility(View.GONE);
}
// update block
EMLog.d(TAG, "group msg is blocked:" + group.getMsgBlocked());
if (group.isMsgBlocked()) {
switchButton.openSwitch();
} else {
switchButton.closeSwitch();
}
}
});
} catch (Exception e) {
runOnUiThread(new Runnable() {
public void run() {
loadingPB.setVisibility(View.INVISIBLE);
}
});
}
}
}).start();
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:45,代码来源:GroupDetailsActivity.java
注:本文中的com.easemob.chat.EMGroup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论