本文整理汇总了Java中com.easemob.chat.EMGroupManager类的典型用法代码示例。如果您正苦于以下问题:Java EMGroupManager类的具体用法?Java EMGroupManager怎么用?Java EMGroupManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMGroupManager类属于com.easemob.chat包,在下文中一共展示了EMGroupManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: exitGrop
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
/**
* 退出群组
*
* @param groupId
*/
private void exitGrop() {
new Thread(new Runnable() {
public void run() {
try {
EMGroupManager.getInstance().exitFromGroup(groupId);
runOnUiThread(new Runnable() {
public void run() {
progressDialog.dismiss();
setResult(RESULT_OK);
finish();
ChatActivity.activityInstance.finish();
}
});
} catch (final Exception e) {
runOnUiThread(new Runnable() {
public void run() {
progressDialog.dismiss();
Toast.makeText(getApplicationContext(), "退出群聊失败: " + e.getMessage(), 1).show();
}
});
}
}
}).start();
}
开发者ID:macyuan,项目名称:TAG,代码行数:30,代码来源:GroupDetailsActivity.java
示例2: deleteGrop
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
/**
* 解散群组
*
* @param groupId
*/
private void deleteGrop() {
new Thread(new Runnable() {
public void run() {
try {
EMGroupManager.getInstance().exitAndDeleteGroup(groupId);
runOnUiThread(new Runnable() {
public void run() {
progressDialog.dismiss();
setResult(RESULT_OK);
finish();
ChatActivity.activityInstance.finish();
}
});
} catch (final Exception e) {
runOnUiThread(new Runnable() {
public void run() {
progressDialog.dismiss();
Toast.makeText(getApplicationContext(), "解散群聊失败: " + e.getMessage(), 1).show();
}
});
}
}
}).start();
}
开发者ID:macyuan,项目名称:TAG,代码行数:30,代码来源:GroupDetailsActivity.java
示例3: loadLoginData
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
/**
* 处理登陆数据
*
* @param resposne
*/
private void loadLoginData(CommonResponse resposne) {
// if (resposne.isSuccess()) {
SharedPreferencesHelper.setString(this, Constant.LoginUser.SHARED_PREFERENCES_PHONE, phone);
SharedPreferencesHelper.setString(this, Constant.LoginUser.SHARED_PREFERENCES_PASSWORD, password);
UserInfo userInfo = UserInfo.testData();
String userJson = JSON.toJSONString(userInfo);
SharedPreferencesHelper.setString(this, Constant.LoginUser.SHARED_PREFERENCES_USER, userJson);
App.getInstance().setgUserInfo(userInfo);
if (!EMChat.getInstance().isLoggedIn()) {
EASEMOBLogin();
} else {
dialogDismiss();
EMGroupManager.getInstance().loadAllGroups();
EMChatManager.getInstance().loadAllConversations();
toMainActivity();
}
// } else {
// dialogDismiss();
// CommonUtil.showToast(resposne.getErrorTip());
// }
}
开发者ID:tengbinlive,项目名称:info_demo,代码行数:27,代码来源:LoginActivity.java
示例4: removeOutBlacklist
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
/**
* 移出黑民单
*
* @param tobeRemoveUser
*/
void removeOutBlacklist(final String tobeRemoveUser) {
final String st2 = getResources().getString(R.string.Removed_from_the_failure);
try {
// 移出黑民单
EMGroupManager.getInstance().unblockUser(groupId, tobeRemoveUser);
adapter.remove(tobeRemoveUser);
} catch (EaseMobException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(), st2, 0).show();
}
});
}
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:21,代码来源:GroupBlacklistActivity.java
示例5: toGroupDetails
import com.easemob.chat.EMGroupManager; //导入依赖的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
示例6: init
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
private void init() {
// setContactListener监听联系人的变化等
EMContactManager.getInstance().setContactListener(new MyContactListener());
// 注册一个监听连接状态的listener
connectionListener = new MyConnectionListener();
EMChatManager.getInstance().addConnectionListener(connectionListener);
groupChangeListener = new MyGroupChangeListener();
// 注册群聊相关的listener
EMGroupManager.getInstance().addGroupChangeListener(groupChangeListener);
//将主页侧边栏的新消息提示View设为GONE
if (MainActivity.getInstance()!=null){
MenuLeftFragment menuLeftFragment = (MenuLeftFragment) ((MainActivity)MainActivity.
getInstance()).getFragment(IntentUtil.MENU_LEFT_FRAGMENT);
menuLeftFragment.setNewMessageRemindView(View.GONE);
}
//内部测试方法,请忽略
// registerInternalDebugReceiver();
}
开发者ID:chenjunqian,项目名称:here,代码行数:23,代码来源:EMChatMainActivity.java
示例7: onDestroy
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
@Override
protected void onDestroy() {
super.onDestroy();
if (conflictBuilder != null) {
conflictBuilder.create().dismiss();
conflictBuilder = null;
}
if(connectionListener != null){
EMChatManager.getInstance().removeConnectionListener(connectionListener);
}
if(groupChangeListener != null){
EMGroupManager.getInstance().removeGroupChangeListener(groupChangeListener);
}
try {
unregisterReceiver(internalDebugReceiver);
} catch (Exception e) {
}
}
开发者ID:chenjunqian,项目名称:here,代码行数:23,代码来源:EMChatMainActivity.java
示例8: init
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
private void init() {
// setContactListener监听联系人的变化等
EMContactManager.getInstance().setContactListener(new MyContactListener());
// 注册一个监听连接状态的listener
connectionListener = new MyConnectionListener();
EMChatManager.getInstance().addConnectionListener(connectionListener);
groupChangeListener = new MyGroupChangeListener();
// 注册群聊相关的listener
EMGroupManager.getInstance().addGroupChangeListener(groupChangeListener);
//将主页侧边栏的新消息提示View设为GONE
if (MainActivity.getInstance()!=null){
// MenuLeftFragment menuLeftFragment = (MenuLeftFragment) ((MainActivity) MainActivity.
// getInstance()).getFragment(IntentUtil.MENU_LEFT_FRAGMENT);
// menuLeftFragment.setNewMessageRemindView(View.GONE);
}
//内部测试方法,请忽略
// registerInternalDebugReceiver();
}
开发者ID:chenjunqian,项目名称:here,代码行数:23,代码来源:EMChatMainActivity.java
示例9: removeOutBlacklist
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
/**
* 移出黑民单
*
* @param tobeRemoveUser
*/
void removeOutBlacklist(final String tobeRemoveUser) {
final String st2 = getResources().getString(R.string.Removed_from_the_failure);
try {
// 移出黑民单
EMGroupManager.getInstance().unblockUser(groupId, tobeRemoveUser);
adapter.remove(tobeRemoveUser);
} catch (EaseMobException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(), st2, 0).show();
}
});
}
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:21,代码来源:GroupBlacklistActivity.java
示例10: toGroupDetails
import com.easemob.chat.EMGroupManager; //导入依赖的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
示例11: addMembersToGroup
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
/**
* 增加群成员
*
* @param newmembers
*/
private void addMembersToGroup(final String[] newmembers) {
new Thread(new Runnable() {
public void run() {
try {
//创建者调用add方法
if(EMChatManager.getInstance().getCurrentUser().equals(group.getOwner())){
EMGroupManager.getInstance().addUsersToGroup(groupId, newmembers);
}else{
//一般成员调用invite方法
EMGroupManager.getInstance().inviteUser(groupId, newmembers, null);
}
runOnUiThread(new Runnable() {
public void run() {
adapter.notifyDataSetChanged();
((TextView) findViewById(R.id.group_name)).setText(group.getGroupName()+"("+group.getAffiliationsCount()+"人)");
progressDialog.dismiss();
}
});
} catch (final Exception e) {
runOnUiThread(new Runnable() {
public void run() {
progressDialog.dismiss();
Toast.makeText(getApplicationContext(), "添加群成员失败: " + e.getMessage(), 1).show();
}
});
}
}
}).start();
}
开发者ID:macyuan,项目名称:TAG,代码行数:36,代码来源:GroupDetailsActivity.java
示例12: updateGroup
import com.easemob.chat.EMGroupManager; //导入依赖的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
示例13: onInvitationReceived
import com.easemob.chat.EMGroupManager; //导入依赖的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
示例14: onInvitationReceived
import com.easemob.chat.EMGroupManager; //导入依赖的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
示例15: onResume
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
grouplist = EMGroupManager.getInstance().getAllGroups();
groupAdapter = new GroupAdapter(this, 1, grouplist);
groupListView.setAdapter(groupAdapter);
groupAdapter.notifyDataSetChanged();
}
开发者ID:macyuan,项目名称:TAG,代码行数:9,代码来源:GroupsActivity.java
示例16: addToGroup
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
public void addToGroup(View view){
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage("正在发送请求...");
pd.setCanceledOnTouchOutside(false);
pd.show();
new Thread(new Runnable() {
public void run() {
try {
//如果是membersOnly的群,需要申请加入,不能直接join
if(group.isMembersOnly()){
EMGroupManager.getInstance().applyJoinToGroup(groupid, "求加入");
}else{
EMGroupManager.getInstance().joinGroup(groupid);
}
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(GroupSimpleDetailActivity.this, "加入群聊成功", 0).show();
btn_add_group.setEnabled(false);
}
});
} catch (final EaseMobException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(GroupSimpleDetailActivity.this, "加入群聊失败:"+e.getMessage(), 0).show();
}
});
}
}
}).start();
}
开发者ID:macyuan,项目名称:TAG,代码行数:34,代码来源:GroupSimpleDetailActivity.java
示例17: onDestroy
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
if (groupListener != null) {
EMGroupManager.getInstance().removeGroupChangeListener(groupListener);
}
if(chatType == EaseConstant.CHATTYPE_CHATROOM){
EMChatManager.getInstance().leaveChatRoom(toChatUsername);
}
}
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:11,代码来源:EaseChatFragment.java
示例18: toGroupDetails
import com.easemob.chat.EMGroupManager; //导入依赖的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
示例19: EASEMOBLogin
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
/**
* 登陆环信
*/
private void EASEMOBLogin() {
EMChatManager.getInstance().login(phone, password, new EMCallBack() {//回调
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
dialogDismiss();
EMGroupManager.getInstance().loadAllGroups();
EMChatManager.getInstance().loadAllConversations();
toMainActivity();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
runOnUiThread(new Runnable() {
public void run() {
dialogDismiss();
EMGroupManager.getInstance().loadAllGroups();
EMChatManager.getInstance().loadAllConversations();
toMainActivity();
}
});
}
});
}
开发者ID:tengbinlive,项目名称:info_demo,代码行数:36,代码来源:LoginActivity.java
示例20: registerGroupAndContactListener
import com.easemob.chat.EMGroupManager; //导入依赖的package包/类
/**
* 注册群组和联系人监听,由于logout的时候会被sdk清除掉,再次登录的时候需要再注册一下
*/
public void registerGroupAndContactListener(){
if(!isGroupAndContactListenerRegisted){
//注册群组变动监听
EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener());
//注册联系人变动监听
EMContactManager.getInstance().setContactListener(new MyContactListener());
isGroupAndContactListenerRegisted = true;
}
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:14,代码来源:DemoHelper.java
注:本文中的com.easemob.chat.EMGroupManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论