Skip to content

Commit

Permalink
fix:修复app浮窗展示逻辑异常
Browse files Browse the repository at this point in the history
  • Loading branch information
Petterpx committed Apr 22, 2024
1 parent 33854b9 commit 47579d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class FxAppLifecycleImp(
if (activity.isActivityInValid) it.onDestroyed(activity)
}
val isParent = activity.isParent
fxLog.d("fxApp->detach? isContainActivity-${activity.isActivityInValid}--enableFx-$enableFx---isParent-$isParent")
fxLog.d("fxApp->check detach: isContainActivity-${activity.isActivityInValid}--enableFx-$enableFx---isParent-$isParent")
if (isParent) appControl.destroyToDetach(activity)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,23 @@ class FxAppPlatformProvider(
val fxView = _internalView ?: return
if (!ViewCompat.isAttachedToWindow(fxView)) {
fxView.visibility = View.VISIBLE
containerGroupView?.safeAddView(fxView)
checkOrReInitGroupView()?.safeAddView(fxView)
}
}

override fun hide() {
detach()
}

private fun checkOrReInitGroupView(): ViewGroup? {
val curGroup = containerGroupView
if (curGroup == null || curGroup !== topActivity?.decorView) {
_containerGroup = WeakReference(topActivity?.decorView)
helper.fxLog.v("view-----> reinitialize the fx container")
}
return containerGroupView
}

private fun attach(activity: Activity): Boolean {
val fxView = _internalView ?: return false
val decorView = activity.decorView ?: return false
Expand Down Expand Up @@ -123,6 +132,8 @@ class FxAppPlatformProvider(
private fun detach() {
_internalView?.visibility = View.GONE
containerGroupView?.removeView(_internalView)
_containerGroup?.clear()
_containerGroup = null
}

private fun initWindowsInsetsListener() {
Expand Down

0 comments on commit 47579d5

Please sign in to comment.