im::floo::floolib::BMXGroup

Group

Inherits from BMXBaseObject

Public Classes

Name
class Announcement
Group announcement
class Application
Group application

Public Functions

Name
BMXGroup()
synchronized void delete()
long groupId()
Group Id
BMXGroup.GroupType groupType()
Type of the current group (Private, Public, Chatroom)
String myNickname()
Group member nickname of mine
String name()
Group name
String description()
Group description
String avatarRatelUrl()
Ratel address of group avatar
String avatarUrl()
Group avatar
String avatarPath()
Local path of downloaded group avatar
String avatarThumbnailUrl()
Group avatar thumbnail address
String avatarThumbnailPath()
Local path of downloaded group avatar thumbnail
long createTime()
Group creation time
String extension()
Group extension information
long ownerId()
Group Owner
int capacity()
Maximum number of group members
int membersCount()
Number of group members, including Owner, Admins and Members
int adminsCount()
Number of group admins
int blockListSize()
Blacklisted user-number
int bannedListSize()
Banned user-number
int sharedFilesCount()
Shared file-number in group
long latestAnnouncementId()
Latest group announcement id
BMXGroup.MsgPushMode msgPushMode()
Group message notification type
BMXGroup.ModifyMode modifyMode()
Group information modification mode
BMXGroup.JoinAuthMode joinAuthMode()
Join approval mode
BMXGroup.InviteMode inviteMode()
Group invitation mode
BMXGroup.MsgMuteMode msgMuteMode()
Group message blocking mode
BMXGroup.GroupStatus groupStatus()
state of the current group. (Normal, Destroyed)
boolean isMember()
Deprecated use roleType instead.
boolean enableReadAck()
Whether group message read acknowledgement feature enabled
boolean historyVisible()
Whether to load and display the chat history
BMXGroup.MemberRoleType roleType()
Type of a member role in group
long banExpireTime()
Expiration time of banning all group members

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()

Group Id

Return: int64_t

Example:

public void putGroup(BMXGroup item) {
    if (item != null)
        mGroupCache.put(item.groupId(), item);
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()

Type of the current group (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()

Group member nickname of mine

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()

Group 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);
    } else if (rosterItem != null) {
        name = rosterItem.username();
    }
    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) {

function description

inline String description()

Group 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 address of group avatar

Return: std::string

Example:

function avatarUrl

inline String avatarUrl()

Group avatar

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()

Local path of downloaded group avatar

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()

Group avatar thumbnail address

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()

Local path of downloaded group avatar thumbnail

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()

Group creation time

Return: int64_t

Example:

function extension

inline String extension()

Group extension information

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()

Group 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()) {
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()

Maximum number of group members

Return: int

Example:

function membersCount

inline int membersCount()

Number of group members, including Owner, Admins and 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()

Number of group admins

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()

Blacklisted user-number

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()

Banned user-number

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()

Shared file-number in group

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()

Latest group announcement id

Return: int64_t

Example:

function msgPushMode

inline BMXGroup.MsgPushMode msgPushMode()

Group message notification type

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()

Group information modification mode

Return: [ModifyMode]

Example:

function joinAuthMode

inline BMXGroup.JoinAuthMode joinAuthMode()

Join approval mode

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()

Group invitation mode

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()

Group message blocking mode

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()

state of the current group. (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

Whether the current user is a group member

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()

Whether group message read acknowledgement feature enabled

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()

Whether to load and display the chat history

Return: bool

Example:

function roleType

inline BMXGroup.MemberRoleType roleType()

Type of a member role in group

Return: [MemberRoleType]

Example:

function banExpireTime

inline long banExpireTime()

Expiration time of banning all group members

Protected Functions Documentation

Example:

private void bindBanGroup(){
    long banExpireTime = mGroup.banExpireTime() * 1000;
    long currentTime = System.currentTimeMillis();
    if (banExpireTime > currentTime) {
        //判断是否当前在禁言
        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

© 2019-2024 MaximTop | Homepage | Site Map Last modified time: 2024-09-26 03:17:35

results matching ""

    No results matching ""