im::floo::floolib::BMXUserProfile
User Profile
Inherits from BMXBaseObject
Public Functions
| Name | |
|---|---|
| BMXUserProfile() | |
| synchronized void | delete() |
| long | userId() User ID (unique) |
| BMXUserProfile.UserCategory | category() User policy |
| String | username() Username (unique) |
| String | nickname() User nickname |
| String | avatarRatelUrl() Ratel server address of user avatar |
| String | avatarUrl() User avatar |
| String | avatarPath() Local storage path of user avatar |
| String | avatarThumbnailPath() Local storage path of user avatar thumbnail |
| String | mobilePhone() User mobile phone |
| String | email() User email |
| String | publicInfo() User public extension information, visible to friends |
| String | privateInfo() User private extension information, not visible to friends |
| BMXUserProfile.AddFriendAuthMode | addFriendAuthMode() How to validate when adding friend |
| BMXUserProfile.AuthQuestion | authQuestion() Authentication questions when adding friend |
| BMXUserProfile.MessageSetting | messageSetting() User message settings |
| boolean | isAutoAcceptGroupInvite() Whether to automatically agree to join group when a group invitation is received |
Protected Functions
| Name | |
|---|---|
| BMXUserProfile(long cPtr, boolean cMemoryOwn) | |
| void | finalize() |
| long | getCPtr(BMXUserProfile obj) |
Public Attributes
| Name | |
|---|---|
| transient long | swigCPtr |
Public Functions Documentation
function BMXUserProfile
inline BMXUserProfile()
Example:
function delete
inline synchronized void delete()
Example:
function userId
inline long userId()
User ID (unique)
Return: int64_t
Example:
String name = profile.username();
if (name.length() > MAX_NAME_LENGTH){
name = name.substring(0,MAX_NAME_LENGTH) + "...";
}
String nickName = profile.nickname();
if (nickName.length() > MAX_NICKNAME_LENGTH){
nickName = nickName.substring(0,MAX_NICKNAME_LENGTH) + "...";
}
// String publicInfo = profile.publicInfo();
ChatUtils.getInstance().showProfileAvatar(profile, mUserIcon, mConfig);
long userId = profile.userId();
mUserName.setText(TextUtils.isEmpty(name) ? "" : getString(R.string.username_colon)+ name);
String finalName = name;
mUserName.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
// 获取TextView的文本
String textToCopy = finalName;
// 创建ClipData对象
ClipData clip = ClipData.newPlainText("text_label", textToCopy);private void initUser(BMXUserProfile profile) {
long id = profile.userId();
mNickname = profile.nickname();
ChatUtils.getInstance().showProfileAvatar(profile, mUserIcon, mConfig);
mUserId.setEndContent(String.valueOf(id));
mSetName.setEndContent(TextUtils.isEmpty(mNickname) ? "" : mNickname);
showBindPhone(profile.mobilePhone());
showRealNameInfo();
String publicInfo = profile.publicInfo();
if (TextUtils.isEmpty(publicInfo)) {
mTvPublic.setVisibility(View.GONE);
mLinePublic.setVisibility(View.GONE);
} else {
mTvPublic.setVisibility(View.VISIBLE);
mLinePublic.setVisibility(View.VISIBLE);
mTvPublic.setText(publicInfo);
}
String privateInfo = profile.privateInfo();
if (TextUtils.isEmpty(privateInfo)) {
mTvPrivate.setVisibility(View.GONE);Log.i(TAG, "onProgressChange profile:" + profile.userId() + "-" + s);
function category
inline BMXUserProfile.UserCategory category()
User policy
Return: [UserCategory]
Example:
function username
inline String username()
Username (unique)
Return: std::string
Example:
private void initUser(BMXUserProfile profile) {
String name = profile.username();
if (name.length() > MAX_NAME_LENGTH){
name = name.substring(0,MAX_NAME_LENGTH) + "...";
}
String nickName = profile.nickname();
if (nickName.length() > MAX_NICKNAME_LENGTH){
nickName = nickName.substring(0,MAX_NICKNAME_LENGTH) + "...";
}
// String publicInfo = profile.publicInfo();
ChatUtils.getInstance().showProfileAvatar(profile, mUserIcon, mConfig);
long userId = profile.userId();
mUserName.setText(TextUtils.isEmpty(name) ? "" : getString(R.string.username_colon)+ name);
String finalName = name;
mUserName.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
// 获取TextView的文本
String textToCopy = finalName;} else {
BMXUserProfile profile = RosterFetcher.getFetcher().getProfile();
if (group) {
//如果是群 需要获取群成员名称
BMXGroup.Member member = GroupManager.getInstance().getMemberByDB(mMaxMessage.conversationId(), mMaxMessage.fromId());
if (member != null && !TextUtils.isEmpty(member.getMGroupNickname())) {
userName = member.getMGroupNickname();
} else if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
} else {
if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
}
if (mIconView != null) { userName = member.getMGroupNickname();
} else if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
} else {
if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
}
if (mIconView != null) {
ChatUtils.getInstance().showProfileAvatar(profile, mIconView, ICON_CONFIG);
}
}
if (mIconView != null) {
boolean finalHideMemberInfo = hideMemberInfo;
mIconView.setOnClickListener(v -> {
function nickname
inline String nickname()
User nickname
Return: std::string
Example:
private void initUser(BMXUserProfile profile) {
String name = profile.username();
if (name.length() > MAX_NAME_LENGTH){
name = name.substring(0,MAX_NAME_LENGTH) + "...";
}
String nickName = profile.nickname();
if (nickName.length() > MAX_NICKNAME_LENGTH){
nickName = nickName.substring(0,MAX_NICKNAME_LENGTH) + "...";
}
// String publicInfo = profile.publicInfo();
ChatUtils.getInstance().showProfileAvatar(profile, mUserIcon, mConfig);
long userId = profile.userId();
mUserName.setText(TextUtils.isEmpty(name) ? "" : getString(R.string.username_colon)+ name);
String finalName = name;
mUserName.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
// 获取TextView的文本
String textToCopy = finalName;private void initUser(BMXUserProfile profile) {
long id = profile.userId();
mNickname = profile.nickname();
ChatUtils.getInstance().showProfileAvatar(profile, mUserIcon, mConfig);
mUserId.setEndContent(String.valueOf(id));
mSetName.setEndContent(TextUtils.isEmpty(mNickname) ? "" : mNickname);
showBindPhone(profile.mobilePhone());
showRealNameInfo();
String publicInfo = profile.publicInfo();
if (TextUtils.isEmpty(publicInfo)) {
mTvPublic.setVisibility(View.GONE);
mLinePublic.setVisibility(View.GONE);
} else {
mTvPublic.setVisibility(View.VISIBLE);
mLinePublic.setVisibility(View.VISIBLE);
mTvPublic.setText(publicInfo);
}
String privateInfo = profile.privateInfo();
if (TextUtils.isEmpty(privateInfo)) {
mTvPrivate.setVisibility(View.GONE); if (mIconView != null) {
ChatUtils.getInstance().showRosterAvatar(item, mIconView, ICON_CONFIG);
}
} else {
BMXUserProfile profile = RosterFetcher.getFetcher().getProfile();
if (group) {
//如果是群 需要获取群成员名称
BMXGroup.Member member = GroupManager.getInstance().getMemberByDB(mMaxMessage.conversationId(), mMaxMessage.fromId());
if (member != null && !TextUtils.isEmpty(member.getMGroupNickname())) {
userName = member.getMGroupNickname();
} else if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
} else {
if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username(); ChatUtils.getInstance().showRosterAvatar(item, mIconView, ICON_CONFIG);
}
} else {
BMXUserProfile profile = RosterFetcher.getFetcher().getProfile();
if (group) {
//如果是群 需要获取群成员名称
BMXGroup.Member member = GroupManager.getInstance().getMemberByDB(mMaxMessage.conversationId(), mMaxMessage.fromId());
if (member != null && !TextUtils.isEmpty(member.getMGroupNickname())) {
userName = member.getMGroupNickname();
} else if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
} else {
if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username(); //如果是群 需要获取群成员名称
BMXGroup.Member member = GroupManager.getInstance().getMemberByDB(mMaxMessage.conversationId(), mMaxMessage.fromId());
if (member != null && !TextUtils.isEmpty(member.getMGroupNickname())) {
userName = member.getMGroupNickname();
} else if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
} else {
if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
}
if (mIconView != null) {
ChatUtils.getInstance().showProfileAvatar(profile, mIconView, ICON_CONFIG);
} BMXGroup.Member member = GroupManager.getInstance().getMemberByDB(mMaxMessage.conversationId(), mMaxMessage.fromId());
if (member != null && !TextUtils.isEmpty(member.getMGroupNickname())) {
userName = member.getMGroupNickname();
} else if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
} else {
if (profile != null && !TextUtils.isEmpty(profile.nickname())) {
userName = profile.nickname();
} else if (profile != null) {
userName = profile.username();
}
}
if (mIconView != null) {
ChatUtils.getInstance().showProfileAvatar(profile, mIconView, ICON_CONFIG);
}
}
if (mIconView != null) {
function avatarRatelUrl
inline String avatarRatelUrl()
Ratel server address of user avatar
Return: std::string
Example:
function avatarUrl
inline String avatarUrl()
User avatar
Return: std::string
Example:
function avatarPath
inline String avatarPath()
Local storage path of user avatar
Return: std::string
Example:
if (profile == null) {
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
if (!TextUtils.isEmpty(profile.avatarThumbnailPath())
&& new File(profile.avatarThumbnailPath()).exists()
&& new File(profile.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + profile.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(profile.avatarPath())
&& new File(profile.avatarPath()).exists()
&& new File(profile.avatarPath()).isFile()) {
avatarUrl = "file://" + profile.avatarPath();
} else {
downloadProfileAvatar(profile, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config); BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
if (!TextUtils.isEmpty(profile.avatarThumbnailPath())
&& new File(profile.avatarThumbnailPath()).exists()
&& new File(profile.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + profile.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(profile.avatarPath())
&& new File(profile.avatarPath()).exists()
&& new File(profile.avatarPath()).isFile()) {
avatarUrl = "file://" + profile.avatarPath();
} else {
downloadProfileAvatar(profile, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config); return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
if (!TextUtils.isEmpty(profile.avatarThumbnailPath())
&& new File(profile.avatarThumbnailPath()).exists()
&& new File(profile.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + profile.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(profile.avatarPath())
&& new File(profile.avatarPath()).exists()
&& new File(profile.avatarPath()).isFile()) {
avatarUrl = "file://" + profile.avatarPath();
} else {
downloadProfileAvatar(profile, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
if (!TextUtils.isEmpty(profile.avatarThumbnailPath())
&& new File(profile.avatarThumbnailPath()).exists()
&& new File(profile.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + profile.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(profile.avatarPath())
&& new File(profile.avatarPath()).exists()
&& new File(profile.avatarPath()).isFile()) {
avatarUrl = "file://" + profile.avatarPath();
} else {
downloadProfileAvatar(profile, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);} else if (!TextUtils.isEmpty(profile.avatarPath())&& new File(profile.avatarPath()).exists()&& new File(profile.avatarPath()).isFile()) {avatarUrl = "file://" + profile.avatarPath();
function avatarThumbnailPath
inline String avatarThumbnailPath()
Local storage path of user avatar thumbnail
Return: std::string
Example:
ImageRequestConfig config) {
if (imageView == null) {
return;
}
if (profile == null) {
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
if (!TextUtils.isEmpty(profile.avatarThumbnailPath())
&& new File(profile.avatarThumbnailPath()).exists()
&& new File(profile.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + profile.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(profile.avatarPath())
&& new File(profile.avatarPath()).exists()
&& new File(profile.avatarPath()).isFile()) {
avatarUrl = "file://" + profile.avatarPath();
} else {
downloadProfileAvatar(profile, imageView, config);if (imageView == null) {
return;
}
if (profile == null) {
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
if (!TextUtils.isEmpty(profile.avatarThumbnailPath())
&& new File(profile.avatarThumbnailPath()).exists()
&& new File(profile.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + profile.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(profile.avatarPath())
&& new File(profile.avatarPath()).exists()
&& new File(profile.avatarPath()).isFile()) {
avatarUrl = "file://" + profile.avatarPath();
} else {
downloadProfileAvatar(profile, imageView, config); return;
}
if (profile == null) {
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
if (!TextUtils.isEmpty(profile.avatarThumbnailPath())
&& new File(profile.avatarThumbnailPath()).exists()
&& new File(profile.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + profile.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(profile.avatarPath())
&& new File(profile.avatarPath()).exists()
&& new File(profile.avatarPath()).isFile()) {
avatarUrl = "file://" + profile.avatarPath();
} else {
downloadProfileAvatar(profile, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);}
if (profile == null) {
BMImageLoader.getInstance().display(imageView, "", config);
return;
}
// 对需要展示的view加入缓存 防止在页面频繁刷新 view复用的时候展示错乱
String avatarUrl = "";
if (!TextUtils.isEmpty(profile.avatarThumbnailPath())
&& new File(profile.avatarThumbnailPath()).exists()
&& new File(profile.avatarThumbnailPath()).isFile()) {
avatarUrl = "file://" + profile.avatarThumbnailPath();
} else if (!TextUtils.isEmpty(profile.avatarPath())
&& new File(profile.avatarPath()).exists()
&& new File(profile.avatarPath()).isFile()) {
avatarUrl = "file://" + profile.avatarPath();
} else {
downloadProfileAvatar(profile, imageView, config);
}
BMImageLoader.getInstance().display(imageView, avatarUrl, config);if (!TextUtils.isEmpty(profile.avatarThumbnailPath())&& new File(profile.avatarThumbnailPath()).exists()&& new File(profile.avatarThumbnailPath()).isFile()) {avatarUrl = "file://" + profile.avatarThumbnailPath();
function mobilePhone
inline String mobilePhone()
User mobile phone
Return: std::string
Example:
private void initUser(BMXUserProfile profile) {
long id = profile.userId();
mNickname = profile.nickname();
ChatUtils.getInstance().showProfileAvatar(profile, mUserIcon, mConfig);
mUserId.setEndContent(String.valueOf(id));
mSetName.setEndContent(TextUtils.isEmpty(mNickname) ? "" : mNickname);
showBindPhone(profile.mobilePhone());
showRealNameInfo();
String publicInfo = profile.publicInfo();
if (TextUtils.isEmpty(publicInfo)) {
mTvPublic.setVisibility(View.GONE);
mLinePublic.setVisibility(View.GONE);
} else {
mTvPublic.setVisibility(View.VISIBLE);
mLinePublic.setVisibility(View.VISIBLE);
mTvPublic.setText(publicInfo);
}
String privateInfo = profile.privateInfo();
if (TextUtils.isEmpty(privateInfo)) {
mTvPrivate.setVisibility(View.GONE);
function email
inline String email()
User email
Return: std::string
Example:
function publicInfo
inline String publicInfo()
User public extension information, visible to friends
Return: JSON(std::string)
Example:
private void initUser(BMXUserProfile profile) {
long id = profile.userId();
mNickname = profile.nickname();
ChatUtils.getInstance().showProfileAvatar(profile, mUserIcon, mConfig);
mUserId.setEndContent(String.valueOf(id));
mSetName.setEndContent(TextUtils.isEmpty(mNickname) ? "" : mNickname);
showBindPhone(profile.mobilePhone());
showRealNameInfo();
String publicInfo = profile.publicInfo();
if (TextUtils.isEmpty(publicInfo)) {
mTvPublic.setVisibility(View.GONE);
mLinePublic.setVisibility(View.GONE);
} else {
mTvPublic.setVisibility(View.VISIBLE);
mLinePublic.setVisibility(View.VISIBLE);
mTvPublic.setText(publicInfo);
}
String privateInfo = profile.privateInfo();
if (TextUtils.isEmpty(privateInfo)) {
mTvPrivate.setVisibility(View.GONE);
function privateInfo
inline String privateInfo()
User private extension information, not visible to friends
Return: JSON(std::string)
Example:
showRealNameInfo();
String publicInfo = profile.publicInfo();
if (TextUtils.isEmpty(publicInfo)) {
mTvPublic.setVisibility(View.GONE);
mLinePublic.setVisibility(View.GONE);
} else {
mTvPublic.setVisibility(View.VISIBLE);
mLinePublic.setVisibility(View.VISIBLE);
mTvPublic.setText(publicInfo);
}
String privateInfo = profile.privateInfo();
if (TextUtils.isEmpty(privateInfo)) {
mTvPrivate.setVisibility(View.GONE);
mLinePrivate.setVisibility(View.GONE);
} else {
mTvPrivate.setVisibility(View.VISIBLE);
mLinePrivate.setVisibility(View.VISIBLE);
mTvPrivate.setText(privateInfo);
}
function addFriendAuthMode
inline BMXUserProfile.AddFriendAuthMode addFriendAuthMode()
How to validate when adding friend
Return: [AddFriendAuthMode]
Example:
String privateInfo = profile.privateInfo();
if (TextUtils.isEmpty(privateInfo)) {
mTvPrivate.setVisibility(View.GONE);
mLinePrivate.setVisibility(View.GONE);
} else {
mTvPrivate.setVisibility(View.VISIBLE);
mLinePrivate.setVisibility(View.VISIBLE);
mTvPrivate.setText(privateInfo);
}
BMXUserProfile.AddFriendAuthMode mode = profile.addFriendAuthMode();
bindAddFriendAuth("", mode);
bindAddFriendAuthQuestion(profile.authQuestion());
showBindWeChat();
function authQuestion
inline BMXUserProfile.AuthQuestion authQuestion()
Authentication questions when adding friend
Return: AuthQuestion
Example:
mTvPrivate.setVisibility(View.GONE);
mLinePrivate.setVisibility(View.GONE);
} else {
mTvPrivate.setVisibility(View.VISIBLE);
mLinePrivate.setVisibility(View.VISIBLE);
mTvPrivate.setText(privateInfo);
}
BMXUserProfile.AddFriendAuthMode mode = profile.addFriendAuthMode();
bindAddFriendAuth("", mode);
bindAddFriendAuthQuestion(profile.authQuestion());
showBindWeChat();
function messageSetting
inline BMXUserProfile.MessageSetting messageSetting()
User message settings
Return: MessageSetting
Example:
// 给用户反馈
Toast.makeText(getActivity().getApplicationContext(), getString(R.string.copied_to_clipboard) + textToCopy, Toast.LENGTH_SHORT).show();
return true; // 返回true表示事件已消费
}
});
// mUserPubInfo.setText(getString(R.string.personalized_signature) + (TextUtils.isEmpty(publicInfo) ? getString(R.string.welcome_to_set_your_signature) : publicInfo));
// push
BMXUserProfile.MessageSetting setting = profile.messageSetting();
boolean isPush = setting != null && setting.getMPushEnabled();
boolean isPushDetail = setting != null && setting.getMPushDetail();
boolean isPushSound = setting != null && setting.getMNotificationSound();
boolean isPushVibrate = setting != null && setting.getMNotificationVibrate();
mSettingPush.setCheckStatus(isPush);
mPushDetail.setCheckStatus(isPushDetail);
if (isPush) {
mPushSoundView.setVisibility(View.VISIBLE);
mPushVibrateView.setVisibility(View.VISIBLE);
function isAutoAcceptGroupInvite
inline boolean isAutoAcceptGroupInvite()
Whether to automatically agree to join group when a group invitation is received
Return: bool
Protected Functions Documentation
Example:
mPushVibrateView.setVisibility(View.GONE);
}
boolean isAutoDownload = setting != null && setting.getMAutoDownloadAttachment();
autoDownloadAttachment.setCheckStatus(isAutoDownload);
String pushName = setting != null && !TextUtils.isEmpty(setting.getMPushNickname())
? setting.getMPushNickname()
: "";
mPushName.setEndContent(pushName);
autoAcceptGroupInvite.setCheckStatus(profile.isAutoAcceptGroupInvite());
// 是否多端提示 默认false
boolean tips = SharePreferenceUtils.getInstance().getDevTips();
otherDevTips.setCheckStatus(tips);
function BMXUserProfile
inline BMXUserProfile(
long cPtr,
boolean cMemoryOwn
)
Example:
function finalize
inline void finalize()
Example:
function getCPtr
static inline long getCPtr(
BMXUserProfile obj
)
Public Attributes Documentation
variable swigCPtr
transient long swigCPtr;
Example:
Updated on 2022-01-26 at 17:18:31 +0800
