diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderChatHint.java b/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderChatHint.java index 7acb0ca8c..afb494be7 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderChatHint.java +++ b/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderChatHint.java @@ -30,16 +30,6 @@ public class MsgViewHolderChatHint extends MsgViewHolderBase { tvContent = findViewById(R.id.tv_content); } - @Override - protected int leftBackground() { - return R.drawable.shape_f2f2f2_r_10; - } - - @Override - protected int rightBackground() { - return R.drawable.shape_f2f2f2_r_10; - } - @Override protected boolean isShowHeadImage() { return false; diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/recent/RecentListFragment.java b/app/src/main/java/com/yizhuan/erban/ui/im/recent/RecentListFragment.java index ced140af4..4ef20b9ca 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/im/recent/RecentListFragment.java +++ b/app/src/main/java/com/yizhuan/erban/ui/im/recent/RecentListFragment.java @@ -3,12 +3,14 @@ package com.yizhuan.erban.ui.im.recent; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; + import androidx.annotation.Nullable; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.OrientationHelper; import androidx.recyclerview.widget.RecyclerView; + import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -51,6 +53,7 @@ import com.yizhuan.xchat_android_core.im.RefreshInRoomListEvent; import com.yizhuan.xchat_android_core.im.custom.bean.AssistantAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.CarAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.CarveUpGoldThirdLevelAttachment; +import com.yizhuan.xchat_android_core.im.custom.bean.ChatHintAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyTipsAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment; @@ -186,7 +189,7 @@ public class RecentListFragment extends BaseFragment { AttentionInfo attentionInfo = (AttentionInfo) attentionItem.getData(); if (attentionInfo != null && attentionInfo.getUserInRoom() != null && mContext != null) { AVRoomActivity.startForFromType(mContext, attentionInfo.getUserInRoom().getUid(), - AVRoomActivity.FROM_TYPE_USER,attentionInfo.getNick(),String.valueOf(attentionInfo.getUid())); + AVRoomActivity.FROM_TYPE_USER, attentionInfo.getNick(), String.valueOf(attentionInfo.getUid())); } } catch (Exception ex) { @@ -225,19 +228,19 @@ public class RecentListFragment extends BaseFragment { boolean isClicked = (boolean) SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false); flNewbie = mView.findViewById(R.id.fl_newbie); ivRedPoint = mView.findViewById(R.id.iv_red_point); - ivRedPoint.setVisibility(isClicked?View.GONE:View.VISIBLE); + ivRedPoint.setVisibility(isClicked ? View.GONE : View.VISIBLE); // 等级限制 setFindNewbieView(); } @SuppressLint("CheckResult") - private void setFindNewbieView(){ + private void setFindNewbieView() { // 等级限制 UserModel.get().getCurrentUserInfo().subscribe(userInfo -> { if (userInfo != null) { UserLevelVo userLevelVo = userInfo.getUserLevelVo(); if (userLevelVo != null) { - flNewbie.setVisibility(userLevelVo.charmLevelSeq >= InitialModel.get().getFindNewbieCharmLevel()?View.VISIBLE:View.GONE); + flNewbie.setVisibility(userLevelVo.charmLevelSeq >= InitialModel.get().getFindNewbieCharmLevel() ? View.VISIBLE : View.GONE); } } }); @@ -286,7 +289,7 @@ public class RecentListFragment extends BaseFragment { lastClickTime = currTime; SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新 ivRedPoint.setVisibility(View.GONE); - RoomNewbieActivity.start(getActivity(),false); + RoomNewbieActivity.start(getActivity(), false); StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MESSAGE_FINDNEW_CLICK, "消息页_发现萌新"); }); } @@ -344,7 +347,7 @@ public class RecentListFragment extends BaseFragment { } else { HallTeamMessageActivity.start(mContext, recent.getContactId()); } - } else if (type == 2){ + } else if (type == 2) { if (isInRoom) { MWTeamRoomMessageAct.start(mContext, recent.getContactId()); @@ -464,12 +467,11 @@ public class RecentListFragment extends BaseFragment { return "[声音瓶子审核消息]"; } else if (WorldDynamicAttachment.isShareMsg(customAttachment)) { return "[分享一条动态]"; - }else if (customAttachment.getFirst() == CUSTOM_MSG_RED_PACKAGE){ + } else if (customAttachment.getFirst() == CUSTOM_MSG_RED_PACKAGE) { return "[您收到一个全服红包]"; + } else if (customAttachment instanceof ChatHintAttachment) { + return "[风险提示]"; } -// else if (customAttachment.getFirst() == CUSTOM_MSG_PUSH_NOTIFIFICATION){ -// return null;//"[您收到一条邀请信息]"; -// } } else if (attachment instanceof AudioAttachment) { return "[语音]"; } diff --git a/app/src/main/res/layout/layout_msg_view_holder_chat_hint.xml b/app/src/main/res/layout/layout_msg_view_holder_chat_hint.xml index d4ad96e91..00b9cba02 100644 --- a/app/src/main/res/layout/layout_msg_view_holder_chat_hint.xml +++ b/app/src/main/res/layout/layout_msg_view_holder_chat_hint.xml @@ -7,7 +7,7 @@ android:layout_gravity="center" android:layout_marginStart="48dp" android:layout_marginEnd="48dp" - tools:background="@drawable/shape_f2f2f2_r_10"> + android:background="@drawable/shape_f2f2f2_r_10"> { if (userInfo != null) { UserLevelVo userLevelVo = userInfo.getUserLevelVo(); if (userLevelVo != null) { - flNewbie.setVisibility(userLevelVo.charmLevelSeq >= InitialModel.get().getFindNewbieCharmLevel()?View.VISIBLE:View.GONE); + flNewbie.setVisibility(userLevelVo.charmLevelSeq >= InitialModel.get().getFindNewbieCharmLevel() ? View.VISIBLE : View.GONE); } } }); @@ -140,7 +144,7 @@ public class RoomMsgRecentListFragment extends BaseFragment { lastClickTime = currTime; SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新 ivRedPoint.setVisibility(View.GONE); - RoomNewbieActivity.start(getActivity(),true); + RoomNewbieActivity.start(getActivity(), true); StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MESSAGE_FINDNEW_CLICK, "语音房_消息_发现萌新"); }); } @@ -184,9 +188,9 @@ public class RoomMsgRecentListFragment extends BaseFragment { public void onSuccess(Integer type) { if (type == 1) { NimHallTeamRoomMessageActivity.start(mContext, recent.getContactId()); - } else if (type == 0){ + } else if (type == 0) { NimTeamRoomMessageActivity.start(mContext, recent.getContactId()); - } else if (type == 2){ + } else if (type == 2) { MWTeamRoomMessageAct.start(mContext, recent.getContactId()); } else { toast("该版本不支持,请下载最新版本"); @@ -221,9 +225,9 @@ public class RoomMsgRecentListFragment extends BaseFragment { return ((CarAttachment) attachment).msg; } else if (customAttachment.getFirst() == CUSTOM_MSG_ASSISTANT_MSG) { return ((AssistantAttachment) attachment).title; - } else if (customAttachment.getFirst() == CUSTOM_MSG_NEWBIE) { + } else if (customAttachment.getFirst() == CUSTOM_MSG_NEWBIE) { return ((NewbieHelloAttachment) attachment).getNewbieHelloInfo().message; - }else if (customAttachment.getFirst() == CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP) { + } else if (customAttachment.getFirst() == CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP) { switch (customAttachment.getSecond()) { case CUSTOM_MSG_SHARE_ROOM: return "[分享房间]"; @@ -274,6 +278,8 @@ public class RoomMsgRecentListFragment extends BaseFragment { return "[您收到一条厅消息]"; } else if (customAttachment instanceof SysMsgVoiceAttachment) { return "[声音瓶子审核消息]"; + } else if (customAttachment instanceof ChatHintAttachment) { + return "[风险提示]"; } } else if (attachment instanceof AudioAttachment) { return "[语音]";