1:修改K歌房

This commit is contained in:
2025-10-27 09:43:19 +08:00
parent 8ebe1530ee
commit 8631fdbdbf
20 changed files with 208 additions and 131 deletions

View File

@@ -192,6 +192,9 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Override
public void giftPack(List<GiftPackBean> giftPackBean) {
giftPackList = new ArrayList<>();
if (getActivity()==null){
return;
}
if (giftPackBean != null && giftPackBean.size() > 0) {

View File

@@ -124,7 +124,7 @@ public class RoomManager {
}
CommonAppContext.getInstance().isRoomJoininj=true;
// 检查是否有有效的缓存数据
// RoomInfoResp roomInfo = getCachedRoomData(roomId);
RoomInfoResp roomInfo = getCachedRoomData(roomId);
// 检查是否是当前房间且用户在线
// boolean isCurrentRoom = isCurrentRoom(roomId);
if (CommonAppContext.getInstance().playId == null) {
@@ -138,10 +138,10 @@ public class RoomManager {
CommonAppContext.getInstance().isRoomJoininj=false;
EventBus.getDefault().post(new RoomOutEvent());
} else if (CommonAppContext.getInstance().lable_id.equals("6")) {
upInfo(context, roomId, password, true, null, true);
upInfo(context, roomId, password, true, roomInfo, true);
return;
}
isUserOnline(context, roomId, password, null);
isUserOnline(context, roomId, password, roomInfo);
}
@@ -346,11 +346,19 @@ public class RoomManager {
return;
}
// 使用ARouter跳转到房间页面
ARouter.getInstance()
.build(ARouteConstants.ROOM_DETAILS)
.with(bundle)
.navigation(context);
if (isOnline){
ARouter.getInstance()
.build(ARouteConstants.ROOM_DETAILS)
.navigation(context);
}else {
// 使用ARouter跳转到房间页面
ARouter.getInstance()
.build(ARouteConstants.ROOM_DETAILS)
.with(bundle)
.navigation(context);
}
} catch (Exception e) {
Logger.e(TAG, "跳转房间页面失败: " + e.getMessage());

View File

@@ -3752,7 +3752,7 @@ public class RetrofitClient {
if (string != null) {
int code = string.getCode();
if (code == 1) {
observer.onNext(string.getMsg());
observer.onNext(string.getMsg()!= null ? string.getMsg() : "");
} else if (code == 301) {
try {

View File

@@ -206,6 +206,9 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
if (giftPackBeans == null) {
return;
}
MvpRef.get().giftPack(giftPackBeans);
}
});

View File

@@ -183,6 +183,17 @@ public class ImageUtils {
public static void loadHeadCC(String path, ImageView mImageView) {
if (mImageView == null) {
return;
}
Context context = mImageView.getContext();
if (context instanceof android.app.Activity) {
android.app.Activity activity = (android.app.Activity) context;
if (activity.isFinishing() || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed())) {
return;
}
}
Glide.with(mImageView).load(path).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(mImageView);
}

View File

@@ -78,6 +78,9 @@ public class GiftDisplayManager {
}
public void receiveGift(GiftBean gift) {
if (isInBackground){
return;
}
if (gift == null) return;
Log.d("GiftDisplayManager", "Received gift: " + gift.getSenderName() +
@@ -201,6 +204,20 @@ public class GiftDisplayManager {
// 立即处理队列,而不是延迟
mainHandler.post(this::processGiftQueue);
}
private boolean isInBackground=false;
public void isBackGround(){
for (GiftDisplayView view : displayViews) {
view.finishAnimationImmediately();
}
giftQueue.clear();
accumulatedGifts.clear();
isProcessingQueue = false;
isInBackground=true;
}
public void becomeFront(){
isInBackground=false;
}
public void clearAll() {
Log.d("GiftDisplayManager", "Clear all gifts and queue");

View File

@@ -124,7 +124,9 @@ public class GiftDisplayView extends FrameLayout {
// 临时用颜色代替
// avatarImageView.setBackgroundColor(getRandomColor());
ImageUtils.loadHeadCC(avatarUrl, avatarImageView);
if (avatarImageView!=null&&avatarImageView.getContext()!=null) {
ImageUtils.loadHeadCC(avatarUrl, avatarImageView);
}
} else {
avatarImageView.setBackgroundColor(Color.LTGRAY);
}

View File

@@ -214,7 +214,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
//自动调节麦位波纹
// if (!TextUtils.isEmpty(bean.getDress_picture())) {
if (mIvRipple != null) {
if (mIvRipple!= null) {
mIvRipple.setScaleX(1.1f);
mIvRipple.setScaleY(1.1f);
}
@@ -265,9 +265,9 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
mIvRipple.post(() -> {
mIvRipple.stopAnimation(true);
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(),1);
mIvRipple.setVisibility(GONE);
mIvRipple.setVisibility(INVISIBLE);
});
mIvRipple.setVisibility(GONE);
mIvRipple.setVisibility(INVISIBLE);
} else {
mIvRipple.setVisibility(VISIBLE);
mIvRipple.post(() -> {

View File

@@ -28,7 +28,7 @@ import java.util.Map;
public class CommonAppConfig {
public static final String PACKAGE_NAME = "com.xscm.liveShort";
public static final String PACKAGE_NAME1 = "com.xscm.midi";
public static final String PACKAGE_NAME1 = "com.qxcm.qxlive";
//Http请求头 Header
public static final Map<String, String> HEADER = new HashMap<>();
//域名

View File

@@ -51,7 +51,7 @@ public class DropHourlView extends LinearLayout {
public void run() {
//设置初始位置
int sh = ScreenUtils.getScreenHeight();
int sw = ScreenUtils.getScreenWidth()-200;
int sw = ScreenUtils.getScreenWidth();
// setBackgroundResource(R.drawable.bg_home_drop_view);
int y = (int) (0.5f * sh) - getHeight();
// 确保Y坐标不会超出屏幕范围

View File

@@ -53,7 +53,7 @@ public class DropRedView extends LinearLayout {
int sh = ScreenUtils.getScreenHeight();
int sw = ScreenUtils.getScreenWidth();
// setBackgroundResource(R.drawable.bg_home_drop_view);
int y = (int) (0.5f * sh) - getHeight();
int y = (int) (0.2f * sh) - getHeight();
// 确保Y坐标不会超出屏幕范围
y = Math.max(0, Math.min(y, sh - getHeight()));
// int x = sw - getWidth();//这是靠右边展示的