系统用户过滤

This commit is contained in:
huangjian
2023-03-17 17:13:33 +08:00
parent e807dab42f
commit fb4aeba530
19 changed files with 146 additions and 91 deletions

View File

@@ -833,13 +833,11 @@
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.nnbc123.app.treasure_box.activity.TreasureBoxActivity"
android:theme="@style/dialog_web_view_activity" />
android:theme="@style/dialog_web_view_activity_dim_false" />
<activity
android:name="com.nnbc123.app.treasure_box.activity.BoxRankingActivity"
android:theme="@style/room_message_activity" />
<activity
android:name="com.nnbc123.app.treasure_box.activity.TreasureBoxHonourActivity"
android:theme="@style/dialog_web_view_activity" />
android:theme="@style/dialog_web_view_activity_dim_false" />
<activity android:name="com.nnbc123.app.ui.setting.VerifyPhoneActivity" />
<activity android:name="com.nnbc123.app.ui.setting.ModifyPwdActivity" />

View File

@@ -889,8 +889,7 @@ public class MessageView extends FrameLayout {
setBoxMeMsg(chatRoomMessage, tvContent);
} else if (first == CustomAttachment.CUSTOM_MSG_RADISH) {
setRadishMeMsg(chatRoomMessage, tvContent);
}
else if (first == CUSTOM_MSG_KITCHEN) {
} else if (first == CUSTOM_MSG_KITCHEN) {
setKitchenMsg(chatRoomMessage, tvContent);
} else if (first == CustomAttachment.CUSTOM_MSG_KTV) {
setKtvMsg(chatRoomMessage, tvContent);
@@ -1014,7 +1013,8 @@ public class MessageView extends FrameLayout {
if (giftCompoundAttachment.getSecond() == CUSTOM_MSG_SUB_GIFT_COMPOUND) {
GiftCompoundMsgBean msgInfo = giftCompoundAttachment.getMsgBean();
SpannableBuilder text = new SpannableBuilder(tvContent);
text.append(
text.append("恭喜", new ForegroundColorSpan(whiteColor))
.append(
msgInfo.getNick(),
new ForegroundColorSpan(roomTipNickColor),
new OriginalDrawStatusClickSpan() {

View File

@@ -714,11 +714,12 @@ class RoomEffectView @JvmOverloads constructor(
private fun showGiftCompoundNotify(chatRoomMessage: ChatRoomMessage) {
val msgBean = (chatRoomMessage.attachment as GiftCompoundAttachment).msgBean
val text = SpannableBuilder()
.append("恭喜", ForegroundColorSpan(Color.WHITE))
.append(
msgBean.nick.subAndReplaceDot(7) + " ",
msgBean.nick.subAndReplaceDot(7) + "",
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
)
.append(msgBean.msg + " ", ForegroundColorSpan(Color.WHITE))
.append(msgBean.msg + "", ForegroundColorSpan(Color.WHITE))
.append(
msgBean.giftName,
ForegroundColorSpan(resources.getColor(R.color.notice_nick))

View File

@@ -1,5 +1,6 @@
package com.nnbc123.app.home.adapter
import android.text.TextUtils
import android.view.View
import android.widget.ImageView
import androidx.core.view.isGone
@@ -9,7 +10,6 @@ import com.nnbc123.app.R
import com.nnbc123.app.ui.utils.ImageLoadUtilsV2
import com.nnbc123.app.ui.utils.load
import com.nnbc123.core.home.bean.HomeRoomInfo
import com.nnbc123.core.utils.TextUtils
class RoomCommonAdapter :
@@ -21,10 +21,13 @@ class RoomCommonAdapter :
setText(R.id.tv_online_number, "${item.onlineNum}")
setText(R.id.tv_room_title, item.title)
}
helper.setVisible(R.id.tv_in_pk, item.isCrossPking)
helper.setVisible(R.id.iv_room_tag, !TextUtils.isEmptyText(item.tagPict))
helper.setGone(R.id.tv_in_pk, item.isCrossPking)
helper.setGone(R.id.iv_room_tag, !TextUtils.isEmpty(item.tagPict))
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_room_tag), item.tagPict)
helper.setGone(R.id.tv_tag_content, !TextUtils.isEmpty(item.iconContent))
.setText(R.id.tv_tag_content, item.iconContent)
helper.getView<View>(R.id.view_bg).setBackgroundResource(
when (helper.layoutPosition % 3) {
0 -> R.drawable.bg_home_common_item0

View File

@@ -9,13 +9,16 @@ import com.chad.library.adapter.base.BaseViewHolder
import com.nnbc123.app.R
import com.nnbc123.app.avroom.activity.AVRoomActivity
import com.nnbc123.app.ui.im.avtivity.NimP2PMessageActivity
import com.nnbc123.app.ui.user.UserInfoActivity
import com.nnbc123.app.ui.utils.loadAvatar
import com.nnbc123.app.ui.utils.loadFromAssets
import com.nnbc123.app.vip.VipHelper
import com.nnbc123.core.user.bean.UserInfo
import com.nnbc123.core.utils.CurrentTimeUtils
import com.nnbc123.core.utils.StarUtils
import com.nnbc123.core.utils.ifNullOrEmpty
import com.opensource.svgaplayer.SVGAImageView
import java.util.*
class RoomNewFriendsAdapter :
@@ -29,7 +32,10 @@ class RoomNewFriendsAdapter :
R.id.tv_age,
((CurrentTimeUtils.getCurrentTime() - item.birth) / 1000 / 60 / 60 / 24 / 365).toString()
)
//设置星座
val star = StarUtils.getConstellation(Date(item.birth))
helper.setGone(R.id.tv_constellation, star != null)
.setText(R.id.tv_constellation, star)
helper.setBackgroundRes(
R.id.ll_gender_age,
if (item.gender == 1) R.drawable.shape_65d3f7_corner else R.drawable.shape_ff9cce_corner
@@ -59,6 +65,10 @@ class RoomNewFriendsAdapter :
}
}
helper.getView<View>(R.id.iv_avatar).setOnClickListener {
UserInfoActivity.Companion.start(mContext, item.uid)
}
val tvNickname = helper.getView<TextView>(R.id.tv_nickname)
tvNickname.text = item.nick
VipHelper.loadVipNickColor(tvNickname, item.userVipInfoVO, "#282828")

View File

@@ -62,6 +62,7 @@ import com.nnbc123.core.im.custom.bean.SysMsgAttachment;
import com.nnbc123.core.im.custom.bean.SysMsgV2Attachment;
import com.nnbc123.core.miniworld.bean.OpenAudioPartyAttachment;
import com.nnbc123.core.public_chat_hall.attachment.AitMeAttachment;
import com.nnbc123.core.utils.SystemUidUtil;
import java.util.ArrayList;
@@ -79,13 +80,14 @@ public class ImInitHelper {
@Override
public void onAvatarClick(Context context, String account) {
if (SystemUidUtil.isSystemUid(account)) return;
UserInfoActivity.Companion.start(context, Long.parseLong(account));
}
};
private final SessionEventListener listener = new SessionEventListener() {
@Override
public void onAvatarClicked(Context context, IMMessage message) {
if (message == null) return;
if (message == null || SystemUidUtil.isSystemUid(message.getFromAccount())) return;
UserInfoActivity.Companion.start(context, Long.parseLong(message.getFromAccount()));
}
@@ -108,7 +110,7 @@ public class ImInitHelper {
initTeamSessionCustomization();
}
public void unInit(){
public void unInit() {
NimUIKit.setSessionListener(null);
NimUIKit.setContactEventListener(null);
}

View File

@@ -414,21 +414,6 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
MessageFragment fragment = new MessageFragment();
fragment.setArguments(arguments);
fragment.setContainerId(R.id.message_fragment_container);
// 等级限制:官方小秘书 和 系统消息,不设置等级限制
if (!SystemUidUtil.isSystemUid(sessionId)) {
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
if (userInfo != null) {
UserLevelVo userLevelVo = userInfo.getUserLevelVo();
if (userLevelVo != null) {
fragment.setCurrentLevel(userLevelVo.experLevelSeq);
}
}
InitInfo initInfo = InitialModel.get().getCacheInitInfo();
if (initInfo != null) {
fragment.setLimitLevel(initInfo.getPrivateChatLevelNo());
}
}
return fragment;
}

View File

@@ -1,9 +1,12 @@
package com.nnbc123.app.ui.im.recent.holder;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import android.annotation.SuppressLint;
import android.graphics.drawable.AnimationDrawable;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import com.netease.nim.uikit.api.NimUIKit;
@@ -15,21 +18,18 @@ import com.netease.nim.uikit.common.ui.recyclerview.holder.BaseViewHolder;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.RecentContact;
import com.nnbc123.app.R;
import com.nnbc123.app.ui.utils.ImageLoadUtils;
import com.nnbc123.app.vip.VipHelper;
import com.nnbc123.core.level.UserLevelVo;
import com.nnbc123.core.user.UserModel;
import com.nnbc123.core.user.bean.UserInfo;
import com.nnbc123.core.utils.SystemUidUtil;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
/**
* @author Administrator
*/
public class CommonRecentViewHolder extends RecentViewHolder {
private UserInfo userInfo;
public CommonRecentViewHolder(BaseQuickAdapter adapter) {
super(adapter);
}
@@ -114,13 +114,10 @@ public class CommonRecentViewHolder extends RecentViewHolder {
if (o instanceof String && o.equals("0")) {
imgUnreadExplosion.setImageResource(R.drawable.explosion);
imgUnreadExplosion.setVisibility(VISIBLE);
new Handler().post(new Runnable() {
@Override
public void run() {
new Handler().post(() -> {
((AnimationDrawable) imgUnreadExplosion.getDrawable()).start();
// 解决部分手机动画无法播放的问题(例如华为荣耀)
getAdapter().notifyItemChanged(getAdapter().getViewHolderPosition(position));
}
});
}
} else {
@@ -136,22 +133,34 @@ public class CommonRecentViewHolder extends RecentViewHolder {
if (recent == null) return;
String contactId = recent.getContactId();
//去除小秘书,系统消息
if (SystemUidUtil.isSystemUid(contactId) ) {
if (SystemUidUtil.isSystemUid(contactId)) {
ivUserGender.setVisibility(GONE);
ivVipIcon.setVisibility(GONE);
return;
}
if (userInfo != null && userInfo.getUid() == Long.parseLong(contactId)) {
setupUserInfo(userInfo);
} else {
UserModel.get()
.getUserInfo(Long.parseLong(contactId))
.subscribe(userInfo -> {
if (userInfo.getUid() != Long.parseLong(contactId)) return;
setupUserInfo(userInfo);
this.userInfo = userInfo;
});
}
}
private void setupUserInfo(UserInfo userInfo) {
ivUserGender.setVisibility(VISIBLE);
if (userInfo.getGender() == 1) {
ivUserGender.setImageResource(R.drawable.ic_gender_male);
} else {
ivUserGender.setImageResource(R.drawable.ic_gender_female);
}
VipHelper.loadVipIcon(ivVipIcon,userInfo.getUserVipInfoVO());
VipHelper.loadVipNickColor(tvNickname, userInfo.getUserVipInfoVO(),"#FF333333");
});
VipHelper.loadVipIcon(ivVipIcon, userInfo.getUserVipInfoVO());
VipHelper.loadVipNickColor(tvNickname, userInfo.getUserVipInfoVO(), "#FF333333");
}
}

View File

@@ -280,7 +280,7 @@
<com.nnbc123.library.widget.DrawableCenterTextView
android:id="@+id/tv_new_filter"
android:layout_width="65dp"
android:layout_width="53dp"
android:layout_height="23dp"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="15dp"

View File

@@ -57,22 +57,47 @@
android:textColor="@color/text_primary"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/iv_room_tag"
app:layout_constraintBottom_toTopOf="@id/ll_tag"
app:layout_constraintStart_toEndOf="@id/iv_room_image"
app:layout_constraintTop_toTopOf="@id/view_bg"
app:layout_constraintVertical_chainStyle="packed"
tools:text="余生点唱歌曲交友房间" />
<LinearLayout
android:id="@+id/ll_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@id/ll_avatar"
app:layout_constraintStart_toStartOf="@id/tv_room_title"
app:layout_constraintTop_toBottomOf="@id/tv_room_title">
<ImageView
android:id="@+id/iv_room_tag"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:layout_marginTop="6dp"
app:layout_constraintBottom_toTopOf="@id/ll_avatar"
app:layout_constraintStart_toStartOf="@id/tv_room_title"
app:layout_constraintTop_toBottomOf="@id/tv_room_title"
android:layout_marginEnd="5dp"
tools:src="@drawable/tag_101" />
<TextView
android:id="@+id/tv_tag_content"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:background="@drawable/shape_home_room_tag"
android:gravity="center"
android:includeFontPadding="false"
android:maxLength="5"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="@color/white"
android:textSize="11dp"
android:visibility="gone"
tools:text="我是"
tools:visibility="visible" />
</LinearLayout>
<TextView
android:id="@+id/tv_online_number"
android:layout_width="wrap_content"
@@ -81,7 +106,6 @@
android:drawableStart="@drawable/ic_home_hot_hot"
android:drawablePadding="2dp"
android:gravity="bottom"
android:includeFontPadding="false"
android:textColor="@color/color_333333"
android:textSize="12sp"
@@ -99,7 +123,7 @@
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@id/view_bg"
app:layout_constraintStart_toStartOf="@id/tv_room_title"
app:layout_constraintTop_toBottomOf="@id/iv_room_tag">
app:layout_constraintTop_toBottomOf="@id/ll_tag">
<com.nnbc123.app.common.widget.CircleImageView
android:id="@+id/iv_avatar_0"

View File

@@ -102,12 +102,12 @@
android:layout_marginStart="5dp"
android:background="@drawable/shape_f6f7f9_corner"
android:gravity="center"
android:text="巨蟹座"
android:textColor="#ffb3b5c4"
android:textSize="10dp"
app:layout_constraintBottom_toBottomOf="@id/ll_gender_age"
app:layout_constraintStart_toEndOf="@id/ll_gender_age"
app:layout_constraintTop_toTopOf="@id/ll_gender_age" />
app:layout_constraintTop_toTopOf="@id/ll_gender_age"
tools:text="巨蟹座" />
<TextView
android:id="@+id/tv_desc"

View File

@@ -117,7 +117,7 @@
<string name="message_contact">联系人</string>
<string name="friend">好友</string>
<string name="attention">关注</string>
<string name="no_frenids_text">你还没有添加任何好友哦! \n快去添加好友吧!</string>
<string name="no_frenids_text">你还没有添加任何好友哦!</string>
<string name="no_fan_text">你还没有任何音萌粉丝哦!</string>
<string name="bind_your_alipay">请先绑定您的支付宝帐号</string>
<string name="my_jewel">我的钻石余额</string>
@@ -155,7 +155,7 @@
<string name="my_attention">我的关注</string>
<string name="my_fan">我的粉丝</string>
<string name="no_attention_text">你还没有关注任何音萌好友哦! \n快去添加关注吧!</string>
<string name="no_attention_text">你还没有关注任何音萌好友哦!</string>
<string name="search_hint">搜索昵称或ID</string>
<string name="online">在线中…</string>
<string name="me_customer_server">客服</string>
@@ -613,7 +613,7 @@
<string name="hint_modify_voice">录制声音</string>
<string name="label_common_close">关闭</string>
<string name="tips_no_recent_contact">你还没有聊天记录哦!\n快去和好友聊天吧!</string>
<string name="tips_no_recent_contact">你还没有聊天记录哦!</string>
<string name="empty_family_text">未加入家族</string>
<string name="room_manager_edit_desc">请点击设置编辑房间话题</string>

View File

@@ -184,6 +184,12 @@
<item name="android:windowExitAnimation">@anim/anim_bottom_out</item>
</style>
<style name="dialog_web_view_activity_dim_false" parent="dialog_web_view_activity">
<!--背景是否模糊显示-->
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="FullScreenDialog" parent="@android:style/Theme.Dialog">
<!--<item name="android:windowBackground">@drawable/filled_activity_bg</item>-->

View File

@@ -106,7 +106,6 @@ public class RoomMsgFansListFragment extends BaseFragment {
FansInfo fansInfo = (FansInfo) adapter1.getItem(position);
if (fansInfo != null) {
if ( SystemUidUtil.isSystemUid(String.valueOf(fansInfo.getUid())) ) {
return;
}
NimRoomP2PMessageActivity.start(getActivity(), String.valueOf(fansInfo.getUid()));

View File

@@ -43,11 +43,21 @@ public class HomeRoomInfo implements MultiItemEntity, Serializable {
private boolean needOpenSelfRoom;
private boolean isChecked;
private String iconContent;
@Override
public int getItemType() {
return isBanner ? TYPE_BANNER : (!TextUtils.isEmpty(broadMsg) ? TYPE_BROADCAST : TYPE_ROOM);
}
public String getIconContent() {
return iconContent;
}
public void setIconContent(String iconContent) {
this.iconContent = iconContent;
}
//<editor-fold defaultstate="collapsed" desc="delombok">
@SuppressWarnings("all")
public HomeRoomInfo() {

View File

@@ -189,6 +189,7 @@ public class InitInfo implements Serializable {
private double hideCarEffectGiftPrice;
private int linearlyPoolOpenLevel;
private List<String> officialMsgUids;
private List<String> officialAccountUids;
private boolean twelveStarSwitch;
//<editor-fold defaultstate="collapsed" desc="delombok">
@@ -196,6 +197,14 @@ public class InitInfo implements Serializable {
public InitInfo() {
}
public List<String> getOfficialAccountUids() {
return officialAccountUids;
}
public void setOfficialAccountUids(List<String> officialAccountUids) {
this.officialAccountUids = officialAccountUids;
}
@SuppressWarnings("all")
public FaceComponent getFaceJson() {
return this.faceJson;

View File

@@ -119,12 +119,7 @@ public class PayModel extends BaseModel implements IPayModel {
if (jsonObject == null) return;
WalletInfo walletInfo = new WalletInfo();
walletInfo.setUid(jsonObject.getLong("uid"));
walletInfo.setDepositNum(jsonObject.getIntValue("depositNum"));
walletInfo.setDiamondNum(jsonObject.getLong("diamonds"));
walletInfo.setGoldNum(jsonObject.getIntValue("golds"));
walletInfo.setCrystals(jsonObject.getDoubleValue("crystals"));
walletInfo.nobleGoldNum = jsonObject.getDoubleValue("nobleGoldNum");
walletInfo.chargeGoldNum = jsonObject.getDoubleValue("chargeGoldNum");
walletInfo.setDiamondNum(jsonObject.getDoubleValue("diamonds"));
this.walletInfo = walletInfo;
// 兼容新版
setWalletInfo(walletInfo);

View File

@@ -17,8 +17,12 @@ public class SystemUidUtil {
initInfo.getOfficialMsgUids().contains(uid)) {
return true;
}
return XChatConstants.SECRETARY_UID.equals(uid)
|| XChatConstants.SYSTEM_MESSAGE_UID.equals(uid)
|| XChatConstants.MATCH_UID.equals(uid);
if (initInfo != null &&
!ListUtils.isListEmpty(initInfo.getOfficialAccountUids()) &&
initInfo.getOfficialAccountUids().contains(uid)) {
return true;
}
return false;
}
}