1:修改BUG

This commit is contained in:
2025-09-23 14:39:49 +08:00
parent f12ed5ef84
commit 1c54f0c072
120 changed files with 3821 additions and 869 deletions

View File

@@ -235,10 +235,10 @@ public class AvatarFrameView extends FrameLayout {
// }
// 检查特效是否开启
if (SpUtil.getOpenEffect() != 1) {
clearQueue();
return;
}
// if (SpUtil.getOpenEffect() != 1) {
// clearQueue();
// return;
// }
// 检查是否可以开始新的播放
// if (!playbackManager.canStartNewPlayback()) {
// Logger.d("AvatarFrameView", "Max concurrent playbacks reached, waiting...");
@@ -299,14 +299,21 @@ public class AvatarFrameView extends FrameLayout {
mBinding.playView.setVisibility(View.GONE);
}
loadSVGA(item.url);
} );
});
} else if ("mp4".equalsIgnoreCase(ext)) {
mainHandler.post(() -> {
renderType = RenderType.MP4;
mType = item.type;
mBinding.playView.setVisibility(View.VISIBLE);
downloadAndPlayMp4(item.url);
} );
if (mBinding != null && mBinding.playView != null) {
mBinding.playView.setVisibility(View.VISIBLE);
downloadAndPlayMp4(item.url);
}else {
mBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.room_view_svga_anim, this, true);
mBinding.playView.setVisibility(View.VISIBLE);
downloadAndPlayMp4(item.url);
}
});
} else {
// 不支持的格式,直接完成
handlePlaybackComplete();
@@ -329,7 +336,7 @@ public class AvatarFrameView extends FrameLayout {
}
public boolean isPlaying() {
if (mBinding!=null && mBinding.playView!=null) {
if (mBinding != null && mBinding.playView != null) {
return mBinding.playView.isRunning();
}
return true;
@@ -557,7 +564,7 @@ public class AvatarFrameView extends FrameLayout {
LogUtils.e("有缓存");
mainHandler.post(() -> {
// 检查是否已销毁
if ( file.exists()) {
if (file.exists()) {
playMp4File(file);
} else {
LogUtils.w(TAG, "有缓存2222222222222");
@@ -813,18 +820,18 @@ public class AvatarFrameView extends FrameLayout {
}
}
public void stopAll(){
if (svgaSurface != null){
public void stopAll() {
if (svgaSurface != null) {
svgaSurface.stopAnimation();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable( null);
svgaSurface.setImageDrawable(null);
}
if (svgaSurface2 != null){
if (svgaSurface2 != null) {
svgaSurface2.stopAnimation();
svgaSurface2.clearAnimation();
svgaSurface.setImageDrawable( null);
svgaSurface.setImageDrawable(null);
}
if (mBinding.playView!=null){
if (mBinding.playView != null) {
mBinding.playView.stopPlay();
}
}
@@ -1215,7 +1222,7 @@ public class AvatarFrameView extends FrameLayout {
svgaSurface.stopAnimation(true);
svgaSurface.clear();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable( null);
svgaSurface.setImageDrawable(null);
} catch (Exception e) {
Logger.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
}

View File

@@ -48,19 +48,25 @@ public class CenterScrollHelper {
// 使用LinearSmoothScroller进行平滑滚动
LinearSmoothScroller smoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {
private static final float ACCELERATION = 0.5f; // 加速度
private static final float DECELERATION = 0.8f; // 减速度
@Override
protected int calculateTimeForScrolling(int dx) {
// 使用缓动函数计算时间,实现从慢到快再到慢的效果
// return calculateEasingTime(dx, durationPerItem);
// 简单线性时间计算,确保滚动速度一致
int screenWidth = recyclerView.getWidth();
if (screenWidth <= 0) {
return durationPerItem * 3;
}
int itemWidth = screenWidth / 3;
int items = Math.max(1, dx / itemWidth);
return durationPerItem * items;
// // 简单线性时间计算,确保滚动速度一致
// int screenWidth = recyclerView.getWidth();
// if (screenWidth <= 0) {
// return durationPerItem * 3;
// }
// int itemWidth = screenWidth / 3;
// int items = Math.max(1, dx / itemWidth);
// return durationPerItem * items;
// 使用缓动函数计算时间,实现从慢到快再到慢的效果
return calculateEasingTime(dx, durationPerItem);
}
@Override
@@ -120,8 +126,8 @@ public class CenterScrollHelper {
}
// 计算时间:开始慢(500ms),后来快(50ms)
int minDuration = 50; // 最快速度
int maxDuration = 500; // 最慢速度
int minDuration = 1000; // 最快速度
int maxDuration = 2000; // 最慢速度
int calculatedTime = (int) (maxDuration - (maxDuration - minDuration) * easeProgress);
return Math.max(minDuration, calculatedTime);

View File

@@ -380,13 +380,14 @@ public class Constants {
public static final String GET_ALL_RECORD = "/api/BlindBoxTurntable/get_all_record";//获取全服抽奖记录
public static final String GIFT_SEND = "/api/BlindBoxTurntable/gift_send";//礼物发放
public static final String GET_BOX_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh";///巡乐会
public static final String POST_DRAW_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh_draw_gift";///巡乐会抽奖
public static final String POST_XLH_ALL_RECORD = "/api/BlindBoxTurntable/get_xlh_all_record";///巡乐会榜单
public static final String GET_XLH_MY_RECORD = "/api/BlindBoxTurntable/get_xlh_my_record";///巡乐会记录
public static final String POST_GIFT_ALL_CLEAR = "/api/Room/room_gift_all_clear";///背包礼物全清
public static final String POST_ROOM_USER_CHARM_LIST = "/api/Room/room_user_charm_list";///房间用户当前魅力值列表
public static final String GET_GIFT_PACK_LIST_COUNT = "/api/UserGiftPack/get_gift_pack_list_count";///背包礼物总价值
public static final String GET_BOX_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh";//巡乐会
public static final String POST_DRAW_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh_draw_gift";//巡乐会抽奖
public static final String POST_XLH_ALL_RECORD = "/api/BlindBoxTurntable/get_xlh_all_record";//巡乐会榜单
public static final String GET_XLH_MY_RECORD = "/api/BlindBoxTurntable/get_xlh_my_record";//巡乐会记录
public static final String POST_GIFT_ALL_CLEAR = "/api/Room/room_gift_all_clear";//背包礼物全清
public static final String POST_ROOM_USER_CHARM_LIST = "/api/Room/room_user_charm_list";//房间用户当前魅力值列表
public static final String GET_GIFT_PACK_LIST_COUNT = "/api/UserGiftPack/get_gift_pack_list_count";//背包礼物总价值
public static final String ROOM_USER_RECONNECT = "/api/Room/user_reconnect";//用户重连

View File

@@ -256,6 +256,10 @@ public class PKProgressBar extends View {
getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
// 添加视图是否已附加到窗口的检查
if (getWindowToken() == null) {
return true; // 视图尚未附加到窗口,稍后再试
}
getViewTreeObserver().removeOnPreDrawListener(this);
// 是否需要渐变器
if (isGradient) {

View File

@@ -93,7 +93,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
mIvRipple.stopAnimation(true);
mIvRipple.setVisibility(VISIBLE);
mTvName.setText(bean.getNickname());
ImageUtils.loadCenterCrop(bean.getAvatar(), mRiv);
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(pitBean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);

View File

@@ -0,0 +1,70 @@
package com.xscm.moduleutil.widget;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.xscm.moduleutil.bean.room.RoomInfoResp;
import com.xscm.moduleutil.event.QXRoomSeatViewType;
// 在 common 模块中或相应模块中
public class SharedViewModel extends ViewModel {
// 给roomFragment传递数据
private final MutableLiveData<RoomInfoResp> dataForFragment = new MutableLiveData<>();
private final MutableLiveData<Boolean> fragmentReady = new MutableLiveData<>(false);
private MutableLiveData<QXRoomSeatViewType> seatViewTypeData = new MutableLiveData<>();
//给子fragment传递数据
private MutableLiveData<RoomInfoResp> childFragmentData = new MutableLiveData<>();
// 为子Fragment设置数据的方法
public void setChildFragmentData(RoomInfoResp data) {
childFragmentData.setValue(data);
}
// 获取子Fragment数据的LiveData
public LiveData<RoomInfoResp> getChildFragmentData() {
return childFragmentData;
}
public void setSeatViewType(QXRoomSeatViewType type) {
seatViewTypeData.setValue(type);
}
public LiveData<QXRoomSeatViewType> getSeatViewType() {
return seatViewTypeData;
}
public LiveData<RoomInfoResp> getDataForFragment() {
return dataForFragment;
}
public void setDataForFragment(RoomInfoResp data) {
dataForFragment.setValue(data);
}
public LiveData<Boolean> getFragmentReady() {
return fragmentReady;
}
public void setFragmentReady(boolean ready) {
fragmentReady.setValue(ready);
}
// 清除数据,避免重复接收
// 清理所有数据的方法
public void clearAllData() {
dataForFragment.setValue(null);
childFragmentData.setValue(null);
seatViewTypeData.setValue(null);
fragmentReady.setValue(false);
}
// 清理子Fragment数据
public void clearChildFragmentData() {
childFragmentData.setValue(null);
}
// 清理主Fragment数据
public void clearFragmentData() {
dataForFragment.setValue(null);
}
}