[6.4.4][状态栏] 修正状态栏状态展示异常

This commit is contained in:
renwj
2024-06-11 20:39:17 +08:00
parent aad91cdd7d
commit c3499a5124
2 changed files with 5 additions and 4 deletions

View File

@@ -60,9 +60,9 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
}
}
onDetach {
observer?.also { model.status.removeObserver(it) }
}
// onDetach {
// observer?.also { model.status.removeObserver(it) }
// }
}
override fun onVisibilityChanged(changedView: View, visibility: Int) {

View File

@@ -75,9 +75,10 @@ val <T: View> T.lifecycleOwner: LifecycleOwner
override fun onViewDetachedFromWindow(v: View) {
lifecycle.let {
if (it.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
if (ViewCompat.isAttachedToWindow(v) && it.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
this@lifecycleOwner.removeOnAttachStateChangeListener(this)
it.currentState = Lifecycle.State.DESTROYED
setTag(R.id.view_lifecycle_owner, null)
}
}
}