1:修改卡顿问题,
2:修改玄镜的动画 3:修改转盘获取数据 4:修改排行榜
This commit is contained in:
@@ -869,15 +869,19 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
giftCardView.setVisibilitymResultTextView(true);
|
||||
giftCardView.setSelected(true);
|
||||
// 不要设置isDrawing=true,这会影响动画控制
|
||||
MvpPre.wallet();
|
||||
isDrawing = false;
|
||||
MvpPre.giftSend(blind_box_turntable_id);
|
||||
// MvpPre.wallet();
|
||||
// isDrawing = false;
|
||||
// MvpPre.giftSend(blind_box_turntable_id);
|
||||
|
||||
giftCardView.bindGiftData(giftBean);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MvpPre.wallet();
|
||||
isDrawing = false;
|
||||
MvpPre.giftSend(blind_box_turntable_id);
|
||||
Log.e("isOpenSound===","isOpenSound1222"+isOpenSound);
|
||||
if (isOpenSpecial) {
|
||||
Log.e("isOpenSound===","isOpenSound333"+isOpenSound);
|
||||
|
||||
@@ -49,7 +49,11 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/9/15
|
||||
*@description: 玄镜之旅
|
||||
*/
|
||||
public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FragmentTourClubDialogBinding> implements GiftLotteryContacts.View {
|
||||
private String roomId;
|
||||
private List<GiftBean> giftLists = new ArrayList<>();
|
||||
@@ -94,8 +98,8 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setCancelable(true);
|
||||
if (!EventBus.getDefault().isRegistered(this))
|
||||
EventBus.getDefault().register(this);
|
||||
// if (!EventBus.getDefault().isRegistered(this))
|
||||
// EventBus.getDefault().register(this);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@@ -300,7 +304,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
}
|
||||
|
||||
// TODO: 2025/8/29 接收im推送过来的消息
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMusicPlay(RoomMessageEvent message) {
|
||||
if (message.getMsgType() == 1057) {
|
||||
// UpView(message.getText().getXlh_data());
|
||||
@@ -444,67 +448,69 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||
if (data != null) {
|
||||
|
||||
showResultDialog(data);
|
||||
|
||||
// 取消之前可能存在的任务
|
||||
clearPendingTasks();
|
||||
// 抽奖完成后执行动画滚动
|
||||
pendingLotteryRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 清理之前的状态
|
||||
if (giftXlhChouAdapter != null) {
|
||||
giftXlhChouAdapter.clearSelection();
|
||||
}
|
||||
int winningPosition = findHighestValueWinningPosition(data);//这是获取到的中奖位置下标
|
||||
if (winningPosition != -1) {
|
||||
if (scrollHelper == null) {
|
||||
scrollHelper = new CenterScrollHelper(mBinding.recycleView);
|
||||
}
|
||||
|
||||
// 计算在循环列表中的目标位置(滚动几圈后停在目标位置)
|
||||
int loopCount = 4; // 滚动4圈
|
||||
int originalSize = giftLists.size();///这是列表的总大小
|
||||
// 计算目标在循环列表中的位置(确保在中间区域)
|
||||
///这是计算总圈数的大小
|
||||
int middleBaseIndex = (loopCount * originalSize);
|
||||
///这里是展示在中奖的位置,加上总圈数的大小,
|
||||
int targetLoopIndex = middleBaseIndex + (winningPosition % originalSize);
|
||||
|
||||
// 使用scrollWithCircles方法执行带动画的滚动(带完成回调)
|
||||
scrollHelper.scrollWithCircles(
|
||||
targetLoopIndex, // 在循环列表中的位置
|
||||
loopCount, // 滚动圈数
|
||||
200, // 每个item滚动时间200ms(控制速度)
|
||||
originalSize, // 原始数据大小
|
||||
() -> { // 滚动完成回调
|
||||
// 滚动完成后更新选中状态(使用原始位置)
|
||||
if (giftXlhChouAdapter != null) {
|
||||
giftXlhChouAdapter.setSelectedPosition(winningPosition);
|
||||
}
|
||||
// 滚动完成后延迟一小段时间再居中,确保UI更新完成
|
||||
pendingCenteringRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 手动将选中项居中
|
||||
centerSelectedItem(winningPosition, originalSize);
|
||||
|
||||
// 显示结果对话框
|
||||
getActivity().runOnUiThread(() -> {
|
||||
scrollHelper = null;
|
||||
showResultDialog(data);
|
||||
});
|
||||
}
|
||||
};
|
||||
mBinding.recycleView.postDelayed(pendingCenteringRunnable, 100);
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
// 如果没有找到中奖位置,直接显示对话框
|
||||
showResultDialog(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
mBinding.recycleView.postDelayed(pendingLotteryRunnable, 300);
|
||||
// clearPendingTasks();
|
||||
// // 抽奖完成后执行动画滚动
|
||||
// pendingLotteryRunnable = new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// // 清理之前的状态
|
||||
// if (giftXlhChouAdapter != null) {
|
||||
// giftXlhChouAdapter.clearSelection();
|
||||
// }
|
||||
// int winningPosition = findHighestValueWinningPosition(data);//这是获取到的中奖位置下标
|
||||
// if (winningPosition != -1) {
|
||||
// if (scrollHelper == null) {
|
||||
// scrollHelper = new CenterScrollHelper(mBinding.recycleView);
|
||||
// }
|
||||
//
|
||||
// // 计算在循环列表中的目标位置(滚动几圈后停在目标位置)
|
||||
// int loopCount = 4; // 滚动4圈
|
||||
// int originalSize = giftLists.size();///这是列表的总大小
|
||||
// // 计算目标在循环列表中的位置(确保在中间区域)
|
||||
// ///这是计算总圈数的大小
|
||||
// int middleBaseIndex = (loopCount * originalSize);
|
||||
// ///这里是展示在中奖的位置,加上总圈数的大小,
|
||||
// int targetLoopIndex = middleBaseIndex + (winningPosition % originalSize);
|
||||
//
|
||||
// // 使用scrollWithCircles方法执行带动画的滚动(带完成回调)
|
||||
// scrollHelper.scrollWithCircles(
|
||||
// targetLoopIndex, // 在循环列表中的位置
|
||||
// loopCount, // 滚动圈数
|
||||
// 200, // 每个item滚动时间200ms(控制速度)
|
||||
// originalSize, // 原始数据大小
|
||||
// () -> { // 滚动完成回调
|
||||
// // 滚动完成后更新选中状态(使用原始位置)
|
||||
// if (giftXlhChouAdapter != null) {
|
||||
// giftXlhChouAdapter.setSelectedPosition(winningPosition);
|
||||
// }
|
||||
// // 滚动完成后延迟一小段时间再居中,确保UI更新完成
|
||||
// pendingCenteringRunnable = new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// // 手动将选中项居中
|
||||
// centerSelectedItem(winningPosition, originalSize);
|
||||
//
|
||||
// // 显示结果对话框
|
||||
// getActivity().runOnUiThread(() -> {
|
||||
// scrollHelper = null;
|
||||
// showResultDialog(data);
|
||||
// });
|
||||
// }
|
||||
// };
|
||||
// mBinding.recycleView.postDelayed(pendingCenteringRunnable, 100);
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// } else {
|
||||
// // 如果没有找到中奖位置,直接显示对话框
|
||||
// showResultDialog(data);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// mBinding.recycleView.postDelayed(pendingLotteryRunnable, 300);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user