优化麦圈,泄漏处理
This commit is contained in:
@@ -29,6 +29,7 @@ import com.xscm.moduleutil.utils.CustomMsgCode
|
||||
import io.reactivex.disposables.Disposable
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
@@ -41,9 +42,20 @@ open class Application : CommonAppContext() {
|
||||
|
||||
var isAgoraStop = false
|
||||
var inviteDialog: InviteDialog? = null
|
||||
var currDialogActivity: Activity? = null
|
||||
|
||||
// 改为弱引用持有Activity
|
||||
private var mCurDialogActivityRef: WeakReference<Activity>? = null
|
||||
|
||||
fun setCurDialogActivity(activity: Activity?) {
|
||||
mCurDialogActivityRef = WeakReference(activity)
|
||||
}
|
||||
|
||||
fun getCurDialogActivity(): Activity? {
|
||||
if (mCurDialogActivityRef != null) {
|
||||
return mCurDialogActivityRef!!.get()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -77,6 +89,10 @@ open class Application : CommonAppContext() {
|
||||
// 初始化单例实例
|
||||
instance = this
|
||||
|
||||
|
||||
configureLeakCanary()
|
||||
|
||||
|
||||
// 初始化并预绘制视图 二卡八列
|
||||
WheatLayoutSingManager.init(this)
|
||||
WheatLayoutSingManager.getInstance().setWheatData(null)
|
||||
@@ -91,6 +107,15 @@ open class Application : CommonAppContext() {
|
||||
initImMsg()
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义 LeakCanary 配置(解决误报、优化检测规则)
|
||||
*/
|
||||
private fun configureLeakCanary() {
|
||||
// LeakCanary.config = LeakCanary.config.copy(
|
||||
// retainedVisibleThreshold = 3, // 对象被观察几次GC未被回收才认为泄漏 (默认5)
|
||||
// )
|
||||
}
|
||||
|
||||
private fun initImMsg() {
|
||||
MessageListenerSingleton.getInstance().setOnMsgTaskListener { event ->
|
||||
when (event.msgType) {
|
||||
@@ -240,7 +265,7 @@ open class Application : CommonAppContext() {
|
||||
fun showInviteDialog(activity: Activity?, t: IndexRecommendRoom) {
|
||||
if (isKeepScreenOn)
|
||||
return
|
||||
if (activity != null && activity == currDialogActivity && inviteDialog != null) {
|
||||
if (activity != null && activity == getCurDialogActivity() && inviteDialog != null) {
|
||||
inviteDialog?.setData(t)
|
||||
return
|
||||
}
|
||||
@@ -249,7 +274,7 @@ open class Application : CommonAppContext() {
|
||||
|
||||
inviteDialog = activity?.let { InviteDialog(it, t) }
|
||||
inviteDialog?.setData(t)
|
||||
currDialogActivity = activity
|
||||
setCurDialogActivity(activity)
|
||||
}
|
||||
|
||||
private fun initLogUtils() {
|
||||
|
||||
@@ -168,6 +168,7 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
ClickUtils.clearAllClickRecords();
|
||||
|
||||
// 清理MQTT相关资源
|
||||
synchronized (mqttQueueLock) {
|
||||
mqttMessageQueue.clear();
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.azhon.appupdate.listener.OnButtonClickListener;
|
||||
import com.azhon.appupdate.listener.OnDownloadListener;
|
||||
import com.azhon.appupdate.manager.DownloadManager;
|
||||
import com.azhon.appupdate.util.ApkUtil;
|
||||
import com.blankj.utilcode.util.FragmentUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
@@ -47,6 +48,7 @@ import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.xscm.modulemain.Application;
|
||||
import com.xscm.modulemain.BaseMvpActivity;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.TransparentActivity;
|
||||
import com.xscm.modulemain.activity.main.contacts.HomeContacts;
|
||||
import com.xscm.modulemain.activity.main.presenter.HomePresenter;
|
||||
import com.xscm.modulemain.activity.msg.fragment.NewsFragment;
|
||||
@@ -142,7 +144,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// toActivity(TransparentActivity.class);
|
||||
// 处理新的intent
|
||||
// setIntent(intent);
|
||||
// 处理tab切换
|
||||
@@ -150,6 +152,12 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
LogUtils.e("MainActivity", "onWindowFocusChanged:"+hasFocus);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -184,6 +192,8 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
MessageListenerSingleton.getInstance().ensureListenersAdded();
|
||||
CommonAppContext.getInstance().upMqtt();
|
||||
Application.Companion.getInstance().bgToForeground();
|
||||
//delete downloaded old Apk
|
||||
ApkUtil.Companion.deleteOldApk(this,getExternalCacheDir().getAbsolutePath() + "/yusheng.apk");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -178,10 +178,7 @@ import com.xscm.moduleutil.widget.ViewUtils
|
||||
import com.xscm.moduleutil.widget.ViewUtils.OnViewCreatedListener
|
||||
import com.xscm.moduleutil.widget.floatingView.Floa
|
||||
import io.agora.musiccontentcenter.Music
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -192,7 +189,6 @@ import java.lang.ref.WeakReference
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.Arrays
|
||||
import java.util.Date
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.stream.Collectors
|
||||
|
||||
@Route(path = ARouteConstants.ROOM_DETAILS)
|
||||
@@ -235,10 +231,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
private var circularProgress: CircularProgressView? = null
|
||||
private var publicScreenFragment: ChatRoomFragment? = null // 添加成员变量
|
||||
|
||||
// 存储当前显示的弹框引用
|
||||
private val activeDialogs: MutableList<DialogInterface> = ArrayList()
|
||||
private val activeDialogFragments: MutableList<Fragment> = ArrayList()
|
||||
|
||||
private var isMinimized = false
|
||||
private var appStateListener: AppStateListener? = null
|
||||
|
||||
@@ -289,16 +281,20 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
taskId = intent.getStringExtra("taskId")
|
||||
mRoomInfoResp = roomInfoResp
|
||||
}
|
||||
setView(mRoomInfoResp)
|
||||
toActivity(TransparentActivity::class.java)
|
||||
LogUtils.e("RoomActivity", "onNewIntent")
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
LogUtils.e("RoomActivity", "onWindowFocusChanged:${hasFocus}")
|
||||
}
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// 在super.onCreate之前设置主题以避免闪白屏
|
||||
// setTheme(com.xscm.moduleutil.R.style.BaseAppTheme) // 设置你的主主题
|
||||
super.onCreate(savedInstanceState)
|
||||
// // 进入房间10s后检查是否显示提示上麦对话框
|
||||
|
||||
LogUtils.e("RoomActivity", "onCreate")
|
||||
isSave = false
|
||||
sDestroied = false
|
||||
@@ -606,16 +602,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
MvpPre?.getRoomOnline(roomId, "1", "10")
|
||||
}
|
||||
|
||||
// 添加弹框到管理列表
|
||||
fun addActiveDialog(dialog: DialogInterface) {
|
||||
activeDialogs.add(dialog)
|
||||
}
|
||||
|
||||
fun addActiveDialogFragment(dialogFragment: Fragment) {
|
||||
activeDialogFragments.add(dialogFragment)
|
||||
}
|
||||
|
||||
|
||||
private var bgEffectView: View? = null
|
||||
|
||||
private fun setupEffectView() {
|
||||
@@ -831,7 +817,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
})
|
||||
bottomSheet.show(supportFragmentManager, "ExitRoomBottomSheet")
|
||||
addActiveDialogFragment(bottomSheet)
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
@@ -906,21 +891,33 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
override fun onSelfInfoUpdated(info: V2TIMUserFullInfo?) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the room view with the provided room information response.
|
||||
*
|
||||
* @param resp The room information response object containing room details
|
||||
* @param isSwitchRoomType Flag indicating if room type is being switched (default: false)
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private fun setView(resp: RoomInfoResp?, isSwitchRoomType: Boolean = false) {
|
||||
// Return early if response is null
|
||||
if (resp == null)
|
||||
return
|
||||
// Update room info in app state manager and local instance
|
||||
AppStateManager.getInstance().roomInfo = resp
|
||||
this.mRoomInfoResp = resp
|
||||
val roomBean = resp.room_info
|
||||
// Log room info for debugging
|
||||
LogUtils.e("setView_mRoomBean", resp.toString())
|
||||
// Set user and owner information
|
||||
this.mRoomUserBean = resp.user_info
|
||||
this.mRoomOwnerBean = resp.room_owner
|
||||
this.roomId = roomBean.room_id
|
||||
|
||||
// Load room cover image and set room details
|
||||
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
|
||||
// Handle follow button visibility based on user role
|
||||
if (mRoomUserBean?.getIs_room_owner() == 1) {
|
||||
mBinding!!.roomTop.btnFollow.visibility = View.GONE
|
||||
} else {
|
||||
@@ -931,15 +928,19 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mBinding!!.roomTop.btnFollow.text = ""
|
||||
}
|
||||
}
|
||||
// Set online number display
|
||||
number = roomBean.online_number
|
||||
mBinding!!.roomTop.tvNum.text = number.toString() + ""
|
||||
|
||||
// Set initial view if not switching room type
|
||||
if (!isSwitchRoomType) {
|
||||
setviewyc(true)
|
||||
}
|
||||
|
||||
|
||||
// Log room join action
|
||||
LogUtils.e("加入", roomId)
|
||||
// Build comma-separated user IDs from pit list
|
||||
val userIds = StringBuilder()
|
||||
if (mRoomInfoResp?.room_info?.pit_list != null) {
|
||||
for (i in mRoomInfoResp?.room_info?.pit_list!!.indices) {
|
||||
@@ -952,6 +953,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
// Update app context with room information
|
||||
CommonAppContext.getInstance().isPlaying = true
|
||||
CommonAppContext.getInstance().playId = roomId
|
||||
CommonAppContext.getInstance().playName = mRoomInfoResp?.room_info?.room_name
|
||||
@@ -959,6 +961,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
CommonAppContext.getInstance().playCover = resp.room_info.room_cover
|
||||
CommonAppContext.getInstance().showSelf = resp.is_show_self == 1
|
||||
|
||||
// Update follow button appearance based on collection status
|
||||
if (mRoomUserBean?.getIs_collect() == 1) {
|
||||
mBinding!!.roomTop.btnFollow.background =
|
||||
resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
|
||||
@@ -972,19 +975,23 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
|
||||
mBinding!!.roomTop.btnFollow.text = "收藏"
|
||||
}
|
||||
// Set music type based on room type
|
||||
if ((roomBean.type_id == "3" || roomBean.type_id == "1" || roomBean.type_id == "4") && roomBean.label_id == "2") {
|
||||
AgoraManager.getInstance().isBjMusic = false
|
||||
} else {
|
||||
AgoraManager.getInstance().isBjMusic = true
|
||||
}
|
||||
|
||||
// Update user permissions
|
||||
userPermissionChange()
|
||||
|
||||
// Hide PK and misc views for specific room types
|
||||
if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
|
||||
mBinding!!.rlPk.visibility = View.GONE
|
||||
mBinding!!.rlMisc.visibility = View.GONE
|
||||
}
|
||||
|
||||
// Handle lucky draw countdown visibility
|
||||
if (mRoomInfoResp?.gift_cycle?.xlh_info?.xlh_status == "1") {
|
||||
mBinding?.xlhRk?.visibility = View.VISIBLE
|
||||
xlhDjs(mRoomInfoResp?.gift_cycle?.xlh_info?.end_time)
|
||||
@@ -993,6 +1000,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
releaseCountDownTimer1()
|
||||
}
|
||||
|
||||
// Show/hide hourly ranking based on settings
|
||||
if (mRoomInfoResp?.hour_ranking_open == 1) {
|
||||
mBinding!!.clXsb.visibility = View.VISIBLE
|
||||
} else {
|
||||
@@ -1098,9 +1106,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomId, null,
|
||||
supportFragmentManager, "", ""
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
}, 1400)
|
||||
}
|
||||
hideGiftGiveProgress()
|
||||
@@ -1133,9 +1138,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomId, null,
|
||||
supportFragmentManager, "", ""
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
}, 1400)
|
||||
}
|
||||
hideGiftGiveProgress()
|
||||
@@ -2258,6 +2260,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
val pitArr: MutableList<RoomPitBean> = ArrayList()
|
||||
for (j in text.list.indices) {
|
||||
val roomPitBean = getRoomPitBean(messageEvent, j)
|
||||
if(roomPitBean.user_id.equals(mRoomInfoResp?.user_info?.user_id.toString())){
|
||||
mRoomInfoResp?.user_info?.pit_number = roomPitBean.pit_number.toInt()
|
||||
roomBtnShowIsHide(mRoomInfoResp?.user_info?.user_id!!)
|
||||
}
|
||||
pitArr.add(roomPitBean)
|
||||
}
|
||||
|
||||
@@ -2458,7 +2464,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}, true, 10
|
||||
)
|
||||
dialog.show()
|
||||
addActiveDialog(dialog)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2521,11 +2526,9 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomNoticeDialogFragment.setTitle("公告")
|
||||
roomNoticeDialogFragment.setContent(mRoomInfoResp?.room_info?.room_intro)
|
||||
roomNoticeDialogFragment.show()
|
||||
addActiveDialog(roomNoticeDialogFragment)
|
||||
} else if (id == R.id.btn_ranking) { //排行榜
|
||||
val fragment = RoomChartsFragment.newInstance(roomId, mRoomInfoResp)
|
||||
fragment.show(supportFragmentManager, "RoomChartsFragment")
|
||||
addActiveDialogFragment(fragment)
|
||||
} else if (id == R.id.btn_close_live) { //退出房间
|
||||
showExitRoomDialog()
|
||||
} else if (id == R.id.tv_num) {
|
||||
@@ -2572,9 +2575,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mRoomInfoResp,
|
||||
supportFragmentManager
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
} else if (id == R.id.rl_voive) {
|
||||
voive = !voive
|
||||
if (voive) {
|
||||
@@ -2597,39 +2597,26 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
LogUtils.e("pk_info", "id == R.id.rl_pk ${mRoomInfoResp?.room_info?.is_pk!!}")
|
||||
fragment.show(supportFragmentManager, "RoomPkDialogFragment")
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
} else if (id == R.id.rl_message) {
|
||||
val fragment = RoomMessageDialogFragment.show(
|
||||
supportFragmentManager
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
} else if (id == R.id.rl_misc) { //设置点歌
|
||||
val fragment = RequestDialogFragment.show(
|
||||
roomId, mRoomInfoResp, 1,
|
||||
supportFragmentManager
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
} else if (id == R.id.rl_gift) { //礼物
|
||||
LogUtils.e("RoomGiftDialogFragment_RoomActivity");
|
||||
val fragment = RoomGiftDialogFragment.show(
|
||||
mRoomInfoResp, null, roomId, 0, "",
|
||||
supportFragmentManager
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
} else if (id == R.id.iv_sound_effects) {
|
||||
val fragment = SoundEffectsDialogFragment.show(
|
||||
roomId,
|
||||
supportFragmentManager
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
} else if (id == R.id.cl_first_charge) {
|
||||
roomFragment!!.showWheatFeedingDialog(
|
||||
roomId,
|
||||
@@ -2776,7 +2763,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
{ v: View? -> }, false, 0
|
||||
)
|
||||
dialog.show()
|
||||
addActiveDialog(dialog)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3033,9 +3019,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomId,
|
||||
supportFragmentManager
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
}
|
||||
mBinding!!.ivQuanC.setOnClickListener { v: View? ->
|
||||
if (mRoomInfoResp?.room_info?.head_line?.room_id != null && mRoomInfoResp?.room_info?.head_line?.room_id!!.isNotEmpty()) {
|
||||
@@ -3157,7 +3140,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
override fun showPasswordDialog() {
|
||||
val roomPasswordSetDialogFragment = RoomPasswordSetDialogFragment.newInstance(true, roomId)
|
||||
roomPasswordSetDialogFragment.show(supportFragmentManager)
|
||||
addActiveDialogFragment(roomPasswordSetDialogFragment)
|
||||
}
|
||||
|
||||
override fun enterFail() {
|
||||
@@ -3195,9 +3177,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomId, mRoomInfoResp, 2,
|
||||
supportFragmentManager
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
}
|
||||
|
||||
is RoomInputHideEvent -> {
|
||||
@@ -3518,11 +3497,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomId, pitNumber, mOnlineBean, mRoomUserBean, mRoomInfoResp,
|
||||
supportFragmentManager
|
||||
)
|
||||
|
||||
LogUtils.e("fragment_onItemClickListener: ${(fragment != null)}")
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
}
|
||||
}
|
||||
|
||||
override fun applyPit() {
|
||||
@@ -3850,8 +3825,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// if (AgoraManager.getInstance() != null) {
|
||||
// AgoraManager.getInstance().cleanup();
|
||||
// }
|
||||
// 清理所有弹框
|
||||
dismissAllDialogs()
|
||||
// 7. 清理 Fragment
|
||||
cleanupFragments()
|
||||
|
||||
@@ -3897,34 +3870,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
newParent.addView(view)
|
||||
}
|
||||
|
||||
// 清理所有弹框
|
||||
private fun dismissAllDialogs() {
|
||||
// 关闭 AlertDialog 实例
|
||||
for (dialog in activeDialogs) {
|
||||
if (dialog != null) {
|
||||
try {
|
||||
dialog.dismiss()
|
||||
} catch (e: Exception) {
|
||||
LogUtils.e("dismiss dialog error: " + e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
activeDialogs.clear()
|
||||
|
||||
// 移除 DialogFragment
|
||||
for (fragment in activeDialogFragments) {
|
||||
if (fragment != null && fragment.isAdded) {
|
||||
try {
|
||||
if (fragment is DialogFragment) {
|
||||
fragment.dismissAllowingStateLoss()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
LogUtils.e("dismiss dialog fragment error: " + e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
activeDialogFragments.clear()
|
||||
}
|
||||
|
||||
private fun clearSVGAResources() {
|
||||
try {
|
||||
@@ -4319,8 +4264,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
LogUtils.e("AlertDialog已关闭")
|
||||
}
|
||||
dialog.show()
|
||||
addActiveDialog(dialog) // 添加到管理列表
|
||||
|
||||
}
|
||||
|
||||
fun dialogMessage(event: RoomInputEvent) {
|
||||
|
||||
Reference in New Issue
Block a user