im::floo::floolib::BMXGroup
群组
Inherits from BMXBaseObject
Public Classes
Name | |
---|---|
class | Announcement 群公告 |
class | Application 群申请 |
Public Functions
Name | |
---|---|
BMXGroup() | |
synchronized void | delete() |
long | groupId() 群Id |
BMXGroup.GroupType | groupType() 当前群组的群组类型(Private 私有群组,Public 公开群组,Chatroom 聊天室) |
String | myNickname() 在群里的昵称 |
String | name() 群名称 |
String | description() 群描述 |
String | avatarRatelUrl() 群头像ratel地址 |
String | avatarUrl() 群头像 |
String | avatarPath() 群头像下载后的本地路径 |
String | avatarThumbnailUrl() 群头像缩略图地址 |
String | avatarThumbnailPath() 群头像缩略图下载后的本地路径 |
long | createTime() 群创建时间 |
String | extension() 群扩展信息 |
long | ownerId() 群Owner |
int | capacity() 最大人数 |
int | membersCount() 群成员数量,包含Owner,admins 和members |
int | adminsCount() 群管理员数量 |
int | blockListSize() 黑名单数量 |
int | bannedListSize() 禁言数量 |
int | sharedFilesCount() 群共享文件数量 |
long | latestAnnouncementId() 最新群公告id |
BMXGroup.MsgPushMode | msgPushMode() 群消息通知类型 |
BMXGroup.ModifyMode | modifyMode() 群信息修改模式 |
BMXGroup.JoinAuthMode | joinAuthMode() 入群审批模式 |
BMXGroup.InviteMode | inviteMode() 入群邀请模式 |
BMXGroup.MsgMuteMode | msgMuteMode() 群消息屏蔽模式 |
BMXGroup.GroupStatus | groupStatus() 当前群组的状态。(Normal 正常, Destroyed 以销毁) |
boolean | isMember() Deprecated use roleType instead. |
boolean | enableReadAck() 是否开启群消息已读功能 |
boolean | historyVisible() 是否可以加载显示历史聊天记录 |
BMXGroup.MemberRoleType | roleType() 成员在群组内的角色类型 |
long | banExpireTime() 群组全员禁言到期时间 |
Protected Functions
Name | |
---|---|
BMXGroup(long cPtr, boolean cMemoryOwn) | |
void | finalize() |
long | getCPtr(BMXGroup obj) |
Public Attributes
Name | |
---|---|
transient long | swigCPtr |
Public Functions Documentation
function BMXGroup
inline BMXGroup()
Example:
function delete
inline synchronized void delete()
Example:
function groupId
inline long groupId()
群Id
Return: int64_t
Example:
public void putGroup(BMXGroup item) {
if (item != null)
mGroupCache.put(item.groupId(), item);
TargetBean bean = new TargetBean(group.groupId(), BMXConversation.Type.Group);
if (!targetIds.contains(String.valueOf(group.groupId()))){
targetIds.add(String.valueOf(group.groupId()));
private void initData(String cursor) {
if (mGroup == null || mGroup.groupId() <= 0) {
return;
}
showLoadingDialog(true);
final BMXGroupList groupList = new BMXGroupList();
groupList.add(mGroup);
GroupManager.getInstance().getApplicationList(groupList, cursor, DEFAULT_PAGE_SIZE,
(bmxErrorCode, page) -> {
dismissLoadingDialog();
if (BaseManager.bmxFinish(bmxErrorCode)) {
if (page != null && page.result() != null && !page.result().isEmpty()) {
ListOfLongLong listOfLongLong = new ListOfLongLong();
BMXGroupApplicationList applicationList = page.result();
for (int i = 0; i < applicationList.size(); i++) {
listOfLongLong.add(applicationList.get(i).getMApplicationId());
}
RosterManager.getInstance().getRosterList(listOfLongLong, true,
(bmxErrorCode1, itemList) -> {
private void downloadGroupAvatar(final BMXGroup item, final ShapeImageView imageView,
final ImageRequestConfig config) {
if (item == null || imageView == null) {
return;
}
final int hashCode = imageView.hashCode();
mViewCache.put(hashCode, item.groupId());
GroupManager.getInstance().downloadAvatar(item, new FileProgressListener() {
@Override
public int onProgressChange(String percent) {
if (Integer.valueOf(percent) >= 100) {
String avatarUrl = "";
if (!TextUtils.isEmpty(item.avatarThumbnailPath())
&& new File(item.avatarThumbnailPath()).exists()
&& new File(item.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + item.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(item.avatarPath())
&& new File(item.avatarPath()).exists()
&& new File(item.avatarPath()).isFile()) {
avatarUrl = "file://" + item.avatarPath();
private void bindGroupInfo() {
mIsOwner = GroupManager.getInstance().isGroupOwner(mGroup.ownerId());
mIsAdmin = GroupManager.getInstance().isAdmin(mGroup, SharePreferenceUtils.getInstance().getUserId()) || mIsOwner;
//创建者才能解散 退出群聊文案
mQuitGroup.setText(getString(mIsOwner ? R.string.group_destroy : R.string.group_quit));
long groupId = mGroup.groupId();
mChatGroupId.setEndContent(groupId > 0 ? String.valueOf(groupId) : "");
long ownerId = mGroup.ownerId();
mChatGroupOwnerId.setEndContent(ownerId > 0 ? String.valueOf(ownerId) : "");
mChatGroupOwnerId.setOnItemClickListener(v -> {
if (ownerId > 0) {
RosterDetailActivity.openRosterDetail(ChatGroupOperateActivity.this, ownerId);
}
});
String name = mGroup.name();
mChatGroupRename.setEndContent(!TextUtils.isEmpty(name) ? name : "");
function groupType
inline BMXGroup.GroupType groupType()
当前群组的群组类型(Private 私有群组,Public 公开群组,Chatroom 聊天室)
Return: [GroupType]
Example:
// 群共享列表
int shares = mGroup.sharedFilesCount();
mChatGroupShare.setEndContent(shares <= 0 ? "" : String.valueOf(shares));
// 群已读
boolean readAck = mGroup.enableReadAck();
mChatGroupReadMode.setCheckStatus(readAck);
//群类型
String groupType = "";
switch (mGroup.groupType()){
case Public:
groupType = getString(R.string.group_type_public);
break;
case Private:
groupType = getString(R.string.group_type_private);
break;
case Chatroom:
groupType = getString(R.string.group_type_chat_room);
break;
function myNickname
inline String myNickname()
在群里的昵称
Return: std::string
Example:
mChatGroupOwnerId.setEndContent(ownerId > 0 ? String.valueOf(ownerId) : "");
mChatGroupOwnerId.setOnItemClickListener(v -> {
if (ownerId > 0) {
RosterDetailActivity.openRosterDetail(ChatGroupOperateActivity.this, ownerId);
}
});
String name = mGroup.name();
mChatGroupRename.setEndContent(!TextUtils.isEmpty(name) ? name : "");
String myNick = mGroup.myNickname();
mGroupMyNickName.setEndContent(!TextUtils.isEmpty(myNick) ? myNick : "");
// 群描述
String desc = mGroup.description();
if (!TextUtils.isEmpty(desc)) {
mViewGroupDesc.setVisibility(View.VISIBLE);
mViewGroupDesc.setText(desc);
} else {
mViewGroupDesc.setVisibility(View.GONE);
function name
inline String name()
群名称
Return: std::string
Example:
@Override
protected void onBindHolder(BaseViewHolder holder, int position) {
ShapeImageView avatar = holder.findViewById(R.id.contact_avatar);
TextView title = holder.findViewById(R.id.contact_title);
BMXGroup bean = getItem(position);
String name = bean == null ? "" : bean.name();
title.setText(name);
ChatUtils.getInstance().showGroupAvatar(bean, avatar, mConfig);
TextView title = holder.findViewById(R.id.apply_title);
TextView status = holder.findViewById(R.id.apply_status);
TextView accept = holder.findViewById(R.id.tv_accept);
final BMXGroup.Invitation item = getItem(position);
if (item == null) {
return;
}
final BMXGroup groupItem = RosterFetcher.getFetcher().getGroup(item.getMGroupId());
ChatUtils.getInstance().showGroupAvatar(groupItem, avatar, mConfig);
title.setText(
groupItem != null && !TextUtils.isEmpty(groupItem.name()) ? groupItem.name()
: "");
BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.getMInviterId());
String name = "";
if (rosterItem != null) {
if (!TextUtils.isEmpty(rosterItem.alias())) {
name = rosterItem.alias();
} else if (!TextUtils.isEmpty(rosterItem.nickname())) {
name = rosterItem.nickname();
@Override
protected void onBindHolder(BaseViewHolder holder, int position) {
ShapeImageView avatar = holder.findViewById(R.id.contact_avatar);
TextView title = holder.findViewById(R.id.contact_title);
BMXGroup bean = getItem(position);
String name = bean == null ? "" : bean.name();
title.setText(name);
ChatUtils.getInstance().showGroupAvatar(bean, avatar, mConfig);
private void bindGroup(BMXGroup group) {
if (group.isMember()) {
// 群成员直接跳转
ChatGroupActivity.startChatActivity(this, BMXMessage.MessageType.Group, mGroupId);
finish();
return;
}
String name = group.name();
ChatUtils.getInstance().showGroupAvatar(group, mUserIcon, mConfig);
mUserName.setText(TextUtils.isEmpty(name) ? "" : name);
@Override
protected void onBindHolder(BaseViewHolder holder, int position) {
ShapeImageView avatar = holder.findViewById(R.id.contact_avatar);
TextView title = holder.findViewById(R.id.contact_title);
TextView add = holder.findViewById(R.id.add_contact);
add.setText(getString(R.string.join));
final BMXGroup item = getItem(position);
if (item == null) {
return;
}
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showJoinReason(item);
}
});
title.setText(TextUtils.isEmpty(item.name()) ? "" : item.name());
ChatUtils.getInstance().showGroupAvatar(item, avatar, mConfig);
checkBox.setChecked(isCheck);
checkBox.setVisibility(item.getId() != MessageConfig.MEMBER_ADD
&& item.getId() != MessageConfig.MEMBER_REMOVE ? View.VISIBLE
: View.INVISIBLE);
// 是否开启免打扰
String name = "";
if (item.getType() == BMXConversation.Type.Group){
BMXGroup groupItem = RosterFetcher.getFetcher().getGroup(item.getId());
if (groupItem!=null){
name = groupItem.name();
ChatUtils.getInstance().showGroupAvatar(groupItem, icon, mGroupConfig);
}
} else{
BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.getId());
if (rosterItem != null){
if (!TextUtils.isEmpty(rosterItem.alias())) {
name = rosterItem.alias();
} else if (!TextUtils.isEmpty(rosterItem.nickname())) {
name = rosterItem.nickname();
function description
inline String description()
群描述
Return: std::string
Example:
}
});
String name = mGroup.name();
mChatGroupRename.setEndContent(!TextUtils.isEmpty(name) ? name : "");
String myNick = mGroup.myNickname();
mGroupMyNickName.setEndContent(!TextUtils.isEmpty(myNick) ? myNick : "");
// 群描述
String desc = mGroup.description();
if (!TextUtils.isEmpty(desc)) {
mViewGroupDesc.setVisibility(View.VISIBLE);
mViewGroupDesc.setText(desc);
} else {
mViewGroupDesc.setVisibility(View.GONE);
}
// 群公告 TODO
// String notice = mGroup.announcement();
function avatarRatelUrl
inline String avatarRatelUrl()
群头像ratel地址
Return: std::string
Example:
function avatarUrl
inline String avatarUrl()
群头像
Return: std::string
Example:
if (groupItem == null) {
mViewCache.remove(imageView.hashCode());
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
mViewCache.remove(imageView.hashCode());
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
function avatarPath
inline String avatarPath()
群头像下载后的本地路径
Return: std::string
Example:
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
downloadGroupAvatar(groupItem, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
downloadGroupAvatar(groupItem, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
downloadGroupAvatar(groupItem, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
downloadGroupAvatar(groupItem, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
function avatarThumbnailUrl
inline String avatarThumbnailUrl()
群头像缩略图地址
Return: std::string
Example:
return;
}
if (groupItem == null) {
mViewCache.remove(imageView.hashCode());
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
}
if (groupItem == null) {
mViewCache.remove(imageView.hashCode());
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
function avatarThumbnailPath
inline String avatarThumbnailPath()
群头像缩略图下载后的本地路径
Return: std::string
Example:
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
downloadGroupAvatar(groupItem, imageView, config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
downloadGroupAvatar(groupItem, imageView, config);
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
downloadGroupAvatar(groupItem, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
// 新增直接展示头像地址 不需下载
if (!TextUtils.isEmpty(groupItem.avatarThumbnailUrl())) {
avatarUrl = groupItem.avatarThumbnailUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarUrl())) {
avatarUrl = groupItem.avatarUrl();
} else if (!TextUtils.isEmpty(groupItem.avatarThumbnailPath())
&& new File(groupItem.avatarThumbnailPath()).exists()
&& new File(groupItem.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(groupItem.avatarPath())
&& new File(groupItem.avatarPath()).exists()
&& new File(groupItem.avatarPath()).isFile()) {
avatarUrl = "file://" + groupItem.avatarPath();
} else {
downloadGroupAvatar(groupItem, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
function createTime
inline long createTime()
群创建时间
Return: int64_t
Example:
function extension
inline String extension()
群扩展信息
Return: JSON(std::string)
Example:
// 群公告 TODO
// String notice = mGroup.announcement();
// if (!TextUtils.isEmpty(notice)) {
// mViewGroupNotice.setVisibility(View.VISIBLE);
// mViewGroupNotice.setText(notice);
// } else {
// mViewGroupNotice.setVisibility(View.GONE);
// }
// 群扩展信息
String ext = mGroup.extension();
if (!TextUtils.isEmpty(ext)) {
mViewGroupExt.setVisibility(View.VISIBLE);
mViewGroupExt.setText(ext);
} else {
mViewGroupExt.setVisibility(View.GONE);
}
// 群人数
int members = mGroup.membersCount();
function ownerId
inline long ownerId()
群Owner
Return: int64_t
Example:
private void showHead() {
if (mItemPos == ITEM_CENTER || mMaxMessage == null) {
return;
}
String userName = null;
boolean group = mMaxMessage.type() == BMXMessage.MessageType.Group;
boolean hideMemberInfo = true;
if (group){
BMXGroup bmxGroup = RosterFetcher.getFetcher().getGroup(mMaxMessage.conversationId());
if (bmxGroup != null) {
boolean isOwner = GroupManager.getInstance().isGroupOwner(bmxGroup.ownerId());
boolean isAdmin = GroupManager.getInstance().isAdmin(bmxGroup, SharePreferenceUtils.getInstance().getUserId()) || isOwner;
boolean hideByGroupSettings = bmxGroup.hideMemberInfo();
if (!hideByGroupSettings || isAdmin){
hideMemberInfo = false;
}
}
}
if (mMaxMessage.isReceiveMsg()) {
private void updateInputBar(BMXGroup group){
long currentTime = System.currentTimeMillis();
GroupManager.getInstance().getBannedMembers(group, (error, memberList) -> {
if (BaseManager.bmxFinish(error)) {
for (int i = 0; i < memberList.size(); i++) {
if (mMyUserId == memberList.get(i).getMUid()){
long banExpireTime = memberList.get(i).getMExpired() * 1000;
mView.enableInputBar((banExpireTime <= currentTime && banExpireTime != -1000), false);
return;
}
}
}
});
boolean isOwner = GroupManager.getInstance().isGroupOwner(group.ownerId());
boolean isAdmin = GroupManager.getInstance().isAdmin(group, SharePreferenceUtils.getInstance().getUserId()) || isOwner;
long banExpireTime = group.banExpireTime() * 1000;
//临时禁言过期也没有永久禁言
mView.enableInputBar((banExpireTime <= currentTime && banExpireTime != -1000)||isAdmin, true);
mIsOwner = GroupManager.getInstance().isGroupOwner(mGroup.ownerId());
private void bindGroupInfo() {
mIsOwner = GroupManager.getInstance().isGroupOwner(mGroup.ownerId());
mIsAdmin = GroupManager.getInstance().isAdmin(mGroup, SharePreferenceUtils.getInstance().getUserId()) || mIsOwner;
//创建者才能解散 退出群聊文案
mQuitGroup.setText(getString(mIsOwner ? R.string.group_destroy : R.string.group_quit));
long groupId = mGroup.groupId();
mChatGroupId.setEndContent(groupId > 0 ? String.valueOf(groupId) : "");
long ownerId = mGroup.ownerId();
mChatGroupOwnerId.setEndContent(ownerId > 0 ? String.valueOf(ownerId) : "");
mChatGroupOwnerId.setOnItemClickListener(v -> {
if (ownerId > 0) {
RosterDetailActivity.openRosterDetail(ChatGroupOperateActivity.this, ownerId);
}
});
String name = mGroup.name();
mChatGroupRename.setEndContent(!TextUtils.isEmpty(name) ? name : "");
private void bindGroupInfo() {
mIsOwner = GroupManager.getInstance().isGroupOwner(mGroup.ownerId());
mIsAdmin = GroupManager.getInstance().isAdmin(mGroup, SharePreferenceUtils.getInstance().getUserId()) || mIsOwner;
//创建者才能解散 退出群聊文案
mQuitGroup.setText(getString(mIsOwner ? R.string.group_destroy : R.string.group_quit));
long groupId = mGroup.groupId();
mChatGroupId.setEndContent(groupId > 0 ? String.valueOf(groupId) : "");
long ownerId = mGroup.ownerId();
mChatGroupOwnerId.setEndContent(ownerId > 0 ? String.valueOf(ownerId) : "");
mChatGroupOwnerId.setOnItemClickListener(v -> {
if (ownerId > 0) {
RosterDetailActivity.openRosterDetail(ChatGroupOperateActivity.this, ownerId);
}
});
String name = mGroup.name();
mChatGroupRename.setEndContent(!TextUtils.isEmpty(name) ? name : "");
function capacity
inline int capacity()
最大人数
Return: int
Example:
function membersCount
inline int membersCount()
群成员数量,包含Owner,admins 和members
Return: int
Example:
// 群扩展信息
String ext = mGroup.extension();
if (!TextUtils.isEmpty(ext)) {
mViewGroupExt.setVisibility(View.VISIBLE);
mViewGroupExt.setText(ext);
} else {
mViewGroupExt.setVisibility(View.GONE);
}
// 群人数
int members = mGroup.membersCount();
mHeader.setTitle(String.format(getString(R.string.group_info), String.valueOf(members)));
// 群管理员人数
int admins = mGroup.adminsCount();
mChatGroupManagerList.setEndContent(admins <= 0 ? "" : String.valueOf(admins));
// 群共享列表
int shares = mGroup.sharedFilesCount();
mChatGroupShare.setEndContent(shares <= 0 ? "" : String.valueOf(shares));
// 群已读
function adminsCount
inline int adminsCount()
群管理员数量
Return: int
Example:
mViewGroupExt.setVisibility(View.VISIBLE);
mViewGroupExt.setText(ext);
} else {
mViewGroupExt.setVisibility(View.GONE);
}
// 群人数
int members = mGroup.membersCount();
mHeader.setTitle(String.format(getString(R.string.group_info), String.valueOf(members)));
// 群管理员人数
int admins = mGroup.adminsCount();
mChatGroupManagerList.setEndContent(admins <= 0 ? "" : String.valueOf(admins));
// 群共享列表
int shares = mGroup.sharedFilesCount();
mChatGroupShare.setEndContent(shares <= 0 ? "" : String.valueOf(shares));
// 群已读
boolean readAck = mGroup.enableReadAck();
mChatGroupReadMode.setCheckStatus(readAck);
function blockListSize
inline int blockListSize()
黑名单数量
Return: int
Example:
}
// // 被邀请入群模式
// BMXGroup.BeInvitedMode beInvitedMode = mGroup.beInvitedMode();
// for (int i = 0; i < beInvitedModeMap.size(); i++) {
// if (beInvitedModeMap.valueAt(i) == beInvitedMode) {
// mGroupBeInviteMode.setEndContent(getString(beInvitedModeMap.keyAt(i)));
// break;
// }
// }
// 黑名单人数
int blocks = mGroup.blockListSize();
mGroupBlock.setEndContent(blocks <= 0 ? "" : String.valueOf(blocks));
// 禁言人数
int banSize = mGroup.bannedListSize();
mGroupMemberBan.setEndContent(banSize <= 0 ? "" : String.valueOf(banSize));
//全员禁言
bindBanGroup();
// 隐藏群成员信息
mHideMemberInfo.setCheckStatus(mGroup.hideMemberInfo());
function bannedListSize
inline int bannedListSize()
禁言数量
Return: int
Example:
// for (int i = 0; i < beInvitedModeMap.size(); i++) {
// if (beInvitedModeMap.valueAt(i) == beInvitedMode) {
// mGroupBeInviteMode.setEndContent(getString(beInvitedModeMap.keyAt(i)));
// break;
// }
// }
// 黑名单人数
int blocks = mGroup.blockListSize();
mGroupBlock.setEndContent(blocks <= 0 ? "" : String.valueOf(blocks));
// 禁言人数
int banSize = mGroup.bannedListSize();
mGroupMemberBan.setEndContent(banSize <= 0 ? "" : String.valueOf(banSize));
//全员禁言
bindBanGroup();
// 隐藏群成员信息
mHideMemberInfo.setCheckStatus(mGroup.hideMemberInfo());
function sharedFilesCount
inline int sharedFilesCount()
群共享文件数量
Return: int
Example:
mViewGroupExt.setVisibility(View.GONE);
}
// 群人数
int members = mGroup.membersCount();
mHeader.setTitle(String.format(getString(R.string.group_info), String.valueOf(members)));
// 群管理员人数
int admins = mGroup.adminsCount();
mChatGroupManagerList.setEndContent(admins <= 0 ? "" : String.valueOf(admins));
// 群共享列表
int shares = mGroup.sharedFilesCount();
mChatGroupShare.setEndContent(shares <= 0 ? "" : String.valueOf(shares));
// 群已读
boolean readAck = mGroup.enableReadAck();
mChatGroupReadMode.setCheckStatus(readAck);
//群类型
String groupType = "";
switch (mGroup.groupType()){
function latestAnnouncementId
inline long latestAnnouncementId()
最新群公告id
Return: int64_t
Example:
function msgPushMode
inline BMXGroup.MsgPushMode msgPushMode()
群消息通知类型
Return: [MsgPushMode]
Example:
case Private:
groupType = getString(R.string.group_type_private);
break;
case Chatroom:
groupType = getString(R.string.group_type_chat_room);
break;
}
mChatGroupType.setEndContent(groupType);
setManagerVisible();
// 群消息通知模式
BMXGroup.MsgPushMode pushMode = mGroup.msgPushMode();
for (int i = 0; i < pushModeMap.size(); i++) {
if (pushModeMap.valueAt(i) == pushMode) {
mGroupNotifyMode.setEndContent(getString(pushModeMap.keyAt(i)));
break;
}
}
// 屏蔽群信息
BMXGroup.MsgMuteMode muteMode = mGroup.msgMuteMode();
for (int i = 0; i < muteModeMap.size(); i++) {
private void bindGroupInfo() {
// 屏蔽群信息
BMXGroup.MsgMuteMode muteMode = mGroup.msgMuteMode();
for (int i = 0; i < muteModeMap.size(); i++) {
if (muteModeMap.valueAt(i) == muteMode) {
mMuteGroupMessage.setEndContent(getString(muteModeMap.keyAt(i)));
break;
}
}
// 群消息通知模式
BMXGroup.MsgPushMode pushMode = mGroup.msgPushMode();
for (int i = 0; i < pushModeMap.size(); i++) {
if (pushModeMap.valueAt(i) == pushMode) {
mGroupNotifyMode.setEndContent(getString(pushModeMap.keyAt(i)));
break;
}
}
// 入群审批模式
BMXGroup.JoinAuthMode joinAuthMode = mGroup.joinAuthMode();
for (int i = 0; i < joinAuthModeMap.size(); i++) {
function modifyMode
inline BMXGroup.ModifyMode modifyMode()
群信息修改模式
Return: [ModifyMode]
Example:
function joinAuthMode
inline BMXGroup.JoinAuthMode joinAuthMode()
入群审批模式
Return: [JoinAuthMode]
Example:
}
// 群消息通知模式
BMXGroup.MsgPushMode pushMode = mGroup.msgPushMode();
for (int i = 0; i < pushModeMap.size(); i++) {
if (pushModeMap.valueAt(i) == pushMode) {
mGroupNotifyMode.setEndContent(getString(pushModeMap.keyAt(i)));
break;
}
}
// 入群审批模式
BMXGroup.JoinAuthMode joinAuthMode = mGroup.joinAuthMode();
for (int i = 0; i < joinAuthModeMap.size(); i++) {
if (joinAuthModeMap.valueAt(i) == joinAuthMode) {
mGroupJoinAuthMode.setEndContent(getString(joinAuthModeMap.keyAt(i)));
break;
}
}
// 邀请入群模式
BMXGroup.InviteMode inviteMode = mGroup.inviteMode();
for (int i = 0; i < inviteModeMap.size(); i++) {
function inviteMode
inline BMXGroup.InviteMode inviteMode()
入群邀请模式
Return: [InviteMode]
Example:
}
// 入群审批模式
BMXGroup.JoinAuthMode joinAuthMode = mGroup.joinAuthMode();
for (int i = 0; i < joinAuthModeMap.size(); i++) {
if (joinAuthModeMap.valueAt(i) == joinAuthMode) {
mGroupJoinAuthMode.setEndContent(getString(joinAuthModeMap.keyAt(i)));
break;
}
}
// 邀请入群模式
BMXGroup.InviteMode inviteMode = mGroup.inviteMode();
for (int i = 0; i < inviteModeMap.size(); i++) {
if (inviteModeMap.valueAt(i) == inviteMode) {
mGroupInviteMode.setEndContent(getString(inviteModeMap.keyAt(i)));
break;
}
}
// // 被邀请入群模式
// BMXGroup.BeInvitedMode beInvitedMode = mGroup.beInvitedMode();
// for (int i = 0; i < beInvitedModeMap.size(); i++) {
function msgMuteMode
inline BMXGroup.MsgMuteMode msgMuteMode()
群消息屏蔽模式
Return: [MsgMuteMode]
Example:
}
if (item.conversationId() == 0){
name = mContext.getString(R.string.sys_msg);
}
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
isDisturb = rosterItem != null && rosterItem.isMuteNotification();
} else if (type != null && type == BMXConversation.Type.Group) {
BMXGroup groupItem = RosterFetcher.getFetcher().getGroup(item.conversationId());
name = groupItem != null ? groupItem.name() : "";
ChatUtils.getInstance().showGroupAvatar(groupItem, avatar, mGroupConfig);
isDisturb = groupItem != null && groupItem.msgMuteMode() != null
&& groupItem.msgMuteMode() == BMXGroup.MsgMuteMode.MuteChat;
} else {
ChatUtils.getInstance().showRosterAvatar(null, avatar, mConfig);
}
BMXMessage lastMsg = item == null ? null : item.lastMsg();
int unReadCount = item == null ? 0 : item.unreadNumber();
if (isDisturb) {
tvUnReadCount.setVisibility(View.GONE);
ivDisturb.setVisibility(unReadCount > 0 ? View.VISIBLE : View.GONE);
if (item.conversationId() == 0){
name = mContext.getString(R.string.sys_msg);
}
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
isDisturb = rosterItem != null && rosterItem.isMuteNotification();
} else if (type != null && type == BMXConversation.Type.Group) {
BMXGroup groupItem = RosterFetcher.getFetcher().getGroup(item.conversationId());
name = groupItem != null ? groupItem.name() : "";
ChatUtils.getInstance().showGroupAvatar(groupItem, avatar, mGroupConfig);
isDisturb = groupItem != null && groupItem.msgMuteMode() != null
&& groupItem.msgMuteMode() == BMXGroup.MsgMuteMode.MuteChat;
} else {
ChatUtils.getInstance().showRosterAvatar(null, avatar, mConfig);
}
BMXMessage lastMsg = item == null ? null : item.lastMsg();
int unReadCount = item == null ? 0 : item.unreadNumber();
if (isDisturb) {
tvUnReadCount.setVisibility(View.GONE);
ivDisturb.setVisibility(unReadCount > 0 ? View.VISIBLE : View.GONE);
} else {
setManagerVisible();
// 群消息通知模式
BMXGroup.MsgPushMode pushMode = mGroup.msgPushMode();
for (int i = 0; i < pushModeMap.size(); i++) {
if (pushModeMap.valueAt(i) == pushMode) {
mGroupNotifyMode.setEndContent(getString(pushModeMap.keyAt(i)));
break;
}
}
// 屏蔽群信息
BMXGroup.MsgMuteMode muteMode = mGroup.msgMuteMode();
for (int i = 0; i < muteModeMap.size(); i++) {
if (muteModeMap.valueAt(i) == muteMode) {
mMuteGroupMessage.setEndContent(getString(muteModeMap.keyAt(i)));
break;
}
}
private void bindGroupInfo() {
// 屏蔽群信息
BMXGroup.MsgMuteMode muteMode = mGroup.msgMuteMode();
for (int i = 0; i < muteModeMap.size(); i++) {
if (muteModeMap.valueAt(i) == muteMode) {
mMuteGroupMessage.setEndContent(getString(muteModeMap.keyAt(i)));
break;
}
}
// 群消息通知模式
BMXGroup.MsgPushMode pushMode = mGroup.msgPushMode();
for (int i = 0; i < pushModeMap.size(); i++) {
if (pushModeMap.valueAt(i) == pushMode) {
mGroupNotifyMode.setEndContent(getString(pushModeMap.keyAt(i)));
break;
}
}
// 入群审批模式
BMXGroup.JoinAuthMode joinAuthMode = mGroup.joinAuthMode();
for (int i = 0; i < joinAuthModeMap.size(); i++) {
function groupStatus
inline BMXGroup.GroupStatus groupStatus()
当前群组的状态。(Normal 正常, Destroyed 以销毁)
Return: [GroupStatus]
Example:
private List<BMXGroup> filterGroup(BMXGroupList groupList) {
List<BMXGroup> list = new ArrayList<>();
if (groupList != null && !groupList.isEmpty()) {
for (int i = 0; i < groupList.size(); i++) {
BMXGroup group = groupList.get(i);
if (group != null && group.groupStatus() != null) {
BMXGroup.GroupStatus status = group.groupStatus();
if (status == BMXGroup.GroupStatus.Normal && group.isMember()) {
list.add(group);
}
}
}
}
return list;
private List<BMXGroup> filterGroup(BMXGroupList groupList) {
List<BMXGroup> list = new ArrayList<>();
if (groupList != null && !groupList.isEmpty()) {
for (int i = 0; i < groupList.size(); i++) {
BMXGroup group = groupList.get(i);
if (group != null && group.groupStatus() != null) {
BMXGroup.GroupStatus status = group.groupStatus();
if (status == BMXGroup.GroupStatus.Normal && group.isMember()) {
list.add(group);
}
}
}
}
return list;
function isMember
inline boolean isMember()
Deprecated use roleType instead.
Return: bool
当前用户是否是群成员
Example:
private List<BMXGroup> filterGroup(BMXGroupList groupList) {
List<BMXGroup> list = new ArrayList<>();
if (groupList != null && !groupList.isEmpty()) {
for (int i = 0; i < groupList.size(); i++) {
BMXGroup group = groupList.get(i);
if (group != null && group.groupStatus() != null) {
BMXGroup.GroupStatus status = group.groupStatus();
if (status == BMXGroup.GroupStatus.Normal && group.isMember()) {
list.add(group);
}
}
}
}
return list;
private void bindGroup(BMXGroup group) {
if (group.isMember()) {
// 群成员直接跳转
ChatGroupActivity.startChatActivity(this, BMXMessage.MessageType.Group, mGroupId);
finish();
return;
}
String name = group.name();
ChatUtils.getInstance().showGroupAvatar(group, mUserIcon, mConfig);
mUserName.setText(TextUtils.isEmpty(name) ? "" : name);
function enableReadAck
inline boolean enableReadAck()
是否开启群消息已读功能
Return: bool
Example:
int members = mGroup.membersCount();
mHeader.setTitle(String.format(getString(R.string.group_info), String.valueOf(members)));
// 群管理员人数
int admins = mGroup.adminsCount();
mChatGroupManagerList.setEndContent(admins <= 0 ? "" : String.valueOf(admins));
// 群共享列表
int shares = mGroup.sharedFilesCount();
mChatGroupShare.setEndContent(shares <= 0 ? "" : String.valueOf(shares));
// 群已读
boolean readAck = mGroup.enableReadAck();
mChatGroupReadMode.setCheckStatus(readAck);
//群类型
String groupType = "";
switch (mGroup.groupType()){
case Public:
groupType = getString(R.string.group_type_public);
break;
case Private:
function historyVisible
inline boolean historyVisible()
是否可以加载显示历史聊天记录
Return: bool
Example:
function roleType
inline BMXGroup.MemberRoleType roleType()
成员在群组内的角色类型
Return: [MemberRoleType]
Example:
function banExpireTime
inline long banExpireTime()
群组全员禁言到期时间
Protected Functions Documentation
Example:
private void updateInputBar(BMXGroup group){
long currentTime = System.currentTimeMillis();
GroupManager.getInstance().getBannedMembers(group, (error, memberList) -> {
if (BaseManager.bmxFinish(error)) {
for (int i = 0; i < memberList.size(); i++) {
if (mMyUserId == memberList.get(i).getMUid()){
long banExpireTime = memberList.get(i).getMExpired() * 1000;
mView.enableInputBar((banExpireTime <= currentTime && banExpireTime != -1000), false);
return;
}
}
}
});
boolean isOwner = GroupManager.getInstance().isGroupOwner(group.ownerId());
boolean isAdmin = GroupManager.getInstance().isAdmin(group, SharePreferenceUtils.getInstance().getUserId()) || isOwner;
long banExpireTime = group.banExpireTime() * 1000;
//临时禁言过期也没有永久禁言
mView.enableInputBar((banExpireTime <= currentTime && banExpireTime != -1000)||isAdmin, true);
private void bindBanGroup(){
long banExpireTime = mGroup.banExpireTime() * 1000;
long currentTime = System.currentTimeMillis();
if (banExpireTime > currentTime || banExpireTime == -1000) {
//判断是否当前在禁言
if (banExpireTime != -1000){
mGroupBan.setLeftText(getString(R.string.group_all_ban) + "(" +
TimeUtils.millis2String(this, banExpireTime) + ")");
}
mGroupBan.setCheckStatus(true);
} else {
mGroupBan.setLeftText(getString(R.string.group_all_ban));
mGroupBan.setCheckStatus(false);
}
function BMXGroup
inline BMXGroup(
long cPtr,
boolean cMemoryOwn
)
Example:
function finalize
inline void finalize()
Example:
function getCPtr
static inline long getCPtr(
BMXGroup obj
)
Public Attributes Documentation
variable swigCPtr
transient long swigCPtr;
Example:
Updated on 2022-01-26 at 17:18:31 +0800