diff --git a/app/releas/release/output-metadata.json b/app/releas/release/output-metadata.json index 85dd5618..fc35392e 100644 --- a/app/releas/release/output-metadata.json +++ b/app/releas/release/output-metadata.json @@ -11,9 +11,9 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 2, - "versionName": "1.0.0.1", - "outputFile": "羽声_1.0.0.1_2.apk" + "versionCode": 40, + "versionName": "1.0.5.2", + "outputFile": "羽声_1.0.5.2_40.apk" } ], "elementType": "File", @@ -22,14 +22,14 @@ "minApi": 28, "maxApi": 30, "baselineProfiles": [ - "baselineProfiles/1/羽声_1.0.0.1_2.dm" + "baselineProfiles/1/羽声_1.0.5.2_40.dm" ] }, { "minApi": 31, "maxApi": 2147483647, "baselineProfiles": [ - "baselineProfiles/0/羽声_1.0.0.1_2.dm" + "baselineProfiles/0/羽声_1.0.5.2_40.dm" ] } ], diff --git a/app/src/main/java/com/qxcm/qxlive/LaunchContacter.java b/app/src/main/java/com/qxcm/qxlive/LaunchContacter.java index f92d468a..0228401a 100644 --- a/app/src/main/java/com/qxcm/qxlive/LaunchContacter.java +++ b/app/src/main/java/com/qxcm/qxlive/LaunchContacter.java @@ -1,4 +1,4 @@ -package com.xscm.midi; +package com.qxcm.qxlive; import android.app.Activity; diff --git a/app/src/main/java/com/qxcm/qxlive/LaunchPresenter.java b/app/src/main/java/com/qxcm/qxlive/LaunchPresenter.java index fdad3f6e..f95ad366 100644 --- a/app/src/main/java/com/qxcm/qxlive/LaunchPresenter.java +++ b/app/src/main/java/com/qxcm/qxlive/LaunchPresenter.java @@ -1,4 +1,4 @@ -package com.xscm.midi; +package com.qxcm.qxlive; import android.content.Context; import android.content.Intent; @@ -19,9 +19,9 @@ import java.util.List; import io.reactivex.disposables.Disposable; -public class LaunchPresenter extends BasePresenter implements LaunchContacter.ILoginPre { +public class LaunchPresenter extends BasePresenter implements com.qxcm.qxlive.LaunchContacter.ILoginPre { - public LaunchPresenter(LaunchContacter.View view, Context context) { + public LaunchPresenter(com.qxcm.qxlive.LaunchContacter.View view, Context context) { super(view, context); } diff --git a/app/src/main/java/com/qxcm/qxlive/presenter/BasePresenter.java b/app/src/main/java/com/qxcm/qxlive/presenter/BasePresenter.java index 4155ddf4..842d9f99 100644 --- a/app/src/main/java/com/qxcm/qxlive/presenter/BasePresenter.java +++ b/app/src/main/java/com/qxcm/qxlive/presenter/BasePresenter.java @@ -1,4 +1,4 @@ -package com.xscm.midi.presenter; +package com.qxcm.qxlive.presenter; import android.content.Context; diff --git a/gradle.properties b/gradle.properties index 16ea98c1..7cfdcb11 100644 --- a/gradle.properties +++ b/gradle.properties @@ -28,8 +28,8 @@ isBuildModule=false #org.gradle.deamon=false android.injected.testOnly=false -APP_VERSION_NAME=1.0.0.1 -APP_VERSION_CODE=2 +APP_VERSION_NAME=1.0.5.2 +APP_VERSION_CODE=40 org.gradle.jvm.toolchain.useLegacyAdapters=false #org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15 diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/adapter/GiftTwoDetailsFragment.java b/moduleUtil/src/main/java/com/xscm/moduleutil/adapter/GiftTwoDetailsFragment.java index 9d66c3ed..588ba2f5 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/adapter/GiftTwoDetailsFragment.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/adapter/GiftTwoDetailsFragment.java @@ -192,6 +192,9 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment giftPackBean) { giftPackList = new ArrayList<>(); + if (getActivity()==null){ + return; + } if (giftPackBean != null && giftPackBean.size() > 0) { diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/base/RoomManager.java b/moduleUtil/src/main/java/com/xscm/moduleutil/base/RoomManager.java index f6348973..e886c63d 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/base/RoomManager.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/base/RoomManager.java @@ -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()); diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/http/RetrofitClient.java b/moduleUtil/src/main/java/com/xscm/moduleutil/http/RetrofitClient.java index 74c70e8e..377fdab2 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/http/RetrofitClient.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/http/RetrofitClient.java @@ -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 { diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/presenter/RewardGiftPresenter.java b/moduleUtil/src/main/java/com/xscm/moduleutil/presenter/RewardGiftPresenter.java index b095d657..00ac98f2 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/presenter/RewardGiftPresenter.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/presenter/RewardGiftPresenter.java @@ -206,6 +206,9 @@ public class RewardGiftPresenter extends BasePresenter if (MvpRef == null) { MvpRef = new WeakReference<>(mView); } + if (giftPackBeans == null) { + return; + } MvpRef.get().giftPack(giftPackBeans); } }); diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/utils/ImageUtils.java b/moduleUtil/src/main/java/com/xscm/moduleutil/utils/ImageUtils.java index 53620919..2183d6c5 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/utils/ImageUtils.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/utils/ImageUtils.java @@ -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); } diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/utils/roomview/GiftDisplayManager.java b/moduleUtil/src/main/java/com/xscm/moduleutil/utils/roomview/GiftDisplayManager.java index cd992fdf..4aeef1e4 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/utils/roomview/GiftDisplayManager.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/utils/roomview/GiftDisplayManager.java @@ -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"); diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/utils/roomview/GiftDisplayView.java b/moduleUtil/src/main/java/com/xscm/moduleutil/utils/roomview/GiftDisplayView.java index 37d8baff..2dfc8a8c 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/utils/roomview/GiftDisplayView.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/utils/roomview/GiftDisplayView.java @@ -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); } diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/widget/BaseWheatView.java b/moduleUtil/src/main/java/com/xscm/moduleutil/widget/BaseWheatView.java index 1bdab39e..29058a02 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/widget/BaseWheatView.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/widget/BaseWheatView.java @@ -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(() -> { diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/widget/CommonAppConfig.java b/moduleUtil/src/main/java/com/xscm/moduleutil/widget/CommonAppConfig.java index 03429c7f..78b96328 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/widget/CommonAppConfig.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/widget/CommonAppConfig.java @@ -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 HEADER = new HashMap<>(); //域名 diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/widget/DropHourlView.java b/moduleUtil/src/main/java/com/xscm/moduleutil/widget/DropHourlView.java index e290cf27..7e89d7f0 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/widget/DropHourlView.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/widget/DropHourlView.java @@ -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坐标不会超出屏幕范围 diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/widget/DropRedView.java b/moduleUtil/src/main/java/com/xscm/moduleutil/widget/DropRedView.java index 30117f0e..64bf1acb 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/widget/DropRedView.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/widget/DropRedView.java @@ -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();//这是靠右边展示的 diff --git a/moduleroom/src/main/java/com/example/moduleroom/activity/RoomActivity.kt b/moduleroom/src/main/java/com/example/moduleroom/activity/RoomActivity.kt index 6f3ec25f..81b10fd0 100644 --- a/moduleroom/src/main/java/com/example/moduleroom/activity/RoomActivity.kt +++ b/moduleroom/src/main/java/com/example/moduleroom/activity/RoomActivity.kt @@ -172,12 +172,13 @@ class RoomActivity : BaseMvpActivity(), fun addActiveDialogFragment(dialogFragment: Fragment) { activeDialogFragments.add(dialogFragment) } + override fun doDone() { isOnline = intent.getBooleanExtra("isOnline", false) password = intent.getStringExtra("password") roomId = intent.getStringExtra("roomId") mRoomInfoResp = intent.getSerializableExtra("roomInfo") as RoomInfoResp? - LogUtils.dTag("RoomActivity", "doDone"+mRoomInfoResp.toString()) + LogUtils.dTag("RoomActivity", "doDone" + mRoomInfoResp.toString()) } @@ -286,7 +287,7 @@ class RoomActivity : BaseMvpActivity(), override fun onPause() { super.onPause() LogUtils.e("RoomActivity", "onPause") - + GiftDisplayManager.getInstance().clearAll() if (mRoomInfoResp != null) { if (mRoomInfoResp!!.room_info.type_id != "6") { // 只有在用户主动离开应用时才执行最小化操作 @@ -370,7 +371,8 @@ class RoomActivity : BaseMvpActivity(), // 调用退出房间方法 MessageListenerSingleton.quitGroup(roomId); quit(); - if (mRoomInfoResp?.getRoom_info()?.getLabel_id() != null && mRoomInfoResp?.getRoom_info()?.getLabel_id() + if (mRoomInfoResp?.getRoom_info()?.getLabel_id() != null && mRoomInfoResp?.getRoom_info() + ?.getLabel_id() .equals("5") ) { jiaR(); @@ -475,6 +477,7 @@ class RoomActivity : BaseMvpActivity(), QXGiftPlayerManager.getInstance(applicationContext).destroyEffectSvga() cleanupResources() } + private lateinit var giftManager: GiftDisplayManager private val testHandler = Handler() private var testRunnable: Runnable? = null @@ -548,8 +551,7 @@ class RoomActivity : BaseMvpActivity(), // 初始化礼物管理器 - giftManager = GiftDisplayManager.getInstance() - giftManager.setupDisplayView(mBinding!!.giftContainer) + GiftDisplayManager.getInstance().setupDisplayView(mBinding!!.giftContainer) } @@ -586,25 +588,20 @@ class RoomActivity : BaseMvpActivity(), override fun onSelfInfoUpdated(info: V2TIMUserFullInfo?) {} } + private fun setview(resp: RoomInfoResp?) { if (resp == null) return + AppStateManager.getInstance().roomInfo = resp this.mRoomInfoResp = resp val roomBean = resp.room_info this.mRoomBean = roomBean this.mRoomUserBean = resp.user_info this.mRoomOwnerBean = resp.room_owner this.mPitList = mRoomBean!!.pit_list - - CommonAppContext.getInstance().isPlaying = true - CommonAppContext.getInstance().playId = roomId - CommonAppContext.getInstance().playName = mRoomBean!!.room_name - - CommonAppContext.getInstance().playCover = resp.room_info.room_cover - CommonAppContext.getInstance().showSelf = resp.is_show_self == 1 - + this.roomId = roomBean.room_id + MessageListenerSingleton.getInstance().joinGroup(roomId) //加入房间im ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar) - mBinding!!.roomTop.name.text = roomBean.room_name mBinding!!.roomTop.idVal.text = "ID:" + roomBean.room_number if (mRoomUserBean?.getIs_room_owner() == 1) { @@ -619,6 +616,7 @@ class RoomActivity : BaseMvpActivity(), } number = roomBean.online_number mBinding!!.roomTop.tvNum.text = number.toString() + "" + val userIds = StringBuilder() for (i in mRoomInfoResp!!.room_info.pit_list.indices) { val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id @@ -640,6 +638,14 @@ class RoomActivity : BaseMvpActivity(), } else { Log.e("Fragment", "Fragment transaction skipped due to state loss.") } + LogUtils.e("加入", roomId) + + CommonAppContext.getInstance().isPlaying = true + CommonAppContext.getInstance().playId = roomId + CommonAppContext.getInstance().playName = mRoomBean!!.room_name + + CommonAppContext.getInstance().playCover = resp.room_info.room_cover + CommonAppContext.getInstance().showSelf = resp.is_show_self == 1 if (mRoomUserBean?.getIs_collect() == 1) { mBinding!!.roomTop.btnFollow.background = @@ -653,6 +659,7 @@ class RoomActivity : BaseMvpActivity(), ) mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt) mBinding!!.roomTop.btnFollow.text = "收藏" + // mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect)); } if ((roomBean.type_id == "3" || roomBean.type_id == "1" || roomBean.type_id == "4") && roomBean.label_id == "2") { AgoraManager.getInstance(this).isBjMusic = false @@ -662,10 +669,8 @@ class RoomActivity : BaseMvpActivity(), AgoraManager.stopMuisc() initializeAudio() - toutiao() upRoomInfo(resp) - instView() if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId() @@ -678,18 +683,31 @@ class RoomActivity : BaseMvpActivity(), ivSoundEffects(false) } - if (mRoomInfoResp!!.room_info.type_id == "7" || mRoomInfoResp!!.room_info.type_id == "2") { + if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") { mBinding!!.rlMore.visibility = View.GONE mBinding!!.rlMisc.visibility = View.GONE } setupEffectView() - // 使用Handler延迟执行,确保Fragment视图已完全创建 Handler(Looper.getMainLooper()).post { if (publicScreenFragment != null && publicScreenFragment!!.isAdded && publicScreenFragment!!.view != null) { publicScreenFragment!!.getUpRoomInfo(resp) } } + + if (mRoomInfoResp!!.gift_cycle != null && mRoomInfoResp!!.gift_cycle.xlh_info != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status == "1") { + mBinding?.xlhRk?.visibility = View.VISIBLE + xlhDjs(mRoomInfoResp!!.gift_cycle.xlh_info.end_time) + } else { + mBinding?.xlhRk?.visibility = View.INVISIBLE + releaseCountDownTimer1() + } + + if (mRoomInfoResp!!.hour_ranking_open == 1) { + mBinding!!.clXsb.visibility = View.VISIBLE + } else { + mBinding!!.clXsb.visibility = View.GONE + } } @@ -761,18 +779,18 @@ class RoomActivity : BaseMvpActivity(), fun onRoomTaskEvent(event: RoomTaskEvent?) { if (taskId != null && taskId != "9") { //这是每日任务完成发送私聊信息的事件 RetrofitClient.getInstance().dailyTasksComplete(taskId, object : BaseObserver() { - override fun onSubscribe(d: Disposable) { - } + override fun onSubscribe(d: Disposable) { + } - override fun onNext(roomSingleton: RoomSingleton) { - number++ - // 这里处理请求结果 - if (roomSingleton.is_completed == 1) { - // 任务完成,可以做一些后续操作 - taskId = null - } + override fun onNext(roomSingleton: RoomSingleton) { + number++ + // 这里处理请求结果 + if (roomSingleton.is_completed == 1) { + // 任务完成,可以做一些后续操作 + taskId = null } - }) + } + }) } } @@ -847,11 +865,15 @@ class RoomActivity : BaseMvpActivity(), mBinding!!.drvRed.visibility = View.GONE mBinding!!.redBj.setOnClickListener { - if(qxRedPacketManager!!.getAllRedPackets().size==1){ + if (qxRedPacketManager!!.getAllRedPackets().size == 1) { redPacketInfo = qxRedPacketManager!!.getAllRedPackets().get(0) - if (qxRedPacketManager!!.getAllRedPackets().get(0)!=null && qxRedPacketManager!!.getAllRedPackets().get(0).is_qiang==1){ - ARouter.getInstance().build(ARouteConstants.ROOM_RED_RESULT).withString("redpacketId", qxRedPacketManager!!.getAllRedPackets().get(0).getRedpacket_id()).navigation(); - }else { + if (qxRedPacketManager!!.getAllRedPackets().get(0) != null && qxRedPacketManager!!.getAllRedPackets() + .get(0).is_qiang == 1 + ) { + ARouter.getInstance().build(ARouteConstants.ROOM_RED_RESULT) + .withString("redpacketId", qxRedPacketManager!!.getAllRedPackets().get(0).getRedpacket_id()) + .navigation(); + } else { redEnvelopesFragment = RedEnvelopesFragment(this@RoomActivity) redEnvelopesFragment!!.setIsCollectedRoom(mRoomUserBean!!.is_collect == 1) redEnvelopesFragment!!.setFromToComment(false) @@ -866,9 +888,10 @@ class RoomActivity : BaseMvpActivity(), override fun onRedPacketClick(redPacketInfos: RedPacketInfo?, position: Int) { redPacketInfo = redPacketInfos - if (redPacketInfos!=null && redPacketInfos.is_qiang==1){ - ARouter.getInstance().build(ARouteConstants.ROOM_RED_RESULT).withString("redpacketId", redPacketInfos.getRedpacket_id()).navigation(); - }else { + if (redPacketInfos != null && redPacketInfos.is_qiang == 1) { + ARouter.getInstance().build(ARouteConstants.ROOM_RED_RESULT) + .withString("redpacketId", redPacketInfos.getRedpacket_id()).navigation(); + } else { redEnvelopesFragment = RedEnvelopesFragment(this@RoomActivity) redEnvelopesFragment!!.setIsCollectedRoom(mRoomUserBean!!.is_collect == 1) redEnvelopesFragment!!.setFromToComment(false) @@ -917,7 +940,7 @@ class RoomActivity : BaseMvpActivity(), ThreadUtils.runOnUiThreadDelayed({ val fragment = RechargeDialogFragment.show( roomId, null, - supportFragmentManager,"","" + supportFragmentManager, "", "" ) if (fragment != null) { addActiveDialogFragment(fragment) // 添加到管理列表 @@ -954,7 +977,7 @@ class RoomActivity : BaseMvpActivity(), ThreadUtils.runOnUiThreadDelayed({ val fragment = RechargeDialogFragment.show( roomId, null, - supportFragmentManager,"","" + supportFragmentManager, "", "" ) if (fragment != null) { addActiveDialogFragment(fragment) // 添加到管理列表 @@ -1351,16 +1374,16 @@ class RoomActivity : BaseMvpActivity(), // giftManager.receiveGift(giftBean) // } // }else { - if (messageEvent!!.text.giftInfo != null) { - var giftBean = messageEvent.text.giftInfo - giftBean.nickname = messageEvent.text.fromUserInfo.nickname - giftBean.userAvatar = messageEvent.text.fromUserInfo.avatar - LogUtils.e("1005", messageEvent.text.toUserInfo?.nickname) - giftBean.senderName = messageEvent.text.toUserInfo?.nickname - giftBean.senderAvatarUrl = messageEvent.text.toUserInfo?.avatar - giftBean.number = messageEvent.text.gift_num.toInt() - giftManager.receiveGift(giftBean) - } + if (messageEvent!!.text.giftInfo != null) { + var giftBean = messageEvent.text.giftInfo + giftBean.nickname = messageEvent.text.fromUserInfo.nickname + giftBean.userAvatar = messageEvent.text.fromUserInfo.avatar + LogUtils.e("1005", messageEvent.text.toUserInfo?.nickname) + giftBean.senderName = messageEvent.text.toUserInfo?.nickname + giftBean.senderAvatarUrl = messageEvent.text.toUserInfo?.avatar + giftBean.number = messageEvent.text.gift_num.toInt() + GiftDisplayManager.getInstance().receiveGift(giftBean) + } // } hand1005(messageEvent, text) } else if (msgType == 123) { @@ -1495,10 +1518,10 @@ class RoomActivity : BaseMvpActivity(), if (messageEvent.text.xlh_data != null) { if (messageEvent.text.xlh_data.status == 1) { - mBinding!!.xlhRk.visibility = View.VISIBLE + mBinding?.xlhRk?.visibility = View.VISIBLE xlhDjs(messageEvent.text.xlh_data.end_time) } else { - mBinding!!.xlhRk.visibility = View.INVISIBLE + mBinding?.xlhRk?.visibility = View.INVISIBLE releaseCountDownTimer1() } } @@ -1515,7 +1538,7 @@ class RoomActivity : BaseMvpActivity(), } else if (msgType == 1060) { qxRedPacketManager!!.addRedPacket(messageEvent.text.redpacketInfo) - }else if (msgType == 1061){ + } else if (msgType == 1061) { qxRedPacketManager!!.removeRedPacket(messageEvent.text.redpacket_id) } } @@ -1523,17 +1546,17 @@ class RoomActivity : BaseMvpActivity(), @Subscribe(threadMode = ThreadMode.MAIN) fun onMessageEvent(messageEvent: MqttXlhEnd) { val xlhBean: XLHBean = GsonUtils.fromJson(messageEvent.message, XLHBean::class.java) - if(xlhBean.from_type==100){ + if (xlhBean.from_type == 100) { if (xlhBean.xlh_data != null) { if (xlhBean.xlh_data.status == 1) { - mBinding!!.xlhRk.visibility = View.VISIBLE + mBinding?.xlhRk?.visibility = View.VISIBLE xlhDjs(xlhBean.xlh_data.end_time) } else { - mBinding!!.xlhRk.visibility = View.INVISIBLE + mBinding?.xlhRk?.visibility = View.INVISIBLE releaseCountDownTimer1() } } - }else if(xlhBean.from_type==103){ + } else if (xlhBean.from_type == 103) { val existingFragment = supportFragmentManager.findFragmentByTag("TourClubDialogFragment") as TourClubDialogFragment? if (existingFragment != null && existingFragment.isVisible) { @@ -1543,7 +1566,7 @@ class RoomActivity : BaseMvpActivity(), // EventBus.getDefault().post(messageEvent) } xlhDjs(xlhBean.end_time) - }else if(xlhBean.from_type==104){ + } else if (xlhBean.from_type == 104) { } } @@ -1591,7 +1614,7 @@ class RoomActivity : BaseMvpActivity(), setTime(time1) // mBinding.tvDjs.setText(time1 + ""); if (time1 == 0) { - mBinding!!.xlhRk.visibility = View.INVISIBLE + mBinding?.xlhRk?.visibility = View.INVISIBLE } } @@ -1615,7 +1638,7 @@ class RoomActivity : BaseMvpActivity(), @SuppressLint("DefaultLocale") fun setTime(seconds: Int) { if (seconds == 0) { - mBinding!!.xlhRk.visibility = View.INVISIBLE + mBinding?.xlhRk?.visibility = View.INVISIBLE return } val formattedTime = formatTime(seconds) @@ -2607,17 +2630,16 @@ class RoomActivity : BaseMvpActivity(), } else if (id == R.id.ll_input) { mBinding!!.llInput.visibility = View.GONE mBinding!!.inputMenu1.dismiss() - }else if (id==R.id.iv_emoji){ + } else if (id == R.id.iv_emoji) { val emotionPickerDialog = EmotionPickerDialog(this) emotionPickerDialog.setOnEmotionSelectedListener { emotion -> // 处理选中的表情 - if (publicScreenFragment!=null){ + if (publicScreenFragment != null) { publicScreenFragment!!.sendChatEmoji(emotion) } } emotionPickerDialog.show() - } - else if (id == R.id.iv_chat) { + } else if (id == R.id.iv_chat) { if (mRoomInfoResp!!.user_info.is_mute == "1") { ToastUtils.show("您已经被禁言") } else { @@ -2832,7 +2854,6 @@ class RoomActivity : BaseMvpActivity(), appStateListener!!.isAppInBackground = true } QXGiftPlayerManager.getInstance(applicationContext).destroyEffectSvga() - ARouter.getInstance() .build(ARouteConstants.ME) .navigation() @@ -3108,7 +3129,7 @@ class RoomActivity : BaseMvpActivity(), } @SuppressLint("MissingInflatedId") - fun dialogDismiss(type:Int) { + fun dialogDismiss(type: Int) { // // 使用 AlertDialog.Builder val builder = AlertDialog.Builder(this) @@ -3159,14 +3180,14 @@ class RoomActivity : BaseMvpActivity(), } etContent.setText("") countDownTimer() - if(type==2) { - if (redPacketInfo != null){ - LogUtils.e("输入口令红包",redPacketInfo) - LogUtils.e("输入口令红包","# 口令红包 "+redPacketInfo!!.password,"inputSting",inputSting) - if (intRed_num==null || intRed_num!!.isEmpty()){ + if (type == 2) { + if (redPacketInfo != null) { + LogUtils.e("输入口令红包", redPacketInfo) + LogUtils.e("输入口令红包", "# 口令红包 " + redPacketInfo!!.password, "inputSting", inputSting) + if (intRed_num == null || intRed_num!!.isEmpty()) { return@OnClickListener } - if (inputSting!!.toString() == intRed_num.toString()){ + if (inputSting!!.toString() == intRed_num.toString()) { if (redEnvelopesFragment != null) { redEnvelopesFragment = RedEnvelopesFragment(this@RoomActivity) redEnvelopesFragment!!.setIsCollectedRoom(mRoomUserBean!!.is_collect == 1) @@ -3193,7 +3214,7 @@ class RoomActivity : BaseMvpActivity(), // 监听对话框关闭事件 dialog.setOnDismissListener { // 对话框关闭时执行的代码 - inputSting="" + inputSting = "" LogUtils.e("AlertDialog已关闭") } dialog.show() @@ -3228,11 +3249,11 @@ class RoomActivity : BaseMvpActivity(), @Subscribe(threadMode = ThreadMode.MAIN) fun roomInfoEvent(messageEvent: UserInfo) { if (messageEvent != null && messageEvent.red_num != null) { - inputSting ="# 口令红包 "+ messageEvent.red_num - intRed_num="# 口令红包 "+ messageEvent.red_num + inputSting = "# 口令红包 " + messageEvent.red_num + intRed_num = "# 口令红包 " + messageEvent.red_num dialogDismiss(2) - } else if (messageEvent!=null && messageEvent.ta != null){ - intRed_num="" + } else if (messageEvent != null && messageEvent.ta != null) { + intRed_num = "" inputSting = "@" + messageEvent.nickname dialogDismiss(1) } @@ -3372,10 +3393,10 @@ class RoomActivity : BaseMvpActivity(), setupEffectView() if (mRoomInfoResp!!.gift_cycle != null && mRoomInfoResp!!.gift_cycle.xlh_info != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status == "1") { - mBinding!!.xlhRk.visibility = View.VISIBLE + mBinding?.xlhRk?.visibility = View.VISIBLE xlhDjs(mRoomInfoResp!!.gift_cycle.xlh_info.end_time) } else { - mBinding!!.xlhRk.visibility = View.INVISIBLE + mBinding?.xlhRk?.visibility = View.INVISIBLE releaseCountDownTimer1() } @@ -3688,9 +3709,7 @@ class RoomActivity : BaseMvpActivity(), override fun onResume() { super.onResume() - if (true) - return - LogUtils.e("RoomActivity", "onResume") + GiftDisplayManager.getInstance().setupDisplayView(mBinding?.giftContainer) CommonAppContext.getInstance().isShow = true CommonAppContext.getInstance().isPlaying = true CommonAppContext.getInstance().isRoomJoininj = false @@ -3698,8 +3717,13 @@ class RoomActivity : BaseMvpActivity(), userLeaving = true MvpPre!!.roomRedPackets(roomId); - if ((mRoomInfoResp?.room_info?.type_id.equals("1")||mRoomInfoResp?.room_info?.type_id.equals("8")||mRoomInfoResp?.room_info?.type_id.equals("3") - ||mRoomInfoResp?.room_info?.type_id.equals("4")) && mRoomInfoResp?.room_info?.label_id.equals("2") ){ + LogUtils.e("RoomActivity", "onResume") + + if ((mRoomInfoResp?.room_info?.type_id.equals("1") || mRoomInfoResp?.room_info?.type_id.equals("8") || mRoomInfoResp?.room_info?.type_id.equals( + "3" + ) + || mRoomInfoResp?.room_info?.type_id.equals("4")) && mRoomInfoResp?.room_info?.label_id.equals("2") + ) { return } if (isInBackground) { @@ -3715,11 +3739,11 @@ class RoomActivity : BaseMvpActivity(), resumeRoomState() setupEffectView() - MvpPre!!.postRoomInfo(CommonAppContext.getInstance().playId) + MvpPre?.postRoomInfo(CommonAppContext.getInstance().playId) } // 延迟调整布局,确保视图已经完全加载 - mBinding!!.mainContentContainer.post { this.adjustLayoutHeights() } + mBinding?.mainContentContainer?.post { this.adjustLayoutHeights() } } // 添加检查房间连接状态的方法 @@ -4198,7 +4222,7 @@ class RoomActivity : BaseMvpActivity(), if (qxRedPacketManager != null) { qxRedPacketManager!!.destroyRedpacketInfo() } - giftManager.clearAll() + GiftDisplayManager.getInstance().clearAll() mBinding!!.giftContainer.removeAllViews() // 确保父类的 onDestroy 被调用 super.finish() @@ -4559,7 +4583,7 @@ class RoomActivity : BaseMvpActivity(), if (redEnvelopesFragment != null && redEnvelopesFragment!!.mRedPacketInfo != null && redEnvelopesFragment!!.mRedPacketInfo!!.countdown > 0) { if (redEnvelopesFragment!!.mRedPacketInfo.type == 1) { redEnvelopesFragment!!.changeViewType(RedEnvelopeStatus.QXRedBagDrawTypeOpen) - }else{ + } else { if (redEnvelopesFragment!!.isFromToComment) { redEnvelopesFragment!!.changeViewType(RedEnvelopeStatus.QXRedBagDrawTypeOpen) } @@ -4577,13 +4601,13 @@ class RoomActivity : BaseMvpActivity(), if (redEnvelopesFragment!!.mRedPacketInfo.conditions.contains("1")) { //有收藏房间条件 if (mRoomInfoResp!!.user_info.is_collect == 1) { - if(packet!!.redpacket_id==redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) { + if (packet!!.redpacket_id == redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) { //需要满足收藏在倒计时 redEnvelopesFragment!!.setNeedTime(packetTime) } } } else { - if(packet!!.redpacket_id==redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) { + if (packet!!.redpacket_id == redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) { redEnvelopesFragment!!.setNeedTime(packetTime) } } @@ -4592,12 +4616,12 @@ class RoomActivity : BaseMvpActivity(), if (redEnvelopesFragment!!.mRedPacketInfo.conditions.contains("1")) { //有收藏房间条件 if (mRoomInfoResp!!.user_info.is_collect == 1) { - if(packet!!.redpacket_id==redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) { + if (packet!!.redpacket_id == redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) { redEnvelopesFragment!!.setNeedTime(packetTime) } } } else { - if(packet!!.redpacket_id==redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) { + if (packet!!.redpacket_id == redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) { redEnvelopesFragment!!.setNeedTime(packetTime) } } diff --git a/moduleroom/src/main/java/com/example/moduleroom/dialog/RoomGiftDialogFragment.java b/moduleroom/src/main/java/com/example/moduleroom/dialog/RoomGiftDialogFragment.java index 7aa69664..3b7a85e6 100644 --- a/moduleroom/src/main/java/com/example/moduleroom/dialog/RoomGiftDialogFragment.java +++ b/moduleroom/src/main/java/com/example/moduleroom/dialog/RoomGiftDialogFragment.java @@ -817,7 +817,9 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment pitList; private SharedViewModel sharedViewModel; + public static SingSongFragment newInstance(RoomInfoResp roomInfoResp) { Bundle args = new Bundle(); SingSongFragment fragment = new SingSongFragment(roomInfoResp); @@ -126,6 +127,7 @@ public class SingSongFragment extends BaseRoomFragment 8) { // if (roomInfoResp.getRoom_info().getPit_list().get(8).getUser_id().equals(SpUtil.getUserId() + "") && !pitNumber.equals("10")) { - if (roomInfoResp.getUser_info().getPit_number()==9 && !pitNumber.equals("10")) { + if (roomInfoResp.getUser_info().getPit_number() == 9 && !pitNumber.equals("10")) { return true; } return false; @@ -355,7 +357,7 @@ public class SingSongFragment extends BaseRoomFragment 0 && roomId != null) { - if (MvpPre==null){ + if (MvpPre == null) { MvpPre = new SingSongPresenter(this, getContext()); } MvpPre.userOnlineStatus(userIds.toString(), roomId); @@ -451,7 +453,10 @@ public class SingSongFragment extends BaseRoomFragment