Added forced checks on view being attached to window before performing hiding on it
This commit is contained in:
parent
bf84dd6518
commit
3c0630bfc0
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user