[BugFix]修改测试提的bug

This commit is contained in:
wushaocheng
2023-07-19 20:16:50 +08:00
parent 2ef89535d5
commit fcf9f65984
15 changed files with 795 additions and 59 deletions

View File

@@ -2,10 +2,17 @@ package com.yizhuan.erban.avroom.activity;
import static android.view.View.VISIBLE;
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_GIFT_SERVER_NOTIFY;
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_ROOM_PK;
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_ROOM_PK_NOTIFY;
import android.annotation.SuppressLint;
@@ -90,6 +97,11 @@ import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
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.RoomPKAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
@@ -123,6 +135,7 @@ import com.yizhuan.xchat_android_core.room.event.RoomTaskTipsEvent;
import com.yizhuan.xchat_android_core.room.pk.event.PKStateEvent;
import com.yizhuan.xchat_android_core.super_admin.util.SAdminOptUtil;
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfo;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.FirstChargeInfo;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
@@ -146,6 +159,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import io.reactivex.Single;
@@ -1211,8 +1225,44 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
}
}
break;
case CUSTOM_MSG_LUCKY_GIFT:
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY) {
case CUSTOM_MSG_BOX://寻爱之旅
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 (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 (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY || baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
RoomReceivedLuckyGiftAttachment attachment = new RoomReceivedLuckyGiftAttachment(CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY);
attachment.setLuckyBagNoticeInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), LuckyBagNoticeInfo.class));
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
@@ -1220,6 +1270,14 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
IMNetEaseManager.get().addMessages(message);
}
break;
case CUSTOM_MSG_FAIRY://夺宝精灵
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;
case CUSTOM_MSG_ROOM_PK:
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_ROOM_PK_NOTIFY) {
RoomPKAttachment attachment = new RoomPKAttachment(CUSTOM_MSG_SUB_ROOM_PK_NOTIFY);

View File

@@ -53,8 +53,6 @@ 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;
@@ -78,6 +76,7 @@ import com.yizhuan.erban.common.permission.PermissionActivity;
import com.yizhuan.erban.common.widget.StatusLayout;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.common.widget.dialog.DialogUiHelper;
import com.yizhuan.erban.treasure_box.activity.TreasureBoxActivity;
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
import com.yizhuan.erban.ui.login.LoginCodeActivity;
@@ -86,6 +85,7 @@ import com.yizhuan.erban.ui.pay.ChargeActivity;
import com.yizhuan.erban.ui.setting.ResetPasswordActivity;
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
import com.yizhuan.erban.ui.widget.DefaultToolBar;
import com.yizhuan.erban.ui.widget.dialog.AllPlayEffectDialog;
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftDialog;
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftLevelOneDialog;
import com.yizhuan.erban.ui.widget.dialog.AllServiceGiftLevelThreeDialog;
@@ -97,15 +97,11 @@ 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.PlayEffectInfo;
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;
@@ -146,7 +142,6 @@ 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;
@@ -180,6 +175,9 @@ public abstract class BaseActivity extends RxAppCompatActivity
private Dialog giftDialog;
private LinkedList<AllServiceGiftProtocol.DataBean> giftList;
private Dialog playEffectDialog;
private LinkedList<PlayEffectInfo> playEffectList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -542,7 +540,9 @@ public abstract class BaseActivity extends RxAppCompatActivity
if (giftList != null) {
giftList.clear();
}
if(playEffectList != null){
playEffectList.clear();
}
}
@Override
@@ -981,67 +981,114 @@ public abstract class BaseActivity extends RxAppCompatActivity
break;
case CUSTOM_MSG_BOX://寻爱之旅
if (!isValid()) return;
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
RoomBoxPrizeInfo roomBoxPrizeInfo = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
if (roomBoxPrizeInfo == 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);
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
playEffectInfo.setRoomBoxPrizeInfo(roomBoxPrizeInfo);
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} 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));
showPlayEffectDialog();
}
}
break;
case CUSTOM_MSG_LUCKY_SEA://星级厨房
if (!isValid()) return;
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
RoomLuckySeaMsgBean roomLuckySeaMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomLuckySeaMsgBean.class);
if (roomLuckySeaMsgBean == 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);
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);
playEffectInfo.setRoomLuckySeaMsgBean(roomLuckySeaMsgBean);
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
case CUSTOM_MSG_LUCKY_GIFT://福袋
if (!isValid()) return;
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
LuckyBagNoticeInfo luckyBagNoticeInfo = JSON.parseObject(String.valueOf(baseProtocol.getData()), LuckyBagNoticeInfo.class);
if (luckyBagNoticeInfo == 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);
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL);
playEffectInfo.setLuckyBagNoticeInfo(luckyBagNoticeInfo);
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
case CUSTOM_MSG_FAIRY://夺宝精灵
if (!isValid()) return;
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|| this instanceof TreasureBoxActivity || UserUtils.getUserInfo() == null)
return;
if (playEffectList == null) {
playEffectList = new LinkedList<>();
}
FairyMsgInfo fairyMsgInfo = JSON.parseObject(String.valueOf(baseProtocol.getData()), FairyMsgInfo.class);
if (fairyMsgInfo == 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);
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
playEffectInfo.setSecond(CUSTOM_MSG_SUB_DRAW_GIFT_L5);
playEffectInfo.setFairyMsgInfo(fairyMsgInfo);
playEffectList.add(playEffectInfo);
if (playEffectDialog != null && playEffectDialog.isShowing()) {
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
return;
} else {
playEffectDialog.dismiss();
}
} else {
showPlayEffectDialog();
}
}
break;
default:
@@ -1049,6 +1096,27 @@ public abstract class BaseActivity extends RxAppCompatActivity
}
}
private void showPlayEffectDialog() {
if (playEffectList.size() == 0) return;
playEffectDialog = new AllPlayEffectDialog(this, playEffectList.peekFirst());
playEffectDialog.setOnDismissListener(dialog -> {
playEffectList.pollFirst();
PlayEffectInfo dataBean = playEffectList.peekFirst();
if (dataBean != null) {
if (isValid()) {
showPlayEffectDialog();
} else {
playEffectList.clear();
}
}
});
try {
playEffectDialog.show();
} catch (Exception e) {
e.printStackTrace();
}
}
private void showGiftDialog() {
if (giftList.size() == 0) return;
if (giftList.peekFirst() != null && !giftList.peekFirst().isHomeShow()) return;

View File

@@ -14,6 +14,7 @@ import com.yizhuan.erban.ui.pay.ChargeActivity
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
import com.yizhuan.xchat_android_core.Constants
import com.yizhuan.xchat_android_core.UriProvider
import com.yizhuan.xchat_android_core.earn.bean.RoomTypeInfo
import com.yizhuan.xchat_android_library.common.util.DeviceUtil
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil
@@ -26,6 +27,7 @@ class EarnRecordActivity : BaseViewBindingActivity<ActivityEarnRecordBinding>(),
View.OnClickListener {
private val earnRecordModel: EarnRecordViewModel by viewModels()
private var roomTypeInfo: RoomTypeInfo ?= null
companion object {
@JvmStatic
@@ -61,14 +63,13 @@ class EarnRecordActivity : BaseViewBindingActivity<ActivityEarnRecordBinding>(),
if (it.roomType == 4) {
binding.csGoldBg.visibility = View.GONE
}
roomTypeInfo = it
binding.tvDiamondNum.text = String.format(it.diamonds.toString())
binding.tvGoldNum.text = String.format(it.golds.toString())
if (it.isClanElder) {
binding.tvGoldDetail.visibility = View.VISIBLE
binding.csGoldBg.background =
ContextCompat.getDrawable(this, R.drawable.bg_gold_detail)
} else {
binding.tvGoldDetail.visibility = View.GONE
binding.csGoldBg.background =
ContextCompat.getDrawable(this, R.drawable.bg_earn_gold)
}
@@ -107,7 +108,11 @@ class EarnRecordActivity : BaseViewBindingActivity<ActivityEarnRecordBinding>(),
CommonWebViewActivity.start(context, UriProvider.getDiamondDetail())
}
R.id.tvGoldDetail -> {//金币明细
GoldDetailActivity.start(this)
if(roomTypeInfo?.isClanElder == true) {
GoldDetailActivity.start(this)
} else {
CommonWebViewActivity.start(context, UriProvider.getGoldDetail())
}
}
R.id.tvConvertDiamond -> {//兑换钻石
earnRecordModel.getGoldToDiamondInfo()

View File

@@ -0,0 +1,406 @@
package com.yizhuan.erban.ui.widget.dialog;
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_GIFT_SERVER_ALL;
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 android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGADynamicEntity;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.common.svga.SimpleSvgaCallback;
import com.yizhuan.erban.databinding.DialogAllPlayEffectBinding;
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
import com.yizhuan.erban.utils.SpannableBuilder;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.PlayEffectInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfo;
import com.yizhuan.xchat_android_library.utils.ResUtil;
public class AllPlayEffectDialog extends BaseDialog {
private final PlayEffectInfo playEffectInfo;
private DialogAllPlayEffectBinding binding;
public AllPlayEffectDialog(Context context, @NonNull PlayEffectInfo playEffectInfo) {
super(context, R.style.FullScreenDialog);
this.playEffectInfo = playEffectInfo;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
binding = DialogAllPlayEffectBinding.inflate(LayoutInflater.from(getContext()));
setContentView(binding.getRoot());
setCancelable(true);
setCanceledOnTouchOutside(true);
Window window = getWindow();
if (window != null) {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
WindowManager.LayoutParams windowParams = window.getAttributes();
windowParams.width = WindowManager.LayoutParams.MATCH_PARENT;
windowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
windowParams.dimAmount = 0.0f;
windowParams.gravity = Gravity.TOP;
windowParams.x = 0;
windowParams.y = 0;
window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
window.setAttributes(windowParams);
window.setWindowAnimations(R.style.anim_left);
}
if (playEffectInfo.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
showBoxNotifyBySVGA(playEffectInfo.getRoomBoxPrizeInfo());
} else if (playEffectInfo.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
showLuckySeaNotifyBySVGA(playEffectInfo.getRoomLuckySeaMsgBean());
} else if (playEffectInfo.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
showLuckyBagNotify(playEffectInfo.getLuckyBagNoticeInfo());
} else if(playEffectInfo.getSecond() == CUSTOM_MSG_SUB_DRAW_GIFT_L5){
showFairyNotifyBySVGA(playEffectInfo.getFairyMsgInfo());
}
}
private void showBoxNotifyBySVGA(RoomBoxPrizeInfo roomBoxPrizeInfo) {
SpannableBuilder text = new SpannableBuilder()
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_011),
new ForegroundColorSpan(Color.WHITE)
)
.append(
roomBoxPrizeInfo.getNick() + " ",
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.treasure_in_find_love) + ResUtil.getString(
R.string.avroom_widget_roomeffectview_013
), new ForegroundColorSpan(Color.WHITE)
)
.append(
roomBoxPrizeInfo.getPrizeName(),
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_00EAFF))
);
if (roomBoxPrizeInfo.getPrizeNum() > 1) {
text.append("x" + roomBoxPrizeInfo.getPrizeNum(), new ForegroundColorSpan(Color.WHITE));
}
SVGAImageView svgaImageView = new SVGAImageView(getContext());
svgaImageView.setLoops(1);
svgaImageView.setClearsAfterDetached(true);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
svgaImageView.setLayoutParams(params);
svgaImageView.setCallback(new SimpleSvgaCallback() {
@Override
public void onFinished() {
closeSelf();
}
});
binding.flSvgaNotify.addView(svgaImageView);
try {
SVGAParser.Companion.shareParser().decodeFromAssets("svga/box_notify.svga", new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
TextPaint textPaint = new TextPaint();
textPaint.setColor(Color.WHITE);//字体颜色
textPaint.setTextSize(24);//字体大小
dynamicEntity.setDynamicText(new StaticLayout(
text.build(),
0,
text.build().length(),
textPaint,
0,
Layout.Alignment.ALIGN_CENTER,
1.0f,
0.0f,
false
), "noble_text_tx");
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
svgaImageView.setImageDrawable(drawable);
svgaImageView.stepToFrame(0, true);
}
@Override
public void onError() {
closeSelf();
}
}, null);
} catch (Exception e) {
e.printStackTrace();
closeSelf();
}
}
private void showLuckySeaNotifyBySVGA(RoomLuckySeaMsgBean roomLuckySeaMsgBean) {
SpannableBuilder text = new SpannableBuilder()
.append(
ResUtil.getString(R.string.congratulation),
new ForegroundColorSpan(Color.WHITE)
)
.append(
roomLuckySeaMsgBean.getNick() + " ",
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.in_the_star_kitchen_draw),
new ForegroundColorSpan(Color.WHITE)
)
.append(
String.valueOf(roomLuckySeaMsgBean.getItemMultiple()),
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_00EAFF))
)
.append(
ResUtil.getString(R.string.times_reward_get),
new ForegroundColorSpan(Color.WHITE)
)
.append(
String.valueOf(roomLuckySeaMsgBean.getDiamonds()),
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_00EAFF))
)
.append(
ResUtil.getString(R.string.diamond_point),
new ForegroundColorSpan(Color.WHITE)
);
SVGAImageView svgaImageView = new SVGAImageView(getContext());
svgaImageView.setLoops(1);
svgaImageView.setClearsAfterDetached(true);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
svgaImageView.setLayoutParams(params);
svgaImageView.setCallback(new SimpleSvgaCallback() {
@Override
public void onFinished() {
closeSelf();
}
});
binding.flSvgaNotify.addView(svgaImageView);
try {
SVGAParser.Companion.shareParser().decodeFromAssets("svga/lucky_sea_notify.svga", new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
TextPaint textPaint = new TextPaint();
textPaint.setColor(Color.WHITE);//字体颜色
textPaint.setTextSize(24);//字体大小
dynamicEntity.setDynamicText(new StaticLayout(
text.build(),
0,
text.build().length(),
textPaint,
0,
Layout.Alignment.ALIGN_CENTER,
1.0f,
0.0f,
false
), "noble_text_tx");
svgaImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!TextUtils.isEmpty(roomLuckySeaMsgBean.getSkipUrl())) {
CommonWebViewActivity.start(getContext(), roomLuckySeaMsgBean.getSkipUrl());
}
}
});
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
svgaImageView.setImageDrawable(drawable);
svgaImageView.stepToFrame(0, true);
}
@Override
public void onError() {
closeSelf();
}
}, null);
} catch (Exception e) {
e.printStackTrace();
closeSelf();
}
}
private void showLuckyBagNotify(LuckyBagNoticeInfo luckyBagNoticeInfo) {
SpannableBuilder text = new SpannableBuilder()
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_04),
new ForegroundColorSpan(Color.WHITE)
)
.append(
subAndReplaceDot(luckyBagNoticeInfo.getNick(), 6) + " ",
new ForegroundColorSpan(ContextCompat.getColor(getContext(),R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_05),
new ForegroundColorSpan(Color.WHITE)
)
.append(
luckyBagNoticeInfo.getLuckyBagName() + " ",
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_06),
new ForegroundColorSpan(Color.WHITE)
)
.append(
luckyBagNoticeInfo.getGoldPrice() + " ",
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
)
.append(
ResUtil.getString(R.string.avroom_widget_roomeffectview_07),
new ForegroundColorSpan(Color.WHITE)
)
.append(
luckyBagNoticeInfo.getGiftName(),
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.notice_nick))
);
SVGAImageView svgaImageView = new SVGAImageView(getContext());
svgaImageView.setLoops(1);
svgaImageView.setClearsAfterDetached(true);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
svgaImageView.setLayoutParams(params);
svgaImageView.setCallback(new SimpleSvgaCallback() {
@Override
public void onFinished() {
closeSelf();
}
});
binding.flSvgaNotify.addView(svgaImageView);
try {
SVGAParser.Companion.shareParser().decodeFromAssets("svga/lucky_gift_notify.svga", new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
TextPaint textPaint = new TextPaint();
textPaint.setColor(Color.WHITE);//字体颜色
textPaint.setTextSize(24);//字体大小
dynamicEntity.setDynamicText(new StaticLayout(
text.build(),
0,
text.build().length(),
textPaint,
0,
Layout.Alignment.ALIGN_CENTER,
1.0f,
0.0f,
false
), "fdpp_copywriting");
svgaImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//跳轉房間要移除監聽,不然可能NPE
svgaImageView.setCallback(null);
AVRoomActivity.start(getContext(), luckyBagNoticeInfo.getRoomUid());
}
});
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
svgaImageView.setImageDrawable(drawable);
svgaImageView.stepToFrame(0, true);
}
@Override
public void onError() {
closeSelf();
}
}, null);
} catch (Exception e) {
e.printStackTrace();
closeSelf();
}
}
private void showFairyNotifyBySVGA(FairyMsgInfo fairyMsgInfo) {
SpannableBuilder text = new SpannableBuilder()
.append("好運爆棚!", new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_8C4700)))
.append(
subAndReplaceDot(fairyMsgInfo.getNick(), 6) + " ",
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_EC4613))
)
.append(" 在奪寶精靈中獲得 ", new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_8C4700)))
.append(
fairyMsgInfo.getRewardName(),
new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_EC4613))
);
SVGAImageView svgaImageView = new SVGAImageView(getContext());
svgaImageView.setLoops(1);
svgaImageView.setClearsAfterDetached(true);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
svgaImageView.setLayoutParams(params);
svgaImageView.setCallback(new SimpleSvgaCallback() {
@Override
public void onFinished() {
closeSelf();
}
});
binding.flSvgaNotify.addView(svgaImageView);
try {
SVGAParser.Companion.shareParser().decodeFromAssets("svga/all_fairy.svga", new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@NonNull SVGAVideoEntity svgaVideoEntity) {
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
TextPaint textPaint = new TextPaint();
textPaint.setColor(Color.WHITE);//字体颜色
textPaint.setTextSize(24);//字体大小
dynamicEntity.setDynamicText(new StaticLayout(
text.build(),
0,
text.build().length(),
textPaint,
0,
Layout.Alignment.ALIGN_CENTER,
1.0f,
0.0f,
false
), "touming_text_name");
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
svgaImageView.setImageDrawable(drawable);
svgaImageView.stepToFrame(0, true);
}
@Override
public void onError() {
closeSelf();
}
}, null);
} catch (Exception e) {
e.printStackTrace();
closeSelf();
}
}
private String subAndReplaceDot(String nick, int maxLength) {
if(nick.length() > maxLength){
return nick.substring(0,maxLength)+"...";
}else {
return nick;
}
}
private void closeSelf() {
try {
dismiss();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -32,6 +32,7 @@ import com.yizhuan.erban.common.EmptyViewHelper
import com.yizhuan.erban.databinding.ActivityVipMainBinding
import com.yizhuan.erban.ui.pay.BillingManager
import com.yizhuan.erban.ui.pay.BillingManager.BillingUpdatesListener
import com.yizhuan.erban.ui.pay.ChargeActivity
import com.yizhuan.erban.ui.setting.ModifyPwdActivity
import com.yizhuan.erban.ui.utils.RVDelegate
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
@@ -52,6 +53,7 @@ import com.yizhuan.xchat_android_core.utils.toast
import com.yizhuan.xchat_android_core.vip.VipAuthInfo
import com.yizhuan.xchat_android_core.vip.VipInfo
import com.yizhuan.xchat_android_core.vip.VipOpenEvent
import com.yizhuan.xchat_android_library.common.util.DeviceUtil
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
import org.greenrobot.eventbus.EventBus
@@ -249,6 +251,18 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
buyProduct(charge.skuDetails)
}
}
setOnChargeClick {
if (AppMetaDataUtil.getChannelID().equals(Constants.GOOGLE)) {
ChargeActivity.start(this@VipMainActivity)
} else {
CommonWebViewActivity.start(
this@VipMainActivity, UriProvider.getOfficialPay(
4,
DeviceUtil.getDeviceId(this@VipMainActivity)
)
)
}
}
}
.show(context)
} else {
@@ -261,6 +275,18 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
setOnDiamondChargeClick {
vipViewModel.openVipWithDiamond()
}
setOnChargeClick {
if (AppMetaDataUtil.getChannelID().equals(Constants.GOOGLE)) {
ChargeActivity.start(this@VipMainActivity)
} else {
CommonWebViewActivity.start(
this@VipMainActivity, UriProvider.getOfficialPay(
4,
DeviceUtil.getDeviceId(this@VipMainActivity)
)
)
}
}
}
.show(context)
}

View File

@@ -9,12 +9,15 @@ import android.view.View
import android.view.WindowManager
import androidx.core.graphics.toColorInt
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseDialog
import com.yizhuan.erban.databinding.DialogSelectPayTypeBinding
import com.yizhuan.erban.ui.widget.dialog.CommonTipDialog
import com.yizhuan.erban.utils.SpannableBuilder
import com.yizhuan.xchat_android_core.pay.PayModel
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo
import com.yizhuan.xchat_android_library.utils.FormatUtils
import com.yizhuan.xchat_android_library.utils.ResUtil
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
/**
@@ -35,6 +38,10 @@ class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
private var onGoogleChargeClick: (() -> Unit)? = null
private var onChargeClick: (() -> Unit)? = null
private var walletInfo: WalletInfo? = null
companion object {
@JvmStatic
fun newInstance(
@@ -60,6 +67,10 @@ class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
this.onGoogleChargeClick = onGoogleChargeClick
}
fun setOnChargeClick(onChargeClick: (() -> Unit)) {
this.onChargeClick = onChargeClick
}
override fun onStart() {
width = WindowManager.LayoutParams.MATCH_PARENT
gravity = Gravity.BOTTOM
@@ -79,7 +90,24 @@ class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
binding.tvConfirmPay.setOnClickListener {
if (binding.rbDiamond.isChecked) {
onDiamondChargeClick?.invoke()
if (binding.tvDiamondNum.text.toString().toInt() > FormatUtils.formatBigInteger(
walletInfo?.diamondNum ?: 0.0
).toInt()
) {
val tipDialog = CommonTipDialog(context)
tipDialog.setTipMsg(ResUtil.getString(R.string.Diamond_balance_is_insufficient))
tipDialog.setOkText(getString(R.string.charge))
tipDialog.setOnActionListener(
object : CommonTipDialog.OnActionListener {
override fun onOk() {
onChargeClick?.invoke()
}
}
)
tipDialog.show()
} else {
onDiamondChargeClick?.invoke()
}
} else {
onGoogleChargeClick?.invoke()
}
@@ -107,6 +135,7 @@ class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
* defaultPay 1默认支付宝2默认微信
*/
private fun setWalletData(walletInfo: WalletInfo) {
this.walletInfo = walletInfo
val states = arrayOf(intArrayOf(android.R.attr.state_enabled))
val colors = intArrayOf("#8A8CAB".toColorInt())
binding.rbDiamond.text = SpannableBuilder()

View File

@@ -167,8 +167,8 @@
android:layout_marginBottom="6dp"
android:drawablePadding="@dimen/space_normal"
android:ellipsize="end"
android:maxLength="20"
android:maxLines="1"
android:maxEms="10"
android:lines="1"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_18"
android:textStyle="bold"

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cl_notify"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp">
<FrameLayout
android:id="@+id/fl_svga_notify"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="75:11"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -667,5 +667,7 @@
<color name="color_FFE694">#FFE694</color>
<color name="color_EB547C">#EB547C</color>
<color name="color_FFE785">#FFE785</color>
<color name="color_8C4700">#8C4700</color>
<color name="color_EC4613">#EC4613</color>
</resources>

View File

@@ -5089,5 +5089,6 @@
<string name="open">開啓</string>
<string name="get">獲得</string>
<string name="start_week">周星榜</string>
<string name="Diamond_balance_is_insufficient">鉆石余額不足,是否充值</string>
</resources>

View File

@@ -208,7 +208,11 @@
android:text="@string/layout_activity_module_hall_05"
android:textColor="@color/white"
android:textSize="18sp"
android:visibility="visible" />
android:visibility="visible"
android:ellipsize="end"
android:lines="1"
android:maxEms="10"
tools:text="测试测试测试测试测试测试"/>
<ImageView
android:id="@+id/iv_setting"
@@ -228,7 +232,8 @@
android:text="@string/layout_activity_module_hall_06"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
android:visibility="gone" />
android:visibility="gone"
tools:visibility="visible"/>
</RelativeLayout>

View File

@@ -1,5 +1,15 @@
package com.yizhuan.erban.treasure_box.activity;
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_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_GIFT_SERVER_NOTIFY;
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_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 android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
@@ -18,8 +28,11 @@ import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.base.BaseBindingActivity;
import com.yizhuan.erban.databinding.ActivityTreasureBoxBinding;
@@ -30,12 +43,22 @@ import com.yizhuan.erban.utils.UserUtils;
import com.yizhuan.treasure_box.bean.PrizeNewInfo;
import com.yizhuan.treasure_box.model.BoxModel;
import com.yizhuan.xchat_android_core.DemoCache;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
import com.yizhuan.xchat_android_core.exception.FailReasonException;
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;
import com.yizhuan.xchat_android_core.pay.PayModel;
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfo;
import com.yizhuan.xchat_android_core.utils.StringUtils;
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
import com.yizhuan.xchat_android_library.common.util.SoftKeyboardStateHelper;
@@ -45,6 +68,7 @@ import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper;
import java.util.ArrayList;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
@@ -287,6 +311,78 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
});
}
/**
* 接收到全局广播信息
*
* @param body 信息实体
*/
protected void onReceivedNimBroadcastMessage(String body) {
BaseProtocol baseProtocol;
try {
baseProtocol = JSON.parseObject(body, BaseProtocol.class);
} catch (Exception e) {
baseProtocol = null;
}
if (baseProtocol == null) return;
switch (baseProtocol.getFirst()) {
case CUSTOM_MSG_BOX://寻爱之旅
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 (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 (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY || baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
RoomReceivedLuckyGiftAttachment attachment = new RoomReceivedLuckyGiftAttachment(CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY);
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 (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;
}
}
@Override
protected boolean needSteepStateBar() {
return true;

View File

@@ -526,6 +526,13 @@ public class UriProvider {
return JAVA_WEB_URL.concat("peko/modules/myincome/index.html#/DiamondLog");
}
/**
* 金币明细
*/
public static String getGoldDetail() {
return JAVA_WEB_URL.concat("peko/modules/myincome/index.html#/GoldLog");
}
/**
* 提现记录
*/

View File

@@ -0,0 +1,15 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfo;
import lombok.Data;
@Data
public class PlayEffectInfo {
private int second;
private RoomBoxPrizeInfo roomBoxPrizeInfo;
private RoomLuckySeaMsgBean roomLuckySeaMsgBean;
private LuckyBagNoticeInfo luckyBagNoticeInfo;
private FairyMsgInfo fairyMsgInfo;
}

View File

@@ -47,7 +47,7 @@ import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
public final class RxNetManager {
private static final int DEFAULT_READ_TIME_OUT = 60000;
private static final int DEFAULT_WRITE_TIME_OUT = 60000;
private static final int DEFAULT_CONNECT_TIME_OUT = 30000;
private static final int DEFAULT_CONNECT_TIME_OUT = 60000;
private OkHttpClient mOkHttpClient;
private OkHttpClient.Builder mBuilder;
@@ -115,7 +115,7 @@ public final class RxNetManager {
}
public static OkHttpClient.Builder enableTls12OnPreLollipop(OkHttpClient.Builder client) {
if (Build.VERSION.SDK_INT >= 16 && Build.VERSION.SDK_INT < 22) {
if (Build.VERSION.SDK_INT < 22) {
try {
SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, null, null);