From f742102a605cba8c3be6acd7734dfc1ac6cc7403 Mon Sep 17 00:00:00 2001 From: wushaocheng <15876365887@163.com> Date: Tue, 18 Jul 2023 19:13:28 +0800 Subject: [PATCH] =?UTF-8?q?[Modify]=E5=85=A8=E6=9C=8D=E7=8E=A9=E6=B3=95?= =?UTF-8?q?=E9=A3=98=E5=B1=8F=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erban/avroom/activity/AVRoomActivity.java | 9 +- .../com/yizhuan/erban/base/BaseActivity.java | 93 +++++++++++++++++++ .../dialog_gift_all_service_level_one.xml | 2 +- .../main/res/layout/layout_room_effect.xml | 2 +- .../im/custom/bean/RoomBoxPrizeInfo.java | 14 +++ .../custom/bean/RoomLuckySeaAttachment.java | 4 + 6 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/RoomBoxPrizeInfo.java diff --git a/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java b/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java index 7ef06612d..8363b5ba7 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java +++ b/app/src/main/java/com/yizhuan/erban/avroom/activity/AVRoomActivity.java @@ -131,7 +131,6 @@ import com.yizhuan.xchat_android_core.utils.StringUtils; import com.yizhuan.xchat_android_library.base.factory.CreatePresenter; import com.yizhuan.xchat_android_library.rxbus.RxBus; import com.yizhuan.xchat_android_library.utils.JavaUtil; -import com.yizhuan.xchat_android_library.utils.LogUtil; import com.yizhuan.xchat_android_library.utils.ResUtil; import com.yizhuan.xchat_android_library.utils.SingleToastUtil; import com.yizhuan.xchat_android_library.utils.UIUtils; @@ -1190,6 +1189,14 @@ public class AVRoomActivity extends BaseMvpActivity comparator = new Comparator() { +// @Override +// public int compare(AllServiceGiftProtocol.DataBean s1, AllServiceGiftProtocol.DataBean s2) { +// return JavaUtil.str2int(s1.getLevelNum()) - JavaUtil.str2int(s2.getLevelNum()); +// } +// }; +// //这里就会自动根据规则进行排序 +// Collections.sort(giftList, comparator); if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) { if (giftDialog != null && giftDialog.isShowing()) { // 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个 diff --git a/app/src/main/java/com/yizhuan/erban/base/BaseActivity.java b/app/src/main/java/com/yizhuan/erban/base/BaseActivity.java index c5f53aef8..a353aa684 100644 --- a/app/src/main/java/com/yizhuan/erban/base/BaseActivity.java +++ b/app/src/main/java/com/yizhuan/erban/base/BaseActivity.java @@ -5,8 +5,16 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_OPENNOBLE; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ALL_SERVICE_GIFT; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_BOX; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAIRY; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L5; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_USER_ALL_UPGRADE; @@ -45,6 +53,8 @@ import com.google.gson.Gson; import com.netease.nim.uikit.common.util.log.LogUtil; import com.netease.nimlib.sdk.NIMSDK; import com.netease.nimlib.sdk.Observer; +import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder; +import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage; import com.netease.nimlib.sdk.msg.model.BroadcastMessage; import com.orhanobut.logger.Logger; import com.readystatesoftware.systembartint.SystemBarTintManager; @@ -87,7 +97,15 @@ import com.yizhuan.tutu.mentoring_relationship.dialog.GrabApprenticesNoticeDialo import com.yizhuan.xchat_android_constants.XChatConstants; import com.yizhuan.xchat_android_core.Constants; import com.yizhuan.xchat_android_core.UriProvider; +import com.yizhuan.xchat_android_core.auth.AuthModel; import com.yizhuan.xchat_android_core.bean.BaseProtocol; +import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo; +import com.yizhuan.xchat_android_core.im.custom.bean.FairyMsgAttachment; +import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment; +import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo; +import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaAttachment; +import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean; +import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment; import com.yizhuan.xchat_android_core.manager.AvRoomDataManager; import com.yizhuan.xchat_android_core.manager.IMNetEaseManager; import com.yizhuan.xchat_android_core.manager.RoomEvent; @@ -102,6 +120,7 @@ import com.yizhuan.xchat_android_core.pay.bean.WalletInfo; import com.yizhuan.xchat_android_core.redpackage.RedPackageNotifyInfo; import com.yizhuan.xchat_android_core.room.bean.RoomInfo; import com.yizhuan.xchat_android_core.room.model.AvRoomModel; +import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfo; import com.yizhuan.xchat_android_core.user.UserModel; import com.yizhuan.xchat_android_core.utils.net.RxHelper; import com.yizhuan.xchat_android_core.vip.VipMessageInfo; @@ -127,6 +146,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Objects; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; @@ -937,6 +957,14 @@ public abstract class BaseActivity extends RxAppCompatActivity AllServiceGiftProtocol.DataBean data = JSON.parseObject(String.valueOf(baseProtocol.getData()), AllServiceGiftProtocol.DataBean.class); if (data == null || data.getGiftUrl() == null) return; giftList.add(data); +// Comparator comparator = new Comparator() { +// @Override +// public int compare(AllServiceGiftProtocol.DataBean s1, AllServiceGiftProtocol.DataBean s2) { +// return JavaUtil.str2int(s1.getLevelNum()) - JavaUtil.str2int(s2.getLevelNum()); +// } +// }; +// //这里就会自动根据规则进行排序 +// Collections.sort(giftList, comparator); if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) { if (giftDialog != null && giftDialog.isShowing()) { // 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个 @@ -951,6 +979,71 @@ public abstract class BaseActivity extends RxAppCompatActivity } } break; + case CUSTOM_MSG_BOX://寻爱之旅 + if (!isValid()) return; + if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null) + return; + if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) { + RoomBoxPrizeAttachment roomBoxPrizeAttachment = new RoomBoxPrizeAttachment(CUSTOM_MSG_BOX, CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA); + RoomBoxPrizeInfo roomBoxPrizeBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class); + roomBoxPrizeAttachment.setUid(roomBoxPrizeBean.getUid()); + roomBoxPrizeAttachment.setPrizeName(roomBoxPrizeBean.getPrizeName()); + roomBoxPrizeAttachment.setNick(roomBoxPrizeBean.getNick()); + roomBoxPrizeAttachment.setBoxTypeStr(roomBoxPrizeBean.getBoxTypeStr()); + roomBoxPrizeAttachment.setRoomUid(roomBoxPrizeBean.getRoomUid()); + roomBoxPrizeAttachment.setPrizeNum(roomBoxPrizeBean.getPrizeNum()); + roomBoxPrizeAttachment.setUserLevelLimit(roomBoxPrizeBean.getUserLevelLimit()); + if (AvRoomDataManager.get().isOpenPureMode()) { + // 純凈模式打開後,僅能看跟自己相關的砸蛋消息 + if (Objects.equals(roomBoxPrizeAttachment.getUid(), AuthModel.get().getCurrentUid())) { + ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment); + IMNetEaseManager.get().addMessages(message); + } + } else { + ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment); + IMNetEaseManager.get().addMessages(message); + IMNetEaseManager.get().getChatRoomEventObservable() + .onNext(new RoomEvent() + .setEvent(RoomEvent.BOX_NOTIFY_SVGA) + .setChatRoomMessage(message)); + } + } + break; + case CUSTOM_MSG_LUCKY_SEA://星级厨房 + if (!isValid()) return; + if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null) + return; + if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) { + RoomLuckySeaAttachment attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_LUCKY_SEA, CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL); + attachment.setRoomLuckySeaMsgBean(JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomLuckySeaMsgBean.class)); + ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment); + IMNetEaseManager.get().addMessages(message); + IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY); + } + break; + case CUSTOM_MSG_LUCKY_GIFT://福袋 + if (!isValid()) return; + if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null) + return; + if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) { + RoomReceivedLuckyGiftAttachment attachment = new RoomReceivedLuckyGiftAttachment(CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL); + attachment.setLuckyBagNoticeInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), LuckyBagNoticeInfo.class)); + ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment); + IMNetEaseManager.get().noticeServiceLuckyBagNotice(message); + IMNetEaseManager.get().addMessages(message); + } + break; + case CUSTOM_MSG_FAIRY://夺宝精灵 + if (!isValid()) return; + if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null) + return; + if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_DRAW_GIFT_L5) { + FairyMsgAttachment attachment = new FairyMsgAttachment(CUSTOM_MSG_FAIRY, CUSTOM_MSG_SUB_DRAW_GIFT_L5); + attachment.setFairyMsgInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), FairyMsgInfo.class)); + ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment); + IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.FAIRY_DRAW_GIFT_L5); + } + break; default: break; } diff --git a/app/src/main/res/layout/dialog_gift_all_service_level_one.xml b/app/src/main/res/layout/dialog_gift_all_service_level_one.xml index fd81ea2e0..fa227ba5c 100644 --- a/app/src/main/res/layout/dialog_gift_all_service_level_one.xml +++ b/app/src/main/res/layout/dialog_gift_all_service_level_one.xml @@ -143,7 +143,7 @@ android:layout_width="60dp" android:layout_height="60dp" android:layout_gravity="center" - android:layout_marginStart="@dimen/dp_15" + android:layout_marginStart="@dimen/dp_10" android:layout_marginTop="37dp" android:layout_toEndOf="@+id/receiver_container" /> diff --git a/app/src/main/res/layout/layout_room_effect.xml b/app/src/main/res/layout/layout_room_effect.xml index 7d22ae18a..6bdcbda5e 100644 --- a/app/src/main/res/layout/layout_room_effect.xml +++ b/app/src/main/res/layout/layout_room_effect.xml @@ -42,7 +42,7 @@ android:id="@+id/cl_notify" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="180dp" + android:layout_marginTop="60dp" android:visibility="gone">