Commit 3c0630bf authored by Viktor De Pasquale's avatar Viktor De Pasquale Committed by John Wu

Added forced checks on view being attached to window before performing hiding on it

parent bf84dd65
......@@ -148,6 +148,32 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
val topView = binding.mainToolbarWrapper
val bottomView = binding.mainBottomBar
if (
Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
!binding.mainBottomBar.isAttachedToWindow
) {
binding.mainBottomBar.viewTreeObserver.addOnWindowAttachListener(object :
ViewTreeObserver.OnWindowAttachListener {
init {
val listener =
binding.mainBottomBar.tag as? ViewTreeObserver.OnWindowAttachListener
if (listener != null) {
binding.mainBottomBar.viewTreeObserver.removeOnWindowAttachListener(listener)
}
binding.mainBottomBar.tag = this
}
override fun onWindowAttached() {
requestNavigationHidden(hide)
}
override fun onWindowDetached() {
}
})
return
}
val topParams = topView.layoutParams as? CoordinatorLayout.LayoutParams
val bottomParams = bottomView.layoutParams as? CoordinatorLayout.LayoutParams
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment