修改拍卖房结构,目前修改到拍卖者上麦下麦
This commit is contained in:
@@ -43,12 +43,14 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
private int type;//1:房间点击进入的;2:打赏进入的
|
||||
private List<RoonGiftModel> giftList=new ArrayList<>();
|
||||
private List<GiftPackBean> giftPackList=new ArrayList<>();
|
||||
private String roomId;
|
||||
|
||||
public static GiftTwoDetailsFragment newInstance(String id,int type) {
|
||||
public static GiftTwoDetailsFragment newInstance(String id,int type,String roomId) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString("id", id);
|
||||
args.putInt("type", type);
|
||||
args.putString("roomId", roomId);
|
||||
GiftTwoDetailsFragment fragment = new GiftTwoDetailsFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
@@ -59,6 +61,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
super.initArgs(arguments);
|
||||
id = arguments.getString("id");
|
||||
type = arguments.getInt("type");
|
||||
roomId = arguments.getString("roomId");
|
||||
|
||||
}
|
||||
@Override
|
||||
@@ -78,9 +81,9 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
MvpPre.giftPack();
|
||||
}else {
|
||||
if (type==0) {
|
||||
MvpPre.getGiftList("0", type);
|
||||
MvpPre.getGiftList("0", type, roomId);
|
||||
}else {
|
||||
MvpPre.getGiftList(id, type);
|
||||
MvpPre.getGiftList(id, type, roomId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ public class GiftBean {
|
||||
private int number;
|
||||
private String createtime;
|
||||
private String nickname;
|
||||
private String count;
|
||||
private int count;
|
||||
private String user_id;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xscm.moduleutil.bean;
|
||||
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||
import com.xscm.moduleutil.bean.room.FriendInfo;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
@@ -86,6 +87,8 @@ public class RoomMessageEvent {
|
||||
private long time_day;
|
||||
|
||||
private int online_number;//在线人数
|
||||
|
||||
private BlindBoxBean.XlhData xlh_Data;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -30,7 +30,7 @@ public class BlindBoxBean {
|
||||
}
|
||||
|
||||
public boolean isXlhDataObject() {
|
||||
return xlh_data instanceof JsonObject || xlh_data instanceof XlhData;
|
||||
return xlh_data instanceof JsonObject || xlh_data instanceof Map || xlh_data instanceof XlhData;
|
||||
}
|
||||
|
||||
public List<XlhData> getXlhDataAsList() {
|
||||
@@ -43,7 +43,77 @@ public class BlindBoxBean {
|
||||
|
||||
public XlhData getXlhDataAsObject() {
|
||||
if (isXlhDataObject()) {
|
||||
return (XlhData) xlh_data;
|
||||
// 如果已经是XlhData类型,直接返回
|
||||
if (xlh_data instanceof XlhData) {
|
||||
return (XlhData) xlh_data;
|
||||
}
|
||||
// 如果是Map类型(Gson解析后的LinkedTreeMap),手动转换
|
||||
else if (xlh_data instanceof Map) {
|
||||
Map<String, Object> map = (Map<String, Object>) xlh_data;
|
||||
XlhData xlhData = new XlhData();
|
||||
|
||||
// 安全地转换各个字段
|
||||
Object waitingStartNum = map.get("waiting_start_num");
|
||||
if (waitingStartNum != null) {
|
||||
xlhData.setWaiting_start_num(waitingStartNum.toString());
|
||||
}
|
||||
|
||||
Object startNum = map.get("start_num");
|
||||
if (startNum != null) {
|
||||
xlhData.setStart_num(startNum.toString());
|
||||
}
|
||||
|
||||
Object currentNum = map.get("current_num");
|
||||
if (currentNum != null) {
|
||||
if (currentNum instanceof Number) {
|
||||
xlhData.setCurrent_num(((Number) currentNum).intValue());
|
||||
} else {
|
||||
try {
|
||||
xlhData.setCurrent_num(Integer.parseInt(currentNum.toString()));
|
||||
} catch (NumberFormatException e) {
|
||||
xlhData.setCurrent_num(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object status = map.get("status");
|
||||
if (status != null) {
|
||||
if (status instanceof Number) {
|
||||
xlhData.setStatus(((Number) status).intValue());
|
||||
} else {
|
||||
try {
|
||||
xlhData.setStatus(Integer.parseInt(status.toString()));
|
||||
} catch (NumberFormatException e) {
|
||||
xlhData.setStatus(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xlhData;
|
||||
}
|
||||
// 如果是JsonObject,也需要转换
|
||||
else if (xlh_data instanceof JsonObject) {
|
||||
JsonObject jsonObject = (JsonObject) xlh_data;
|
||||
XlhData xlhData = new XlhData();
|
||||
|
||||
if (jsonObject.has("waiting_start_num")) {
|
||||
xlhData.setWaiting_start_num(jsonObject.get("waiting_start_num").getAsString());
|
||||
}
|
||||
|
||||
if (jsonObject.has("start_num")) {
|
||||
xlhData.setStart_num(jsonObject.get("start_num").getAsString());
|
||||
}
|
||||
|
||||
if (jsonObject.has("current_num")) {
|
||||
xlhData.setCurrent_num(jsonObject.get("current_num").getAsInt());
|
||||
}
|
||||
|
||||
if (jsonObject.has("status")) {
|
||||
xlhData.setStatus(jsonObject.get("status").getAsInt());
|
||||
}
|
||||
|
||||
return xlhData;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,10 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
public static final int QXRoomMessageTypeHeartDidChanged = 1054;
|
||||
/// 小黑屋有人退出房间
|
||||
public static final int QXRoomMessageTypeHeartDid = 1055;
|
||||
///盲盒抽奖进度条
|
||||
public static final int QXRoomMessageTypeMangH = 1056;
|
||||
///巡乐会
|
||||
public static final int QXRoomMessageTypeXlh = 1057;
|
||||
private RoomMessageEvent emMessage;
|
||||
|
||||
private int custom = 0;
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||
@@ -37,6 +38,10 @@ import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.widget.CircularProgressView;
|
||||
import com.xscm.moduleutil.widget.GiftCardView;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -62,7 +67,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
/// 距离4个的时候放慢
|
||||
private int toSlowCount = 4;
|
||||
|
||||
private List<GiftCardView> allViewsArray ;//视图的集合
|
||||
private List<GiftCardView> allViewsArray;//视图的集合
|
||||
private int targetIndex;//目标的下标
|
||||
private List<Integer> targetArrayIndex = new ArrayList<>();//中奖的下标
|
||||
private List<Integer> finishTargetArrayIndex = new ArrayList<>();
|
||||
@@ -85,7 +90,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
private LotteryEvent userIdType; // 新增枚举类型字段
|
||||
private int type;//10:对应天空之境 11:对应岁月之城 12:对应时空之巅
|
||||
private GiftLotteryDialogFragment giftLotteryDialogFragment;
|
||||
private List<Integer> reslutListAll = new ArrayList<>();
|
||||
private String blind_box_turntable_id = "";//本次抽奖标识id
|
||||
|
||||
@Override
|
||||
protected GiftLotteryPresenter bindPresenter() {
|
||||
@@ -108,9 +113,12 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setCancelable(true);
|
||||
if (!EventBus.getDefault().isRegistered(this))
|
||||
EventBus.getDefault().register(this);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
@@ -133,13 +141,14 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
protected void initView() {
|
||||
// 根据不同的用户类型显示不同的界面
|
||||
setupUIBasedOnUserType();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@@ -150,7 +159,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
// 设置高度为屏幕高度的100%(全屏)
|
||||
int heightInPx = (int) (screenHeight * 0.8);;
|
||||
int heightInPx = (int) (screenHeight * 0.9);
|
||||
;
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||
|
||||
@@ -158,6 +168,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupUIBasedOnUserType() {
|
||||
switch (userIdType) {
|
||||
case MIRROR_SKY://天空之境
|
||||
@@ -177,7 +188,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
|
||||
/// 天空之境
|
||||
private void setupSingleUserUI() {
|
||||
allViewsArray= new ArrayList<>();
|
||||
allViewsArray = new ArrayList<>();
|
||||
mBinding.mirroeSky.getRoot().setVisibility(View.VISIBLE);
|
||||
giftMaxCount = 12;
|
||||
minRoundCount = 6;
|
||||
@@ -203,6 +214,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.mirroeSky.tvGz.setOnClickListener(this::onClisk);
|
||||
mBinding.mirroeSky.tvJc.setOnClickListener(this::onClisk);
|
||||
mBinding.mirroeSky.tvJl.setOnClickListener(this::onClisk);
|
||||
mBinding.mirroeSky.tvStart.setOnClickListener(this::onClisk);
|
||||
init(0);
|
||||
mBinding.mirroeSky.swLockYx.setChecked(true);
|
||||
mBinding.mirroeSky.swTex.setChecked(true);
|
||||
@@ -214,10 +226,9 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
|
||||
|
||||
|
||||
//岁月之城
|
||||
private void setupMultiUserUI() {
|
||||
allViewsArray= new ArrayList<>();
|
||||
allViewsArray = new ArrayList<>();
|
||||
mBinding.cityTime.getRoot().setVisibility(View.VISIBLE);
|
||||
giftMaxCount = 10;
|
||||
minRoundCount = 7;
|
||||
@@ -241,6 +252,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.cityTime.tvGz.setOnClickListener(this::onClisk);
|
||||
mBinding.cityTime.tvJc.setOnClickListener(this::onClisk);
|
||||
mBinding.cityTime.tvJl.setOnClickListener(this::onClisk);
|
||||
mBinding.cityTime.tvStart.setOnClickListener(this::onClisk);
|
||||
init2(0);
|
||||
mBinding.cityTime.swLockYx.setChecked(true);
|
||||
mBinding.cityTime.swTex.setChecked(true);
|
||||
@@ -253,7 +265,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
|
||||
//时空之巅
|
||||
private void setupAllUsersUI() {
|
||||
allViewsArray= new ArrayList<>();
|
||||
allViewsArray = new ArrayList<>();
|
||||
mBinding.pinnacleTime.getRoot().setVisibility(View.VISIBLE);
|
||||
giftMaxCount = 10;
|
||||
minRoundCount = 7;
|
||||
@@ -277,6 +289,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.pinnacleTime.tvGz.setOnClickListener(this::onClisk);
|
||||
mBinding.pinnacleTime.tvJc.setOnClickListener(this::onClisk);
|
||||
mBinding.pinnacleTime.tvJl.setOnClickListener(this::onClisk);
|
||||
mBinding.pinnacleTime.tvStart.setOnClickListener(this::onClisk);
|
||||
init3(0);
|
||||
mBinding.pinnacleTime.swLockYx.setChecked(true);
|
||||
mBinding.pinnacleTime.swTex.setChecked(true);
|
||||
@@ -286,6 +299,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
circularProgress = mBinding.pinnacleTime.circularProgressView;
|
||||
circularProgress.setProgress(0);
|
||||
}
|
||||
|
||||
private void onClisk(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.ll_one) {
|
||||
@@ -379,6 +393,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.cityTime.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_w));
|
||||
}
|
||||
}
|
||||
|
||||
private void init3(int type) {
|
||||
if (type == 1) {
|
||||
mBinding.pinnacleTime.llOne.setBackground(getResources().getDrawable(R.mipmap.chou_x));
|
||||
@@ -479,9 +494,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
delayTime = 0.03;
|
||||
if (targetArrayIndex.isEmpty()) {
|
||||
String result = TextUtils.join(",", reslutListAll);
|
||||
|
||||
MvpPre.giftSend(result);
|
||||
MvpPre.giftSend(blind_box_turntable_id);
|
||||
MvpPre.wallet();
|
||||
stopFastAnimate();
|
||||
return;
|
||||
@@ -581,22 +595,73 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
for (int i = size; i < allViewsArray.size(); i++) {
|
||||
allViewsArray.get(i).setVisibility(View.GONE);
|
||||
}
|
||||
BlindBoxBean.XlhData xlhData = blindBoxBean.getXlhDataAsObject();
|
||||
if (xlhData != null ) {
|
||||
|
||||
if (giftBagId.equals("10")) {
|
||||
circularProgress.setProgress(xlhData.getCurrent_num());
|
||||
mBinding.mirroeSky.tvProgress.setText(xlhData.getCurrent_num() + "%");
|
||||
}else if (giftBagId.equals("11")){
|
||||
circularProgress.setProgress(xlhData.getCurrent_num());
|
||||
mBinding.cityTime.tvProgress.setText(xlhData.getCurrent_num() + "%");
|
||||
}else if (giftBagId.equals("12")){
|
||||
circularProgress.setProgress(xlhData.getCurrent_num());
|
||||
mBinding.pinnacleTime.tvProgress.setText(xlhData.getCurrent_num() + "%");
|
||||
|
||||
if (blindBoxBean.getIs_xlh() == 1) {
|
||||
|
||||
BlindBoxBean.XlhData xlhData = blindBoxBean.getXlhDataAsObject();
|
||||
UpView(xlhData);
|
||||
|
||||
} else {
|
||||
if (type == 10) {
|
||||
mBinding.mirroeSky.llProgress.setVisibility(View.INVISIBLE);
|
||||
mBinding.mirroeSky.tvStart.setVisibility(View.INVISIBLE);
|
||||
} else if (type == 11) {
|
||||
mBinding.cityTime.llProgress.setVisibility(View.INVISIBLE);
|
||||
mBinding.cityTime.tvStart.setVisibility(View.INVISIBLE);
|
||||
} else if (type == 12) {
|
||||
mBinding.pinnacleTime.llProgress.setVisibility(View.INVISIBLE);
|
||||
mBinding.pinnacleTime.tvStart.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpView(BlindBoxBean.XlhData xlhData) {
|
||||
if (xlhData != null) {
|
||||
|
||||
int currentNum = xlhData.getCurrent_num();
|
||||
int startNum = Integer.parseInt(xlhData.getStart_num());
|
||||
int waitingStartNum = Integer.parseInt(xlhData.getWaiting_start_num());
|
||||
|
||||
int progress = 0;
|
||||
String progressText = "";
|
||||
|
||||
if (currentNum >= startNum) {
|
||||
// 已经达到开启条件,显示完整进度或特殊状态
|
||||
progress = 100;
|
||||
progressText = "100%";
|
||||
} else {
|
||||
// 还未达到等待开始条件,计算相对于waiting_start_num的进度
|
||||
progress = (int) (((float) currentNum / startNum) * 100);
|
||||
progressText = progress + "%";
|
||||
}
|
||||
|
||||
if (giftBagId.equals("10")) {
|
||||
circularProgress.setProgress(progress * 10);
|
||||
mBinding.mirroeSky.tvProgress.setText(progressText);
|
||||
} else if (giftBagId.equals("11")) {
|
||||
circularProgress.setProgress(progress * 10);
|
||||
mBinding.cityTime.tvProgress.setText(progressText);
|
||||
} else if (giftBagId.equals("12")) {
|
||||
circularProgress.setProgress(progress * 10);
|
||||
mBinding.pinnacleTime.tvProgress.setText(progressText);
|
||||
}
|
||||
if (xlhData.getStatus() == 0) {
|
||||
mBinding.mirroeSky.tvStart.setBackgroundResource(R.mipmap.dengt);
|
||||
mBinding.cityTime.tvStart.setBackgroundResource(R.mipmap.dengt);
|
||||
mBinding.pinnacleTime.tvStart.setBackgroundResource(R.mipmap.dengt);
|
||||
} else if (xlhData.getStatus() == 1) {
|
||||
mBinding.mirroeSky.tvStart.setBackgroundResource(R.mipmap.zhensgh);
|
||||
mBinding.cityTime.tvStart.setBackgroundResource(R.mipmap.zhensgh);
|
||||
mBinding.pinnacleTime.tvStart.setBackgroundResource(R.mipmap.zhensgh);
|
||||
} else if (xlhData.getStatus() == 2) {
|
||||
mBinding.mirroeSky.tvStart.setBackgroundResource(R.mipmap.jijang);
|
||||
mBinding.cityTime.tvStart.setBackgroundResource(R.mipmap.zhensgh);
|
||||
mBinding.pinnacleTime.tvStart.setBackgroundResource(R.mipmap.zhensgh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||
@@ -606,10 +671,12 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
// 清空之前的数据
|
||||
targetArrayIndex.clear();
|
||||
finishTargetArrayIndex.clear();
|
||||
|
||||
if (blindReslutBean.getBlind_box_turntable_id() != null) {
|
||||
blind_box_turntable_id = blindReslutBean.getBlind_box_turntable_id();
|
||||
}
|
||||
for (int i = 0; i < blindReslutBean.getReslut_list().size(); i++) {
|
||||
BlindReslutBean.ReslutList reslutList = blindReslutBean.getReslut_list().get(i);
|
||||
reslutListAll.add(reslutList.getGift_id());
|
||||
|
||||
|
||||
for (int j = 0; j < giftLists.size(); j++) {
|
||||
if (giftLists.get(j).getGift_id().equals(reslutList.getGift_id() + "")) {
|
||||
@@ -617,7 +684,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
if (j < giftMaxCount) {
|
||||
GiftCardView giftCardView = allViewsArray.get(j);
|
||||
GiftBean giftBean = giftLists.get(j);
|
||||
giftBean.setNumber(reslutList.getCount());
|
||||
giftBean.setCount(reslutList.getCount());
|
||||
|
||||
if (!isOpenSpecial) {
|
||||
giftCardView.setVisibilitymResultTextView(true);
|
||||
@@ -625,9 +692,10 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
playSound("draw.mp3");
|
||||
// 不要设置isDrawing=true,这会影响动画控制
|
||||
MvpPre.wallet();
|
||||
String result = TextUtils.join(",", reslutListAll);
|
||||
MvpPre.giftSend(result);
|
||||
|
||||
MvpPre.giftSend(blind_box_turntable_id);
|
||||
}
|
||||
giftCardView.bindGiftData(giftBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -655,18 +723,26 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
|
||||
@Override
|
||||
public void wallet(WalletBean walletBean) {
|
||||
if (walletBean != null){
|
||||
if (type==10){
|
||||
if (walletBean != null) {
|
||||
if (type == 10) {
|
||||
mBinding.mirroeSky.tvIcon.setText(walletBean.getCoin());
|
||||
}else if (type==11){
|
||||
} else if (type == 11) {
|
||||
mBinding.cityTime.tvIcon.setText(walletBean.getCoin());
|
||||
}else if (type==12){
|
||||
} else if (type == 12) {
|
||||
mBinding.pinnacleTime.tvIcon.setText(walletBean.getCoin());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: 2025/8/29 接收im推送过来的消息
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMusicPlay(RoomMessageEvent message) {
|
||||
if (message.getMsgType() == 1056){
|
||||
UpView(message.getText().getXlh_Data());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
@@ -723,6 +799,9 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
player.release();
|
||||
player = null;
|
||||
}
|
||||
if (!EventBus.getDefault().isRegistered( this)){
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
// 建议进行垃圾回收
|
||||
System.gc();
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ public interface ApiServer {
|
||||
|
||||
@GET(Constants.GIFT_LIST)
|
||||
//获取礼物列表
|
||||
Observable<BaseModel<List<RoonGiftModel>>> getGiftList(@Query("label") int label);
|
||||
Observable<BaseModel<List<RoonGiftModel>>> getGiftList(@Query("label") int label,@Query("room_id")String room_id);
|
||||
|
||||
@GET(Constants.TOPIC_LIST)
|
||||
//获取话题
|
||||
|
||||
@@ -917,8 +917,8 @@ public class RetrofitClient {
|
||||
sApiServer.getGiftLabel(have_hot).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void getGiftList(int type, BaseObserver<List<RoonGiftModel>> observer) {
|
||||
sApiServer.getGiftList(type).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
public void getGiftList(int type,String roomId, BaseObserver<List<RoonGiftModel>> observer) {
|
||||
sApiServer.getGiftList(type,roomId).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class RewardGiftContacts {
|
||||
|
||||
void getGiftLabel(String have_hot);
|
||||
|
||||
void getGiftList(String id, int type);
|
||||
void getGiftList(String id, int type,String roomId);
|
||||
|
||||
void giveGift(String user_id, String gid, String num, String to_uid, String gift_type);
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftList(String id, int type) {
|
||||
api.getGiftList(Integer.parseInt(id), new BaseObserver<List<RoonGiftModel>>() {
|
||||
public void getGiftList(String id, int type,String roomId) {
|
||||
api.getGiftList(Integer.parseInt(id),roomId, new BaseObserver<List<RoonGiftModel>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
|
||||
private static int qos = 2;
|
||||
// private static String HOST ="tcp://81.70.45.221";//正式
|
||||
private static String HOST = "tcp://1.13.181.248";//测试
|
||||
// private static String HOST = "tcp://47.120.21.132";//测试
|
||||
// private static String HOST = "tcp://47.120.21.132";//测试
|
||||
private static MqttAndroidClient mqttAndroidClient;
|
||||
private MqttConnectOptions mMqttConnectOptions;
|
||||
private static boolean b = true;
|
||||
@@ -60,6 +60,8 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
|
||||
private static MyEmqttSubscribeListener mMyEmqttSubscribeListener;
|
||||
|
||||
private static final String TOPIC_BOSS = "qx_room_topic";
|
||||
|
||||
private static final String TOPIC_XLH = "qx_xunlehui";
|
||||
private static final int NOTIFICATION_ID = 1;
|
||||
|
||||
|
||||
@@ -228,7 +230,8 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
|
||||
@Override
|
||||
public void onFailure(IMqttToken asyncActionToken,
|
||||
Throwable exception) {
|
||||
if (!TOPIC_BOSS.equals(topic) && mMyEmqttSubscribeListener != null) {
|
||||
if ((!TOPIC_BOSS.equals(topic) && mMyEmqttSubscribeListener != null)
|
||||
|| (!TOPIC_XLH.equals(topic) && mMyEmqttSubscribeListener != null)) {
|
||||
mMyEmqttSubscribeListener.onSubscribeFailure();
|
||||
}
|
||||
Logger.e(TAG, "订阅失败:" + topic + ", error: " + exception.getMessage());
|
||||
@@ -381,6 +384,7 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
|
||||
}
|
||||
Logger.e(TAG, "链接状态:", "链接成功");
|
||||
subscribe(TOPIC_BOSS);
|
||||
subscribe(TOPIC_XLH);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -411,16 +415,19 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
|
||||
try {
|
||||
String messageStr = message.toString();
|
||||
Logger.e(TAG, "收到的消息", "主题:" + topic + " 收到的消息:" + messageStr);
|
||||
if (topic.equals(TOPIC_BOSS)) {
|
||||
// 处理消息
|
||||
receiveMessage(topic, messageStr);
|
||||
|
||||
// 处理消息
|
||||
receiveMessage(topic, messageStr);
|
||||
|
||||
// 通知监听器
|
||||
if (mMyEmqttMesgListener != null) {
|
||||
// 切换到主线程通知
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
mMyEmqttMesgListener.messageArrived(topic, messageStr);
|
||||
});
|
||||
// 通知监听器
|
||||
if (mMyEmqttMesgListener != null) {
|
||||
// 切换到主线程通知
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
mMyEmqttMesgListener.messageArrived(topic, messageStr);
|
||||
});
|
||||
}
|
||||
} else if (topic.equals(TOPIC_XLH)) {
|
||||
receiveXlhMessage(messageStr);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "处理MQTT消息异常", e);
|
||||
@@ -454,6 +461,25 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
|
||||
}
|
||||
};
|
||||
|
||||
private void receiveXlhMessage(String messageStr) {
|
||||
try {
|
||||
String newdata = messageStr;//TextLengthUtil.decode(data);
|
||||
JSONObject jsonObject = JSON.parseObject(newdata);
|
||||
|
||||
int type = jsonObject.getIntValue("type");
|
||||
String message = jsonObject.getString("msg");
|
||||
|
||||
|
||||
|
||||
// 将事件处理放到主线程执行
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
processMessageType(type, message);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "解析MQTT消息异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void receiveMessage(String topic, String data) {
|
||||
try {
|
||||
String newdata = data;//TextLengthUtil.decode(data);
|
||||
@@ -640,6 +666,7 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
|
||||
}
|
||||
|
||||
cleanSubscribe(TOPIC_BOSS);
|
||||
cleanSubscribe(TOPIC_XLH);
|
||||
if (mqttAndroidClient != null) {
|
||||
mqttAndroidClient.disconnect(); //断开连接
|
||||
mqttAndroidClient.unregisterResources();
|
||||
@@ -680,16 +707,16 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, String mesg) {
|
||||
|
||||
LogUtils.e("lxj", "messageArrived:"+mesg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribeSuccess(String topic) {
|
||||
|
||||
LogUtils.e("lxj", "onSubscribeSuccess:"+topic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribeFailure() {
|
||||
|
||||
LogUtils.e("lxj", "onSubscribeFailure");
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
// 在主线程中播放动画
|
||||
mainHandler.post(() -> {
|
||||
if (isTxk) {
|
||||
mBinding.playView.setLoop(20);
|
||||
mBinding.playView.setLoop(1);
|
||||
}
|
||||
mBinding.playView.startPlay(downloadedFile);
|
||||
});
|
||||
@@ -381,7 +381,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
LogUtils.e("有缓存");
|
||||
// 直接播放缓存文件
|
||||
if (isTxk) {
|
||||
mBinding.playView.setLoop(20);
|
||||
mBinding.playView.setLoop(1);
|
||||
}
|
||||
mBinding.playView.startPlay(file);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public class GiftCardView extends FrameLayout {
|
||||
|
||||
// 设置礼物数量
|
||||
setCount(giftBean.getGift_price() != null ? giftBean.getGift_price() : "0");
|
||||
setmResultTextView(giftBean.getNumber());
|
||||
setmResultTextView(giftBean.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans,fragmentList));
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans,fragmentList,""));
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||
mBinding.slidingTabLayout.setCurrentTab(0);
|
||||
}
|
||||
@@ -291,17 +291,19 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
||||
|
||||
private List<GiftLabelBean> list;
|
||||
private List<Fragment> fragmentList ;
|
||||
private String roomId;
|
||||
|
||||
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list,List<Fragment> fragmentList) {
|
||||
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list,List<Fragment> fragmentList,String roomId) {
|
||||
super(fm);
|
||||
this.list = list;
|
||||
this.fragmentList = fragmentList;
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
GiftLabelBean model = list.get(position);
|
||||
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 2);
|
||||
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 2, roomId);
|
||||
fragmentList.add(fragment); // 保存 Fragment 实例
|
||||
return fragment;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user