im::floo::floolib::BMXRosterItem

联系人

Inherits from BMXBaseObject

Public Functions

Name
BMXRosterItem()
synchronized void delete()
long rosterId()
好友Id
String username()
好友名
String nickname()
好友昵称
String avatarRatelUrl()
好友头像ratel服务器地址
String avatarUrl()
好友头像服务器地址
String avatarPath()
好友头像本地存储路径
String avatarThumbnailUrl()
好友头像缩略图地址
String avatarThumbnailPath()
好友头像缩略图本地存储路径
String publicInfo()
扩展信息,用户设置的好友可以看到的信息,比如地址,个性签名等
String alias()
用户对好友添加的备注等信息
String ext()
用户的服务器扩展信息
String localExt()
用户的本地扩展信息
BMXRosterItem.RosterRelation relation()
联系人关系
boolean isMuteNotification()
是否提醒用户消息
BMXRosterItem.AddFriendAuthMode addFriendAuthMode()
roster的好友添加验证方式。
String authQuestion()
roster的好友验证问题。

Protected Functions

Name
BMXRosterItem(long cPtr, boolean cMemoryOwn)
void finalize()
long getCPtr(BMXRosterItem obj)

Public Attributes

Name
transient long swigCPtr

Public Functions Documentation

function BMXRosterItem

inline BMXRosterItem()

Example:

function delete

inline synchronized void delete()

Example:

function rosterId

inline long rosterId()

好友Id

Return: int64_t

Example:

public void putRoster(BMXRosterItem item) {
    if (item != null)
        mRosterCache.put(item.rosterId(), item);
private void removeRoster(final BMXRosterItem item, final int position) {
    if (item == null) {
        return;
    }
    showLoadingDialog(true);
    RosterManager.getInstance().remove(item.rosterId(), bmxErrorCode -> {
        dismissLoadingDialog();
        if (BaseManager.bmxFinish(bmxErrorCode)) {
            ChatManager.getInstance().deleteConversation(item.rosterId(), true);
            mAdapter.remove(position);
        }
    });
ChatManager.getInstance().deleteConversation(item.rosterId(), true);
TextView add = holder.findViewById(R.id.add_contact);
final BMXRosterItem item = getItem(position);
if (item == null) {
    return;
}
//是否是好友
BMXRosterItem.RosterRelation rosterRelation = item.relation();
boolean friend = rosterRelation == BMXRosterItem.RosterRelation.Friend;
long myId = SharePreferenceUtils.getInstance().getUserId();
// 自己不展示添加按钮
add.setVisibility(myId == item.rosterId() || friend ? View.GONE : View.VISIBLE);
add.setOnClickListener(v -> {
    long rosterId = item.rosterId();
    showAddReason(rosterId, item.authQuestion());
});

String name = item.username();
title.setText(name);
ChatUtils.getInstance().showRosterAvatar(item, avatar, mConfig);
long rosterId = item.rosterId();
protected void bindData(BMXRosterItemList itemList) {
    if (itemList != null && !itemList.isEmpty()) {
        List<BMXRosterItem> rosterItems = new ArrayList<>();
        for (int i = 0; i < itemList.size(); i++) {
            BMXRosterItem item = itemList.get(i);
            if (item == null) {
                continue;
            }
            if (mFilterList == null || !mFilterList.contains(String.valueOf(item.rosterId()))) {
                rosterItems.add(itemList.get(i));
            }
        }
        mAdapter.replaceList(rosterItems);
        mRecycler.setVisibility(View.VISIBLE);
        mEmptyView.setVisibility(View.GONE);
    } else {
        mRecycler.setVisibility(View.GONE);
        mEmptyView.setVisibility(View.VISIBLE);
    }
@Override
protected void onBindHolder(BaseViewHolder holder, int position) {
    ShapeImageView icon = holder.findViewById(R.id.img_icon);
    TextView tvName = holder.findViewById(R.id.txt_name);
    CheckBox checkBox = holder.findViewById(R.id.cb_choice);
    BMXRosterItem member = getItem(position);
    if (member == null) {
        return;
    }
    if (mIsShowCheck) {
        boolean isCheck = mSelected.containsKey(member.rosterId())
                && mSelected.get(member.rosterId());
        checkBox.setChecked(isCheck);
        checkBox.setVisibility(member.rosterId() != MessageConfig.MEMBER_ADD
                && member.rosterId() != MessageConfig.MEMBER_REMOVE ? View.VISIBLE
                        : View.INVISIBLE);
    } else {
        checkBox.setVisibility(View.GONE);
    }
    String name = "";
protected void onBindHolder(BaseViewHolder holder, int position) {
    ShapeImageView icon = holder.findViewById(R.id.img_icon);
    TextView tvName = holder.findViewById(R.id.txt_name);
    CheckBox checkBox = holder.findViewById(R.id.cb_choice);
    BMXRosterItem member = getItem(position);
    if (member == null) {
        return;
    }
    if (mIsShowCheck) {
        boolean isCheck = mSelected.containsKey(member.rosterId())
                && mSelected.get(member.rosterId());
        checkBox.setChecked(isCheck);
        checkBox.setVisibility(member.rosterId() != MessageConfig.MEMBER_ADD
                && member.rosterId() != MessageConfig.MEMBER_REMOVE ? View.VISIBLE
                        : View.INVISIBLE);
    } else {
        checkBox.setVisibility(View.GONE);
    }
    String name = "";
    if (!TextUtils.isEmpty(member.alias())) {

function username

inline String username()

好友名

Return: std::string

Example:

// sticky.setText(bean == null ? "" : bean.getFirst());
if (bean == null) {
    return;
}
String name = "";
if (!TextUtils.isEmpty(bean.alias())) {
    name = bean.alias();
} else if (!TextUtils.isEmpty(bean.nickname())) {
    name = bean.nickname();
} else {
    name = bean.username();
}
title.setText(name);
ChatUtils.getInstance().showRosterAvatar(bean, avatar, mConfig);
BMXRosterItem.RosterRelation rosterRelation = item.relation();
boolean friend = rosterRelation == BMXRosterItem.RosterRelation.Friend;
long myId = SharePreferenceUtils.getInstance().getUserId();
// 自己不展示添加按钮
add.setVisibility(myId == item.rosterId() || friend ? View.GONE : View.VISIBLE);
add.setOnClickListener(v -> {
    long rosterId = item.rosterId();
    showAddReason(rosterId, item.authQuestion());
});

String name = item.username();
title.setText(name);
ChatUtils.getInstance().showRosterAvatar(item, avatar, mConfig);
}
BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.getMRosterId());
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
String name = "";
if (rosterItem != null) {
    if (!TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (!TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } else {
        name = rosterItem.username();
    }
}

title.setText(!TextUtils.isEmpty(name) ? name : "");

BMXRosterService.ApplicationStatus applicationStatus = item.getMStatus();
String statusDesc = "";
if (applicationStatus != null) {
    if (applicationStatus == BMXRosterService.ApplicationStatus.Accepted) {
                    : View.INVISIBLE);
} else {
    checkBox.setVisibility(View.GONE);
}
String name = "";
if (!TextUtils.isEmpty(member.alias())) {
    name = member.alias();
} else if (!TextUtils.isEmpty(member.nickname())) {
    name = member.nickname();
} else {
    name = member.username();
}
tvName.setText(name);
ChatUtils.getInstance().showRosterAvatar(member, icon, mConfig);
            mTvOpenChat.setVisibility(View.GONE);
            add.setVisibility(View.VISIBLE);
            add.setText(getString(R.string.add));
        }
//        if (friend) {
//            // 好友直接跳转单聊
//            ChatSingleActivity.startChatActivity(this, BMXMessage.MessageType.Single, mRosterId);
//            finish();
//            return;
//        }
        String name = mRosterItem.username();
        String nickName = mRosterItem.nickname();
        ChatUtils.getInstance().showRosterAvatar(mRosterItem, mUserIcon, mConfig);
        if (!friend) {
            // 非好友 需要强制更新头像
            ChatUtils.getInstance().downloadUserAvatar(mRosterItem, mUserIcon, mConfig);
        }
        long userId = mRosterItem.rosterId();
        mUserName.setText(TextUtils.isEmpty(name) ? "" : name);
        mNickName.setText(TextUtils.isEmpty(nickName) ? "" : getString(R.string.nickname_colon) + nickName);
        .getRoster(item.getMApplicationId());
final BMXGroup groupItem = RosterFetcher.getFetcher()
        .getGroup(item.getMGroupId());
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
String name = "";
if (!TextUtils.isEmpty(rosterItem.alias())) {
    name = rosterItem.alias();
} else if (!TextUtils.isEmpty(rosterItem.nickname())) {
    name = rosterItem.nickname();
} else {
    name = rosterItem.username();
}
title.setText(name);

BMXGroup.ApplicationStatus inviteStatus = item.getMStatus();
String statusDesc = "";
if (inviteStatus != null) {
    if (inviteStatus == BMXGroup.ApplicationStatus.Accepted) {
        statusDesc = getString(R.string.added);
        accept.setVisibility(View.INVISIBLE);
                : "");

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

BMXGroup.InvitationStatus inviteStatus = item.getMStatus();
String statusDesc = "";
if (inviteStatus != null) {
    if (inviteStatus == BMXGroup.InvitationStatus.Accepted) {
        statusDesc = getString(R.string.added);
        accept.setVisibility(View.INVISIBLE);
boolean isDisturb = false;
BMXConversation.Type type = item == null ? null : item.type();
String name = "";
if (type != null && type == BMXConversation.Type.Single) {
    BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.conversationId());
    if (rosterItem != null && !TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (rosterItem != null && !TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } 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() : "";

function nickname

inline String nickname()

好友昵称

Return: std::string

Example:

// sticky.setVisibility(View.GONE);
// }
// }
// sticky.setText(bean == null ? "" : bean.getFirst());
if (bean == null) {
    return;
}
String name = "";
if (!TextUtils.isEmpty(bean.alias())) {
    name = bean.alias();
} else if (!TextUtils.isEmpty(bean.nickname())) {
    name = bean.nickname();
} else {
    name = bean.username();
}
title.setText(name);
ChatUtils.getInstance().showRosterAvatar(bean, avatar, mConfig);
// }
// }
// sticky.setText(bean == null ? "" : bean.getFirst());
if (bean == null) {
    return;
}
String name = "";
if (!TextUtils.isEmpty(bean.alias())) {
    name = bean.alias();
} else if (!TextUtils.isEmpty(bean.nickname())) {
    name = bean.nickname();
} else {
    name = bean.username();
}
title.setText(name);
ChatUtils.getInstance().showRosterAvatar(bean, avatar, mConfig);
final BMXRosterService.Application item = getItem(position);
if (item == null) {
    return;
}
BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.getMRosterId());
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
String name = "";
if (rosterItem != null) {
    if (!TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (!TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } else {
        name = rosterItem.username();
    }
}

title.setText(!TextUtils.isEmpty(name) ? name : "");

BMXRosterService.ApplicationStatus applicationStatus = item.getMStatus();
if (item == null) {
    return;
}
BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.getMRosterId());
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
String name = "";
if (rosterItem != null) {
    if (!TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (!TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } else {
        name = rosterItem.username();
    }
}

title.setText(!TextUtils.isEmpty(name) ? name : "");

BMXRosterService.ApplicationStatus applicationStatus = item.getMStatus();
String statusDesc = "";
    checkBox.setChecked(isCheck);
    checkBox.setVisibility(member.rosterId() != MessageConfig.MEMBER_ADD
            && member.rosterId() != MessageConfig.MEMBER_REMOVE ? View.VISIBLE
                    : View.INVISIBLE);
} else {
    checkBox.setVisibility(View.GONE);
}
String name = "";
if (!TextUtils.isEmpty(member.alias())) {
    name = member.alias();
} else if (!TextUtils.isEmpty(member.nickname())) {
    name = member.nickname();
} else {
    name = member.username();
}
tvName.setText(name);
ChatUtils.getInstance().showRosterAvatar(member, icon, mConfig);
    checkBox.setVisibility(member.rosterId() != MessageConfig.MEMBER_ADD
            && member.rosterId() != MessageConfig.MEMBER_REMOVE ? View.VISIBLE
                    : View.INVISIBLE);
} else {
    checkBox.setVisibility(View.GONE);
}
String name = "";
if (!TextUtils.isEmpty(member.alias())) {
    name = member.alias();
} else if (!TextUtils.isEmpty(member.nickname())) {
    name = member.nickname();
} else {
    name = member.username();
}
tvName.setText(name);
ChatUtils.getInstance().showRosterAvatar(member, icon, mConfig);
            add.setVisibility(View.VISIBLE);
            add.setText(getString(R.string.add));
        }
//        if (friend) {
//            // 好友直接跳转单聊
//            ChatSingleActivity.startChatActivity(this, BMXMessage.MessageType.Single, mRosterId);
//            finish();
//            return;
//        }
        String name = mRosterItem.username();
        String nickName = mRosterItem.nickname();
        ChatUtils.getInstance().showRosterAvatar(mRosterItem, mUserIcon, mConfig);
        if (!friend) {
            // 非好友 需要强制更新头像
            ChatUtils.getInstance().downloadUserAvatar(mRosterItem, mUserIcon, mConfig);
        }
        long userId = mRosterItem.rosterId();
        mUserName.setText(TextUtils.isEmpty(name) ? "" : name);
        mNickName.setText(TextUtils.isEmpty(nickName) ? "" : getString(R.string.nickname_colon) + nickName);
        mUserId.setText(userId <= 0 ? "" : "ID:" + userId);
    return;
}
final BMXRosterItem rosterItem = RosterFetcher.getFetcher()
        .getRoster(item.getMApplicationId());
final BMXGroup groupItem = RosterFetcher.getFetcher()
        .getGroup(item.getMGroupId());
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
String name = "";
if (!TextUtils.isEmpty(rosterItem.alias())) {
    name = rosterItem.alias();
} else if (!TextUtils.isEmpty(rosterItem.nickname())) {
    name = rosterItem.nickname();
} else {
    name = rosterItem.username();
}
title.setText(name);

BMXGroup.ApplicationStatus inviteStatus = item.getMStatus();
String statusDesc = "";
if (inviteStatus != null) {

function avatarRatelUrl

inline String avatarRatelUrl()

好友头像ratel服务器地址

Return: std::string

Example:

function avatarUrl

inline String avatarUrl()

好友头像服务器地址

Return: std::string

Example:

}
String avatarUrl = "";
if (rosterItem == null) {
    mViewCache.remove(imageView.hashCode());
    avatarUrl = "drawable://" + R.drawable.bmx_icon;
} else {
    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
String avatarUrl = "";
if (rosterItem == null) {
    mViewCache.remove(imageView.hashCode());
    avatarUrl = "drawable://" + R.drawable.bmx_icon;
} else {
    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {

function avatarPath

inline String avatarPath()

好友头像本地存储路径

Return: std::string

Example:

    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {
        downloadUserAvatar(rosterItem, imageView, config);
    }
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {
        downloadUserAvatar(rosterItem, imageView, config);
    }
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {
        downloadUserAvatar(rosterItem, imageView, config);
    }
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {
        downloadUserAvatar(rosterItem, imageView, config);
    }
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);

function avatarThumbnailUrl

inline String avatarThumbnailUrl()

好友头像缩略图地址

Return: std::string

Example:

if (imageView == null) {
    return;
}
String avatarUrl = "";
if (rosterItem == null) {
    mViewCache.remove(imageView.hashCode());
    avatarUrl = "drawable://" + R.drawable.bmx_icon;
} else {
    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
    return;
}
String avatarUrl = "";
if (rosterItem == null) {
    mViewCache.remove(imageView.hashCode());
    avatarUrl = "drawable://" + R.drawable.bmx_icon;
} else {
    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {

function avatarThumbnailPath

inline String avatarThumbnailPath()

好友头像缩略图本地存储路径

Return: std::string

Example:

if (rosterItem == null) {
    mViewCache.remove(imageView.hashCode());
    avatarUrl = "drawable://" + R.drawable.bmx_icon;
} else {
    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {
        downloadUserAvatar(rosterItem, imageView, config);
    mViewCache.remove(imageView.hashCode());
    avatarUrl = "drawable://" + R.drawable.bmx_icon;
} else {
    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {
        downloadUserAvatar(rosterItem, imageView, config);
    avatarUrl = "drawable://" + R.drawable.bmx_icon;
} else {
    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {
        downloadUserAvatar(rosterItem, imageView, config);
    }
} else {
    // 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
    // 新增直接展示头像地址 不需下载
    if (!TextUtils.isEmpty(rosterItem.avatarThumbnailUrl())) {
        avatarUrl = rosterItem.avatarThumbnailUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarUrl())) {
        avatarUrl = rosterItem.avatarUrl();
    } else if (!TextUtils.isEmpty(rosterItem.avatarThumbnailPath())
            && new File(rosterItem.avatarThumbnailPath()).exists()
            && new File(rosterItem.avatarThumbnailPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarThumbnailPath();
    } else if (!TextUtils.isEmpty(rosterItem.avatarPath())
            && new File(rosterItem.avatarPath()).exists()
            && new File(rosterItem.avatarPath()).isFile()) {
        avatarUrl = "file://" + rosterItem.avatarPath();
    } else {
        downloadUserAvatar(rosterItem, imageView, config);
    }
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);

function publicInfo

inline String publicInfo()

扩展信息,用户设置的好友可以看到的信息,比如地址,个性签名等

Return: JSON(std::string)

Example:

String nickName = mRosterItem.nickname();
ChatUtils.getInstance().showRosterAvatar(mRosterItem, mUserIcon, mConfig);
if (!friend) {
    // 非好友 需要强制更新头像
    ChatUtils.getInstance().downloadUserAvatar(mRosterItem, mUserIcon, mConfig);
}
long userId = mRosterItem.rosterId();
mUserName.setText(TextUtils.isEmpty(name) ? "" : name);
mNickName.setText(TextUtils.isEmpty(nickName) ? "" : getString(R.string.nickname_colon) + nickName);
mUserId.setText(userId <= 0 ? "" : "ID:" + userId);
String publicInfo = mRosterItem.publicInfo();
if (TextUtils.isEmpty(publicInfo)) {
    mTvPublic.setVisibility(View.GONE);
} else {
    mTvPublic.setVisibility(View.VISIBLE);
    mTvPublic.setText(publicInfo);
}

String alias = mRosterItem.alias();
mSetAlias.setEndContent(TextUtils.isEmpty(alias) ? "" : alias);

function alias

inline String alias()

用户对好友添加的备注等信息

Return: JSON(std::string)

Example:

// sticky.setVisibility(View.VISIBLE);
// } else {
// sticky.setVisibility(View.GONE);
// }
// }
// sticky.setText(bean == null ? "" : bean.getFirst());
if (bean == null) {
    return;
}
String name = "";
if (!TextUtils.isEmpty(bean.alias())) {
    name = bean.alias();
} else if (!TextUtils.isEmpty(bean.nickname())) {
    name = bean.nickname();
} else {
    name = bean.username();
}
title.setText(name);
ChatUtils.getInstance().showRosterAvatar(bean, avatar, mConfig);
// } else {
// sticky.setVisibility(View.GONE);
// }
// }
// sticky.setText(bean == null ? "" : bean.getFirst());
if (bean == null) {
    return;
}
String name = "";
if (!TextUtils.isEmpty(bean.alias())) {
    name = bean.alias();
} else if (!TextUtils.isEmpty(bean.nickname())) {
    name = bean.nickname();
} else {
    name = bean.username();
}
title.setText(name);
ChatUtils.getInstance().showRosterAvatar(bean, avatar, mConfig);
TextView accept = holder.findViewById(R.id.tv_accept);
TextView reason = holder.findViewById(R.id.apply_reason);
final BMXRosterService.Application item = getItem(position);
if (item == null) {
    return;
}
BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.getMRosterId());
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
String name = "";
if (rosterItem != null) {
    if (!TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (!TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } else {
        name = rosterItem.username();
    }
}

title.setText(!TextUtils.isEmpty(name) ? name : "");
TextView reason = holder.findViewById(R.id.apply_reason);
final BMXRosterService.Application item = getItem(position);
if (item == null) {
    return;
}
BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.getMRosterId());
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
String name = "";
if (rosterItem != null) {
    if (!TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (!TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } else {
        name = rosterItem.username();
    }
}

title.setText(!TextUtils.isEmpty(name) ? name : "");
    boolean isCheck = mSelected.containsKey(member.rosterId())
            && mSelected.get(member.rosterId());
    checkBox.setChecked(isCheck);
    checkBox.setVisibility(member.rosterId() != MessageConfig.MEMBER_ADD
            && member.rosterId() != MessageConfig.MEMBER_REMOVE ? View.VISIBLE
                    : View.INVISIBLE);
} else {
    checkBox.setVisibility(View.GONE);
}
String name = "";
if (!TextUtils.isEmpty(member.alias())) {
    name = member.alias();
} else if (!TextUtils.isEmpty(member.nickname())) {
    name = member.nickname();
} else {
    name = member.username();
}
tvName.setText(name);
ChatUtils.getInstance().showRosterAvatar(member, icon, mConfig);
            && mSelected.get(member.rosterId());
    checkBox.setChecked(isCheck);
    checkBox.setVisibility(member.rosterId() != MessageConfig.MEMBER_ADD
            && member.rosterId() != MessageConfig.MEMBER_REMOVE ? View.VISIBLE
                    : View.INVISIBLE);
} else {
    checkBox.setVisibility(View.GONE);
}
String name = "";
if (!TextUtils.isEmpty(member.alias())) {
    name = member.alias();
} else if (!TextUtils.isEmpty(member.nickname())) {
    name = member.nickname();
} else {
    name = member.username();
}
tvName.setText(name);
ChatUtils.getInstance().showRosterAvatar(member, icon, mConfig);
mNickName.setText(TextUtils.isEmpty(nickName) ? "" : getString(R.string.nickname_colon) + nickName);
mUserId.setText(userId <= 0 ? "" : "ID:" + userId);
String publicInfo = mRosterItem.publicInfo();
if (TextUtils.isEmpty(publicInfo)) {
    mTvPublic.setVisibility(View.GONE);
} else {
    mTvPublic.setVisibility(View.VISIBLE);
    mTvPublic.setText(publicInfo);
}

String alias = mRosterItem.alias();
mSetAlias.setEndContent(TextUtils.isEmpty(alias) ? "" : alias);

String ext = mRosterItem.ext();
if (TextUtils.isEmpty(ext)) {
    mTvExt.setVisibility(View.GONE);
} else {
    mTvExt.setVisibility(View.VISIBLE);
    mTvExt.setText(ext);
final BMXGroup.Application item = getItem(position);
if (item == null) {
    return;
}
final BMXRosterItem rosterItem = RosterFetcher.getFetcher()
        .getRoster(item.getMApplicationId());
final BMXGroup groupItem = RosterFetcher.getFetcher()
        .getGroup(item.getMGroupId());
ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
String name = "";
if (!TextUtils.isEmpty(rosterItem.alias())) {
    name = rosterItem.alias();
} else if (!TextUtils.isEmpty(rosterItem.nickname())) {
    name = rosterItem.nickname();
} else {
    name = rosterItem.username();
}
title.setText(name);

BMXGroup.ApplicationStatus inviteStatus = item.getMStatus();

function ext

inline String ext()

用户的服务器扩展信息

Return: JSON(std::string)

Example:

if (TextUtils.isEmpty(publicInfo)) {
    mTvPublic.setVisibility(View.GONE);
} else {
    mTvPublic.setVisibility(View.VISIBLE);
    mTvPublic.setText(publicInfo);
}

String alias = mRosterItem.alias();
mSetAlias.setEndContent(TextUtils.isEmpty(alias) ? "" : alias);

String ext = mRosterItem.ext();
if (TextUtils.isEmpty(ext)) {
    mTvExt.setVisibility(View.GONE);
} else {
    mTvExt.setVisibility(View.VISIBLE);
    mTvExt.setText(ext);
}
// 免打扰
boolean isBlock = mRosterItem.isMuteNotification();
mSetDistrub.setCheckStatus(isBlock);

function localExt

inline String localExt()

用户的本地扩展信息

Return: JSON(std::string)

Example:

function relation

inline BMXRosterItem.RosterRelation relation()

联系人关系

Return: [RosterRelation]

Example:

BMXRosterItem.RosterRelation rosterRelation = item != null ? item.relation()
@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);
    final BMXRosterItem item = getItem(position);
    if (item == null) {
        return;
    }
    //是否是好友
    BMXRosterItem.RosterRelation rosterRelation = item.relation();
    boolean friend = rosterRelation == BMXRosterItem.RosterRelation.Friend;
    long myId = SharePreferenceUtils.getInstance().getUserId();
    // 自己不展示添加按钮
    add.setVisibility(myId == item.rosterId() || friend ? View.GONE : View.VISIBLE);
    add.setOnClickListener(v -> {
        long rosterId = item.rosterId();
        showAddReason(rosterId, item.authQuestion());
    });
    private void bindRoster() {
        // 是否是好友
        BMXRosterItem.RosterRelation rosterRelation = mRosterItem.relation();
        boolean friend = rosterRelation == BMXRosterItem.RosterRelation.Friend;
        TextView add = mHeader.getRightText();
        if (friend) {
            mTvOpenChat.setVisibility(View.VISIBLE);
            add.setVisibility(View.GONE);
        } else {
            mTvOpenChat.setVisibility(View.GONE);
            add.setVisibility(View.VISIBLE);
            add.setText(getString(R.string.add));
        }
//        if (friend) {
//            // 好友直接跳转单聊
//            ChatSingleActivity.startChatActivity(this, BMXMessage.MessageType.Single, mRosterId);
//            finish();
//            return;
//        }
        String name = mRosterItem.username();

function isMuteNotification

inline boolean isMuteNotification()

是否提醒用户消息

Return: bool

Example:

mSetAlias.setEndContent(TextUtils.isEmpty(alias) ? "" : alias);

String ext = mRosterItem.ext();
if (TextUtils.isEmpty(ext)) {
    mTvExt.setVisibility(View.GONE);
} else {
    mTvExt.setVisibility(View.VISIBLE);
    mTvExt.setText(ext);
}
// 免打扰
boolean isBlock = mRosterItem.isMuteNotification();
mSetDistrub.setCheckStatus(isBlock);
        name = rosterItem.alias();
    } else if (rosterItem != null && !TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } 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);

function addFriendAuthMode

inline BMXRosterItem.AddFriendAuthMode addFriendAuthMode()

roster的好友添加验证方式。

Return: [AddFriendAuthMode]

Example:

function authQuestion

inline String authQuestion()

roster的好友验证问题。

Return: std::string

Protected Functions Documentation

Example:

showAddReason(rosterId, item.authQuestion());

function BMXRosterItem

inline BMXRosterItem(
    long cPtr,
    boolean cMemoryOwn
)

Example:

function finalize

inline void finalize()

Example:

function getCPtr

static inline long getCPtr(
    BMXRosterItem obj
)

Public Attributes Documentation

variable swigCPtr

transient long swigCPtr;

Example:


Updated on 2022-01-26 at 17:18:31 +0800

© 2019-2024 美信拓扑 | 官网 | 网站地图 该文件修订时间: 2024-09-26 03:17:35

results matching ""

    No results matching ""