本文整理汇总了Java中com.hyphenate.chat.EMGroup类的典型用法代码示例。如果您正苦于以下问题:Java EMGroup类的具体用法?Java EMGroup怎么用?Java EMGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMGroup类属于com.hyphenate.chat包,在下文中一共展示了EMGroup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendAtMessage
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
/**
* 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);
}
开发者ID:turoDog,项目名称:KTalk,代码行数:22,代码来源:EaseChatFragment.java
示例2: toGroupDetails
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
/**
* 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();
}
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:21,代码来源:EaseChatFragment.java
示例3: getView
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// 创建或获取viewholder
ViewHolder holder = null;
if(convertView == null) {
holder = new ViewHolder();
convertView = View.inflate(mContext, R.layout.item_grouplist, null);
holder.name = (TextView) convertView.findViewById(R.id.tv_grouplist_name);
convertView.setTag(holder);
}else {
holder = (ViewHolder) convertView.getTag();
}
// 获取当前item数据
EMGroup emGroup = mGroups.get(position);
// 显示数据
holder.name.setText(emGroup.getGroupName());
// 返回数据
return convertView;
}
开发者ID:turoDog,项目名称:KTalk,代码行数:26,代码来源:GroupListAdapter.java
示例4: sendAtMessage
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
/**
* 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);
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:22,代码来源:EaseChatFragment.java
示例5: toGroupDetails
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
/**
* 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();
}
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:20,代码来源:EaseChatFragment.java
示例6: onEnterToChatDetails
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
@Override
public void onEnterToChatDetails() {
if (chatType == Constant.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;
}
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:mangestudio,项目名称:GCSApp,代码行数:17,代码来源:ChatFragment.java
示例7: toGroupDetails
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
/**
* 点击进入群组详情
*
*/
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();
}
}
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:21,代码来源:EaseChatFragment.java
示例8: toGroupDetails
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
/**
* 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();
}
}
}
开发者ID:HyphenateInc,项目名称:Hyphenate-EaseUI-Android,代码行数:21,代码来源:EaseChatFragment.java
示例9: getData
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
private void getData() {
String groupId = getIntent().getStringExtra(Constant.GROUP_ID);
if (groupId != null) {
EMGroup group = EMClient.getInstance().groupManager().getGroup(groupId);
// 获取群众已经存在的所有群成员
mExistMembers = group.getMembers();
}
if (mExistMembers == null) {
mExistMembers = new ArrayList<>();
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:14,代码来源:PickContactActivity.java
示例10: getGroupsFromServer
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
private void getGroupsFromServer() {
Model.getInstance().getGlobalThreadPool().execute(new Runnable() {
@Override
public void run() {
try {
// 从网络获取数据
final List<EMGroup> mGroups = EMClient.getInstance().groupManager().getJoinedGroupsFromServer();
// 更新页面
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(GroupListActivity.this, "加载群信息成功", Toast.LENGTH_SHORT).show();
// groupListAdapter.refresh(mGroups);
// 刷新
refresh();
}
});
} catch (HyphenateException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(GroupListActivity.this, "加载群信息失败", Toast.LENGTH_SHORT).show();
}
});
}
}
});
}
开发者ID:turoDog,项目名称:KTalk,代码行数:32,代码来源:GroupListActivity.java
示例11: getMembersFromHxServer
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
private void getMembersFromHxServer() {
Model.getInstance().getGlobalThreadPool().execute(new Runnable() {
@Override
public void run() {
try {
// 从环信服务器获取所有的群成员信息
EMGroup emGroup = EMClient.getInstance().groupManager().getGroupFromServer(mGroup.getGroupId());
List<String> members = emGroup.getMembers();
if (members != null && members.size() >= 0) {
mUsers = new ArrayList<UserInfo>();
// 转换
for (String member : members) {
UserInfo userInfo = new UserInfo(member);
mUsers.add(userInfo);
}
}
// 更新页面
runOnUiThread(new Runnable() {
@Override
public void run() {
// 刷新适配器
groupDetailAdapter.refresh(mUsers);
}
});
} catch (final HyphenateException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(GroupDetailActivity.this, "获取群信息失败" + e.toString(), Toast.LENGTH_SHORT).show();
}
});
}
}
});
}
开发者ID:turoDog,项目名称:KTalk,代码行数:40,代码来源:GroupDetailActivity.java
示例12: sendAtMessage
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
/**
* 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)));
}
if (null != loginData) {
if (StringUtils.isNotEmpty(loginData.getEasemobAccount())) {
message.setAttribute("phone", loginData.getEasemobAccount());
}
if (null != loginData.getMember()) {
if (StringUtils.isNotEmpty(loginData.getMember().getImageUrl())) {
message.setAttribute("avatarURLPath", loginData.getMember().getImageUrl());
}
if (StringUtils.isNotEmpty(loginData.getMember().getName())){
message.setAttribute("name", loginData.getMember().getName());
}
}
}
sendMessage(message);
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:39,代码来源:EaseChatFragment.java
示例13: isCurrentOwner
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
boolean isCurrentOwner(EMGroup group) {
String owner = group.getOwner();
if (owner == null || owner.isEmpty()) {
return false;
}
return owner.equals(EMClient.getInstance().getCurrentUser());
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:8,代码来源:GroupDetailsActivity.java
示例14: isCurrentAdmin
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
boolean isCurrentAdmin(EMGroup group) {
synchronized (adminList) {
String currentUser = EMClient.getInstance().getCurrentUser();
for (String admin : adminList) {
if (currentUser.equals(admin)) {
return true;
}
}
}
return false;
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:12,代码来源:GroupDetailsActivity.java
示例15: isCanAddMember
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
boolean isCanAddMember(EMGroup group) {
if (group.isMemberAllowToInvite() ||
isAdmin(EMClient.getInstance().getCurrentUser()) ||
isCurrentOwner(group)) {
return true;
}
return false;
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:9,代码来源:GroupDetailsActivity.java
示例16: GroupAdapter
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
public GroupAdapter(Context context, int res, List<EMGroup> groups) {
super(context, res, groups);
this.inflater = LayoutInflater.from(context);
this.mContext =context;
newGroup = context.getResources().getString(R.string.The_new_group_chat);
addPublicGroup = context.getResources().getString(R.string.add_public_group_chat);
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:8,代码来源:GroupAdapter.java
示例17: onInvitationAccepted
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
@Override
public void onInvitationAccepted(String groupId, String invitee, String reason) {
new InviteMessgeDao(appContext).deleteMessage(groupId);
//user accept your invitation
boolean hasGroup = false;
EMGroup _group = null;
for (EMGroup group : EMClient.getInstance().groupManager().getAllGroups()) {
if (group.getGroupId().equals(groupId)) {
hasGroup = true;
_group = group;
break;
}
}
if (!hasGroup)
return;
InviteMessage msg = new InviteMessage();
msg.setFrom(groupId);
msg.setTime(System.currentTimeMillis());
msg.setGroupId(groupId);
msg.setGroupName(_group == null ? groupId : _group.getGroupName());
msg.setReason(reason);
msg.setGroupInviter(invitee);
Log.d(TAG, invitee + "Accept to join the group:" + _group == null ? groupId : _group.getGroupName());
msg.setStatus(InviteMesageStatus.GROUPINVITATION_ACCEPTED);
notifyNewInviteMessage(msg);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:31,代码来源:DemoHelper.java
示例18: onInvitationDeclined
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
@Override
public void onInvitationDeclined(String groupId, String invitee, String reason) {
new InviteMessgeDao(appContext).deleteMessage(groupId);
//user declined your invitation
EMGroup group = null;
for (EMGroup _group : EMClient.getInstance().groupManager().getAllGroups()) {
if (_group.getGroupId().equals(groupId)) {
group = _group;
break;
}
}
if (group == null)
return;
InviteMessage msg = new InviteMessage();
msg.setFrom(groupId);
msg.setTime(System.currentTimeMillis());
msg.setGroupId(groupId);
msg.setGroupName(group.getGroupName());
msg.setReason(reason);
msg.setGroupInviter(invitee);
Log.d(TAG, invitee + "Declined to join the group:" + group.getGroupName());
msg.setStatus(InviteMesageStatus.GROUPINVITATION_DECLINED);
notifyNewInviteMessage(msg);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:29,代码来源:DemoHelper.java
示例19: startRedPacketActivityForResult
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
/**
* 进入发红包页面
*
* @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);
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:36,代码来源:RedPacketUtil.java
示例20: onInvitationAccpted
import com.hyphenate.chat.EMGroup; //导入依赖的package包/类
@Override
public void onInvitationAccpted(String groupId, String invitee, String reason) {
new InviteMessgeDao(appContext).deleteMessage(groupId);
//user accept your invitation
boolean hasGroup = false;
EMGroup _group = null;
for (EMGroup group : EMClient.getInstance().groupManager().getAllGroups()) {
if (group.getGroupId().equals(groupId)) {
hasGroup = true;
_group = group;
break;
}
}
if (!hasGroup)
return;
InviteMessage msg = new InviteMessage();
msg.setFrom(groupId);
msg.setTime(System.currentTimeMillis());
msg.setGroupId(groupId);
msg.setGroupName(_group == null ? groupId : _group.getGroupName());
msg.setReason(reason);
msg.setGroupInviter(invitee);
Log.d(TAG, invitee + "Accept to join the group:" + _group == null ? groupId : _group.getGroupName());
msg.setStatus(InviteMesageStatus.GROUPINVITATION_ACCEPTED);
notifyNewInviteMessage(msg);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:31,代码来源:DemoHelper.java
注:本文中的com.hyphenate.chat.EMGroup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论