1:修改卡顿问题,

2:修改玄镜的动画
3:修改转盘获取数据
4:修改排行榜
This commit is contained in:
2025-09-15 18:22:36 +08:00
parent 572967ca16
commit e87a368862
40 changed files with 1752 additions and 911 deletions

View File

@@ -1,11 +1,16 @@
package com.xscm.moduleutil.adapter;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.bean.RechargeBean;
import com.xscm.moduleutil.utils.SystemUtils;
import java.util.List;
@@ -36,7 +41,10 @@ public class BalanceRechargeAdapter extends BaseMultiItemQuickAdapter<RechargeBe
@Override
protected void convert(BaseViewHolder helper, RechargeBean item) {
int type = helper.getItemViewType();
// ConstraintLayout constraintLayout = helper.getView(R.id.cl_item);
// ViewGroup.LayoutParams layoutParams =constraintLayout.getLayoutParams();
// layoutParams.width = ( com.blankj.utilcode.util.ScreenUtils.getScreenWidth()-32-24)/3-24; // 使用你定义的getWidth方法
// constraintLayout.setLayoutParams(layoutParams);
if (type == ITEM_TYPE_NORMAL) {
// 正常 item 显示逻辑
helper.setText(R.id.tv_gold_num, item.getCoins());

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -0,0 +1,76 @@
package com.xscm.moduleutil.event;
public enum QXRoomSeatViewType {
/**
* 无类型
*/
NONE(0, "无类型"),
/**
* 普通麦位(二卡八麦)
*/
NORMAL(1, "点唱"),
KTV(3,"K歌"),
/**
* 拍卖麦位
*/
AUCTION(2, "拍卖麦位"),
/**
* 小黑屋麦位
*/
CABIN(6, "小黑屋麦位"),
/**
* 交友房麦位
*/
FRIEND(7, "交友房麦位");
private final int value;
private final String description;
QXRoomSeatViewType(int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static QXRoomSeatViewType fromLotteryEvent(int value) {
if (value==1) {
return NORMAL;
}
if (value==2) {
return AUCTION;
}
if (value==3) {
return KTV;
}
if (value==6){
return CABIN;
}
if (value==7){
return FRIEND;
}
return NONE;
}
@Override
public String toString() {
return "QXRoomSeatViewType{" +
"value=" + value +
", description='" + description + '\'' +
'}';
}
}

View File

@@ -13,7 +13,7 @@ public enum EnvironmentEnum {
1600101474,
"a3f0f0c78307434fa1c697c3429fbdcf",
"tcp://81.70.45.221",
"https://mdh.xscmmidi.site"),
"https://md.xscmmidi.site/h5"),
TEST(//测试环境
"http://md.qxmier.com/",
"6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=",

View File

@@ -589,8 +589,8 @@ public class AvatarFrameView extends FrameLayout {
if (file != null && file.exists()) {
// 设置循环次数根据mType决定
if (mType == 1) {
mBinding.playView.setLoop(0); // 无限循环
if (mType == 1 || mType == 3) {
mBinding.playView.setLoop(Integer.max(1, 999999999)); // 无限循环
} else {
mBinding.playView.setLoop(1); // 播放一次
}
@@ -767,7 +767,9 @@ public class AvatarFrameView extends FrameLayout {
public void onRepeat() {
// 循环播放处理
if (mType != 1) { // 非循环播放
svgaSurface.stopAnimation(true);
svgaSurface.stopAnimation();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable(null);
onPlaybackComplete();
}
}
@@ -811,6 +813,22 @@ public class AvatarFrameView extends FrameLayout {
}
}
public void stopAll(){
if (svgaSurface != null){
svgaSurface.stopAnimation();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable( null);
}
if (svgaSurface2 != null){
svgaSurface2.stopAnimation();
svgaSurface2.clearAnimation();
svgaSurface.setImageDrawable( null);
}
if (mBinding.playView!=null){
mBinding.playView.stopPlay();
}
}
private void playCachedSVGA(SVGAVideoEntity videoItem) {
// if (isDestroyed || svgaSurface == null) return;
@@ -1196,6 +1214,8 @@ public class AvatarFrameView extends FrameLayout {
// svgaSurface.setImageDrawable(null);
svgaSurface.stopAnimation(true);
svgaSurface.clear();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable( null);
} catch (Exception e) {
Logger.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
}

View File

@@ -91,7 +91,7 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
@Override
public void onVideoRender(int i, @Nullable AnimConfig animConfig) {
LogUtils.e("onVideoRender", i, animConfig);
// LogUtils.e("onVideoRender", i, animConfig);
}
@Override

View File

@@ -218,6 +218,8 @@ public class GiftSvgaView extends FrameLayout implements SVGACallback {
public void stopEffectSvgaPlay() {
if (player != null) {
player.stopAnimation();
player.clearAnimation();
player.setImageDrawable( null);
}
}

View File

@@ -95,9 +95,11 @@ public class RoomFriendshipWheatView extends BaseWheatView {
mTvName.setText(bean.getNickname());
ImageUtils.loadCenterCrop(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(pitBean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
} else {
mIvFrame.setVisibility(VISIBLE);
mIvFrame.stopAll();
mIvFrame.setSource(pitBean.getDress(), 3);
}
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
@@ -121,7 +123,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
if (isMute()) {
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
}
mIvFrame.stopSvga();
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
mIvFace.remove();
//停止声浪

View File

@@ -79,6 +79,7 @@ public class RoomKtvWheatView extends BaseWheatView {
mTvName.setText(bean.getNickname());
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(pitBean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
} else {
mIvFrame.setVisibility(VISIBLE);
@@ -110,6 +111,7 @@ public class RoomKtvWheatView extends BaseWheatView {
if (isMute()) {
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
}
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
mIvFace.remove();
//停止声浪

View File

@@ -103,6 +103,7 @@ public class RoomMakeWheatView extends BaseWheatView {
mTvName.setText(bean.getNickname());
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(pitBean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
} else {
mIvFrame.setVisibility(VISIBLE);
@@ -124,7 +125,7 @@ public class RoomMakeWheatView extends BaseWheatView {
if (isMute()){
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
}
mIvFrame.stopSvga();
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
mIvFace.remove();
//停止声浪

View File

@@ -84,6 +84,7 @@ public class RoomSingSongWheatView extends BaseWheatView {
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(bean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
} else {
mIvFrame.setVisibility(VISIBLE);
@@ -109,7 +110,7 @@ public class RoomSingSongWheatView extends BaseWheatView {
if (isMute()) {
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
}
mIvFrame.stopSvga();
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
mIvFace.remove();
mIvRipple.setVisibility(GONE);

View File

@@ -31,16 +31,14 @@
android:id="@+id/iv_frame"
android:layout_width="0dp"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintHeight_percent="1"
app:layout_constraintWidth_percent="1.05"
app:layout_constraintBottom_toBottomOf="@id/riv"
app:layout_constraintEnd_toEndOf="@id/riv"
android:layout_marginStart="-2dp"
android:layout_marginEnd="-2dp"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-2dp"
app:layout_constraintStart_toStartOf="@id/riv"
app:layout_constraintTop_toTopOf="@id/riv" />
app:layout_constraintEnd_toEndOf="@id/riv"
app:layout_constraintTop_toTopOf="@id/riv"
app:layout_constraintBottom_toBottomOf="@id/riv"/>
<!-- 说话麦圈,与头像大小相同,覆盖在头像上 -->
<com.opensource.svgaplayer.SVGAImageView

View File

@@ -29,6 +29,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -3,36 +3,37 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cl_item"
android:layout_width="@dimen/dp_106"
android:layout_height="@dimen/dp_66"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_12"
android:layout_marginStart="@dimen/dp_12"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_76"
android:layout_gravity="center"
android:layout_marginEnd="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_12"
android:background="@drawable/bg_r10_white">
<ImageView
android:id="@+id/iv_gold"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:src="@mipmap/jinb"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginBottom="@dimen/dp_35"
android:layout_marginStart="@dimen/dp_19"
android:layout_marginEnd="@dimen/dp_67"/>
<!-- <ImageView-->
<!-- android:id="@+id/iv_gold"-->
<!-- android:layout_width="@dimen/dp_20"-->
<!-- android:layout_height="@dimen/dp_20"-->
<!-- android:src="@mipmap/jinb"-->
<!-- android:layout_marginTop="@dimen/dp_19"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:layout_marginStart="@dimen/dp_19"-->
<!-- />-->
<TextView
android:id="@+id/tv_gold_num"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:drawableLeft="@mipmap/jinb"
android:textColor="@color/color_353535"
android:textSize="@dimen/sp_18"
app:layout_constraintLeft_toRightOf="@+id/iv_gold"
app:layout_constraintTop_toTopOf="@+id/iv_gold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="600" />
<TextView
@@ -41,21 +42,15 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginStart="@dimen/dp_25"
android:layout_marginEnd="@dimen/dp_40"
android:textColor="@color/color_FF666666"
android:textSize="@dimen/sp_14"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_gold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_gold_num"
tools:text="¥6" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="tv_money,tv_gold_num,iv_gold" />
</androidx.constraintlayout.widget.ConstraintLayout>