isAdd 直接推出

This commit is contained in:
yangyakun
2023-06-08 17:30:48 +08:00
parent b34557f8e4
commit 0bc955d56c

View File

@@ -211,7 +211,7 @@ class M1ContainFragment :
mShownByMe.isAccessible = true
mDismissed.setBoolean(this, false)
mShownByMe.setBoolean(this, true)
if (isAdded) { //解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
if (isAdded) {
return
}
val ft: FragmentTransaction = manager.beginTransaction()
@@ -300,10 +300,8 @@ class M1ContainFragment :
}
if (ClickUtils.isFastClick()) {
if (bpFunctionGroup.isAdded) {
//解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
parentFragmentManager.beginTransaction().remove(bpFunctionGroup)
.commitNowAllowingStateLoss()
CallerLogger.d(M_BUS_P + DebugViewWatchDogFragment.TAG, "已经添加正在移除")
CallerLogger.d(M_BUS_P + DebugViewWatchDogFragment.TAG, "已经添加")
return
}
bpFunctionGroup.show(parentFragmentManager, TAG)
CallerLogger.d(M_BUS_P + TAG, "展示$tab---$bpFunctionGroup")