From 328b42f3ccdccf32e035d68f672deb3cb9a96cf9 Mon Sep 17 00:00:00 2001 From: oujunhui <313127320@qq.com> Date: Fri, 11 Sep 2020 17:16:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=8E=B0=E8=90=8C=E6=96=B0-=E6=89=93?= =?UTF-8?q?=E6=8B=9B=E5=91=BC-=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yizhuan/erban/MainActivity.java | 3 ++ .../yizhuan/erban/base/BaseMvpActivity.java | 7 ++- .../erban/ui/im/chat/MsgViewHolderHello.java | 50 +++++++++++++++++++ .../erban/ui/im/chat/MsgViewHolderNoti.java | 8 --- .../ui/im/recent/RecentListFragment.java | 19 ++++++- .../layout/layout_msg_view_holder_hello.xml | 17 +++++++ .../adapter/RoomMsgRecentViewHolder.java | 6 +++ .../fragment/RoomMsgRecentListFragment.java | 13 ++++- .../manager/IMMessageManager.java | 5 +- .../newbie/NewbieHelloInfo.java | 1 + 10 files changed, 114 insertions(+), 15 deletions(-) create mode 100644 app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderHello.java delete mode 100644 app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderNoti.java create mode 100644 app/src/main/res/layout/layout_msg_view_holder_hello.xml diff --git a/app/src/main/java/com/yizhuan/erban/MainActivity.java b/app/src/main/java/com/yizhuan/erban/MainActivity.java index 5982ce9b4..047f32cd9 100644 --- a/app/src/main/java/com/yizhuan/erban/MainActivity.java +++ b/app/src/main/java/com/yizhuan/erban/MainActivity.java @@ -93,6 +93,7 @@ import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity; import com.yizhuan.erban.ui.im.chat.MsgViewHolderAudioParty; import com.yizhuan.erban.ui.im.chat.MsgViewHolderContent; import com.yizhuan.erban.ui.im.chat.MsgViewHolderGift; +import com.yizhuan.erban.ui.im.chat.MsgViewHolderHello; import com.yizhuan.erban.ui.im.chat.MsgViewHolderLevel; import com.yizhuan.erban.ui.im.chat.MsgViewHolderLottery; import com.yizhuan.erban.ui.im.chat.MsgViewHolderOnline; @@ -143,6 +144,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.LevelUpAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.LotteryAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyAttachment; 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.NobleAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.NoticeAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.OpenRoomNotiAttachment; @@ -393,6 +395,7 @@ public class MainActivity extends BaseMvpActivity NimUIKit.registerMsgItemViewHolder(GiftAttachment.class, MsgViewHolderGift.class); NimUIKit.registerMsgItemViewHolder(NoticeAttachment.class, MsgViewHolderContent.class); NimUIKit.registerMsgItemViewHolder(RedPacketAttachment.class, MsgViewHolderRedPacket.class); + NimUIKit.registerMsgItemViewHolder(NewbieHelloAttachment.class, MsgViewHolderHello.class); NimUIKit.registerMsgItemViewHolder(LotteryAttachment.class, MsgViewHolderLottery.class); NimUIKit.registerMsgItemViewHolder(NobleAttachment.class, MsgViewHolderText.class); NimUIKit.registerMsgItemViewHolder(CarAttachment.class, MsgViewHolderText.class); diff --git a/app/src/main/java/com/yizhuan/erban/base/BaseMvpActivity.java b/app/src/main/java/com/yizhuan/erban/base/BaseMvpActivity.java index 198d2d395..0175a0bb7 100644 --- a/app/src/main/java/com/yizhuan/erban/base/BaseMvpActivity.java +++ b/app/src/main/java/com/yizhuan/erban/base/BaseMvpActivity.java @@ -1138,15 +1138,14 @@ public abstract class BaseMvpActivity RoomNewbieActivity.start(getActivity(),false)); + flNewbie.setOnClickListener(v -> { + SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新 + ivRedPoint.setVisibility(View.GONE); + RoomNewbieActivity.start(getActivity(),false); + }); } @Override @@ -356,6 +371,8 @@ public class RecentListFragment 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) { + return ((NewbieHelloAttachment) attachment).getNewbieHelloInfo().message; } else if (customAttachment.getFirst() == CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP) { switch (customAttachment.getSecond()) { case CUSTOM_MSG_SHARE_ROOM: diff --git a/app/src/main/res/layout/layout_msg_view_holder_hello.xml b/app/src/main/res/layout/layout_msg_view_holder_hello.xml new file mode 100644 index 000000000..349f2b1a4 --- /dev/null +++ b/app/src/main/res/layout/layout_msg_view_holder_hello.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/app/src/module_room_chat/java/com/yizhuan/tutu/room_chat/adapter/RoomMsgRecentViewHolder.java b/app/src/module_room_chat/java/com/yizhuan/tutu/room_chat/adapter/RoomMsgRecentViewHolder.java index c61781bf7..4cb0260ae 100644 --- a/app/src/module_room_chat/java/com/yizhuan/tutu/room_chat/adapter/RoomMsgRecentViewHolder.java +++ b/app/src/module_room_chat/java/com/yizhuan/tutu/room_chat/adapter/RoomMsgRecentViewHolder.java @@ -30,6 +30,7 @@ import com.yizhuan.erban.ui.im.recent.RecentContactsFragment; import com.yizhuan.erban.ui.im.recent.adapter.RecentContactAdapter; import com.yizhuan.xchat_android_core.im.custom.bean.AssistantAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment; +import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment; import java.util.ArrayList; import java.util.List; @@ -278,6 +279,11 @@ public abstract class RoomMsgRecentViewHolder extends RecyclerViewHolder RoomNewbieActivity.start(getActivity(),true)); + flNewbie.setOnClickListener(v -> { + SharedPreferenceUtils.put(share_pref_is_newbie_clicked, true);// 是否第一次点击发现萌新 + ivRedPoint.setVisibility(View.GONE); + RoomNewbieActivity.start(getActivity(),false); + }); } @Override diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/manager/IMMessageManager.java b/core/src/main/java/com/yizhuan/xchat_android_core/manager/IMMessageManager.java index c0abdb418..930fa4ce5 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/manager/IMMessageManager.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/manager/IMMessageManager.java @@ -159,7 +159,10 @@ public class IMMessageManager { NewbieHelloAttachment newbieHelloAttachment = (NewbieHelloAttachment) msg.getAttachment(); NewbieHelloInfo helloInfo = newbieHelloAttachment.getNewbieHelloInfo(); if (attachment.getSecond() == CUSTOM_MSG_RECEIV_NEWBIE_HELLO) { - EventBus.getDefault().post(new NewbieHelloDialogEvent(helloInfo)); + String uid = String.valueOf(AuthModel.get().getCurrentUid()); + if (!(Objects.equals(uid, String.valueOf(helloInfo.getUid())))){ + EventBus.getDefault().post(new NewbieHelloDialogEvent(helloInfo)); + } } break; diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/newbie/NewbieHelloInfo.java b/core/src/main/java/com/yizhuan/xchat_android_core/newbie/NewbieHelloInfo.java index fb77cb666..c7a37662a 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/newbie/NewbieHelloInfo.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/newbie/NewbieHelloInfo.java @@ -9,4 +9,5 @@ public class NewbieHelloInfo { public int gender; public String message; public long inRoomUid; + public String uid; }