增加私聊风险提示背景,消息预览改为[风险提示]

(cherry picked from commit ec4172bdef671f727e78051bb326a61eccecb689)
This commit is contained in:
huangjian
2021-04-28 10:27:59 +08:00
parent 217f08a622
commit b51412bcc7
4 changed files with 27 additions and 29 deletions

View File

@@ -30,16 +30,6 @@ public class MsgViewHolderChatHint extends MsgViewHolderBase {
tvContent = findViewById(R.id.tv_content); 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 @Override
protected boolean isShowHeadImage() { protected boolean isShowHeadImage() {
return false; return false;

View File

@@ -3,12 +3,14 @@ package com.yizhuan.erban.ui.im.recent;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.OrientationHelper; import androidx.recyclerview.widget.OrientationHelper;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; 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.AssistantAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.CarAttachment; 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.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.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyTipsAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyTipsAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment;
@@ -186,7 +189,7 @@ public class RecentListFragment extends BaseFragment {
AttentionInfo attentionInfo = (AttentionInfo) attentionItem.getData(); AttentionInfo attentionInfo = (AttentionInfo) attentionItem.getData();
if (attentionInfo != null && attentionInfo.getUserInRoom() != null && mContext != null) { if (attentionInfo != null && attentionInfo.getUserInRoom() != null && mContext != null) {
AVRoomActivity.startForFromType(mContext, attentionInfo.getUserInRoom().getUid(), 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) { } catch (Exception ex) {
@@ -225,19 +228,19 @@ public class RecentListFragment extends BaseFragment {
boolean isClicked = (boolean) SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false); boolean isClicked = (boolean) SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false);
flNewbie = mView.findViewById(R.id.fl_newbie); flNewbie = mView.findViewById(R.id.fl_newbie);
ivRedPoint = mView.findViewById(R.id.iv_red_point); ivRedPoint = mView.findViewById(R.id.iv_red_point);
ivRedPoint.setVisibility(isClicked?View.GONE:View.VISIBLE); ivRedPoint.setVisibility(isClicked ? View.GONE : View.VISIBLE);
// 等级限制 // 等级限制
setFindNewbieView(); setFindNewbieView();
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private void setFindNewbieView(){ private void setFindNewbieView() {
// 等级限制 // 等级限制
UserModel.get().getCurrentUserInfo().subscribe(userInfo -> { UserModel.get().getCurrentUserInfo().subscribe(userInfo -> {
if (userInfo != null) { if (userInfo != null) {
UserLevelVo userLevelVo = userInfo.getUserLevelVo(); UserLevelVo userLevelVo = userInfo.getUserLevelVo();
if (userLevelVo != null) { 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; lastClickTime = currTime;
SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新 SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新
ivRedPoint.setVisibility(View.GONE); ivRedPoint.setVisibility(View.GONE);
RoomNewbieActivity.start(getActivity(),false); RoomNewbieActivity.start(getActivity(), false);
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MESSAGE_FINDNEW_CLICK, "消息页_发现萌新"); StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MESSAGE_FINDNEW_CLICK, "消息页_发现萌新");
}); });
} }
@@ -344,7 +347,7 @@ public class RecentListFragment extends BaseFragment {
} else { } else {
HallTeamMessageActivity.start(mContext, recent.getContactId()); HallTeamMessageActivity.start(mContext, recent.getContactId());
} }
} else if (type == 2){ } else if (type == 2) {
if (isInRoom) { if (isInRoom) {
MWTeamRoomMessageAct.start(mContext, recent.getContactId()); MWTeamRoomMessageAct.start(mContext, recent.getContactId());
@@ -464,12 +467,11 @@ public class RecentListFragment extends BaseFragment {
return "[声音瓶子审核消息]"; return "[声音瓶子审核消息]";
} else if (WorldDynamicAttachment.isShareMsg(customAttachment)) { } else if (WorldDynamicAttachment.isShareMsg(customAttachment)) {
return "[分享一条动态]"; return "[分享一条动态]";
}else if (customAttachment.getFirst() == CUSTOM_MSG_RED_PACKAGE){ } else if (customAttachment.getFirst() == CUSTOM_MSG_RED_PACKAGE) {
return "[您收到一个全服红包]"; return "[您收到一个全服红包]";
} else if (customAttachment instanceof ChatHintAttachment) {
return "[风险提示]";
} }
// else if (customAttachment.getFirst() == CUSTOM_MSG_PUSH_NOTIFIFICATION){
// return null;//"[您收到一条邀请信息]";
// }
} else if (attachment instanceof AudioAttachment) { } else if (attachment instanceof AudioAttachment) {
return "[语音]"; return "[语音]";
} }

View File

@@ -7,7 +7,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="48dp" android:layout_marginStart="48dp"
android:layout_marginEnd="48dp" android:layout_marginEnd="48dp"
tools:background="@drawable/shape_f2f2f2_r_10"> android:background="@drawable/shape_f2f2f2_r_10">
<TextView <TextView
android:id="@+id/tv_content" android:id="@+id/tv_content"

View File

@@ -2,9 +2,11 @@ package com.yizhuan.tutu.room_chat.fragment;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
@@ -29,6 +31,7 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.auth.event.LoginEvent; import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
import com.yizhuan.xchat_android_core.im.custom.bean.AssistantAttachment; 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.CarAttachment;
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.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyTipsAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyTipsAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment;
@@ -83,6 +86,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
/** /**
* 房间内私聊显示用的最近聊天列表 * 房间内私聊显示用的最近聊天列表
* 发现萌新 * 发现萌新
*
* @author MadisonRong * @author MadisonRong
*/ */
public class RoomMsgRecentListFragment extends BaseFragment { public class RoomMsgRecentListFragment extends BaseFragment {
@@ -111,19 +115,19 @@ public class RoomMsgRecentListFragment extends BaseFragment {
boolean isClicked = (boolean) SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false); boolean isClicked = (boolean) SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false);
flNewbie = mView.findViewById(R.id.fl_newbie); flNewbie = mView.findViewById(R.id.fl_newbie);
ivRedPoint = mView.findViewById(R.id.iv_red_point); ivRedPoint = mView.findViewById(R.id.iv_red_point);
ivRedPoint.setVisibility(isClicked?View.GONE:View.VISIBLE); ivRedPoint.setVisibility(isClicked ? View.GONE : View.VISIBLE);
// 等级限制 // 等级限制
setFindNewbieView(); setFindNewbieView();
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private void setFindNewbieView(){ private void setFindNewbieView() {
// 等级限制 // 等级限制
UserModel.get().getCurrentUserInfo().subscribe(userInfo -> { UserModel.get().getCurrentUserInfo().subscribe(userInfo -> {
if (userInfo != null) { if (userInfo != null) {
UserLevelVo userLevelVo = userInfo.getUserLevelVo(); UserLevelVo userLevelVo = userInfo.getUserLevelVo();
if (userLevelVo != null) { 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; lastClickTime = currTime;
SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新 SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新
ivRedPoint.setVisibility(View.GONE); ivRedPoint.setVisibility(View.GONE);
RoomNewbieActivity.start(getActivity(),true); RoomNewbieActivity.start(getActivity(), true);
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MESSAGE_FINDNEW_CLICK, "语音房_消息_发现萌新"); StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MESSAGE_FINDNEW_CLICK, "语音房_消息_发现萌新");
}); });
} }
@@ -184,9 +188,9 @@ public class RoomMsgRecentListFragment extends BaseFragment {
public void onSuccess(Integer type) { public void onSuccess(Integer type) {
if (type == 1) { if (type == 1) {
NimHallTeamRoomMessageActivity.start(mContext, recent.getContactId()); NimHallTeamRoomMessageActivity.start(mContext, recent.getContactId());
} else if (type == 0){ } else if (type == 0) {
NimTeamRoomMessageActivity.start(mContext, recent.getContactId()); NimTeamRoomMessageActivity.start(mContext, recent.getContactId());
} else if (type == 2){ } else if (type == 2) {
MWTeamRoomMessageAct.start(mContext, recent.getContactId()); MWTeamRoomMessageAct.start(mContext, recent.getContactId());
} else { } else {
toast("该版本不支持,请下载最新版本"); toast("该版本不支持,请下载最新版本");
@@ -221,9 +225,9 @@ public class RoomMsgRecentListFragment extends BaseFragment {
return ((CarAttachment) attachment).msg; return ((CarAttachment) attachment).msg;
} else if (customAttachment.getFirst() == CUSTOM_MSG_ASSISTANT_MSG) { } else if (customAttachment.getFirst() == CUSTOM_MSG_ASSISTANT_MSG) {
return ((AssistantAttachment) attachment).title; return ((AssistantAttachment) attachment).title;
} else if (customAttachment.getFirst() == CUSTOM_MSG_NEWBIE) { } else if (customAttachment.getFirst() == CUSTOM_MSG_NEWBIE) {
return ((NewbieHelloAttachment) attachment).getNewbieHelloInfo().message; 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()) { switch (customAttachment.getSecond()) {
case CUSTOM_MSG_SHARE_ROOM: case CUSTOM_MSG_SHARE_ROOM:
return "[分享房间]"; return "[分享房间]";
@@ -274,6 +278,8 @@ public class RoomMsgRecentListFragment extends BaseFragment {
return "[您收到一条厅消息]"; return "[您收到一条厅消息]";
} else if (customAttachment instanceof SysMsgVoiceAttachment) { } else if (customAttachment instanceof SysMsgVoiceAttachment) {
return "[声音瓶子审核消息]"; return "[声音瓶子审核消息]";
} else if (customAttachment instanceof ChatHintAttachment) {
return "[风险提示]";
} }
} else if (attachment instanceof AudioAttachment) { } else if (attachment instanceof AudioAttachment) {
return "[语音]"; return "[语音]";