修改拍卖房结构,目前修改到拍卖者上麦下麦
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user