mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-21 10:17:56 +00:00
Wait for global layout before animating in bottom action bar.
This commit is contained in:
@@ -2283,9 +2283,7 @@ class ConversationFragment :
|
||||
}
|
||||
|
||||
bottomActionBar.setItems(items)
|
||||
bottomActionBar.doAfterNextLayout {
|
||||
setBottomActionBarVisibility(true)
|
||||
}
|
||||
setBottomActionBarVisibility(true)
|
||||
}
|
||||
|
||||
private fun setBottomActionBarVisibility(isVisible: Boolean) {
|
||||
@@ -2300,24 +2298,21 @@ class ConversationFragment :
|
||||
|
||||
val additionalScrollOffset = 54.dp
|
||||
if (isVisible) {
|
||||
ViewUtil.animateIn(bottomActionBar, bottomActionBar.enterAnimation)
|
||||
container.hideInput()
|
||||
inputPanel.setHideForSelection(true)
|
||||
bottomActionBar.visibility = View.INVISIBLE
|
||||
animationsAllowed = false
|
||||
|
||||
bottomActionBar.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener {
|
||||
override fun onPreDraw(): Boolean {
|
||||
if (bottomActionBar.measuredHeight == 0 && bottomActionBar.visible) {
|
||||
return false
|
||||
}
|
||||
bottomActionBar.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
||||
override fun onGlobalLayout() {
|
||||
bottomActionBar.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
|
||||
bottomActionBar.viewTreeObserver.removeOnPreDrawListener(this)
|
||||
ViewUtil.animateIn(bottomActionBar, bottomActionBar.enterAnimation)
|
||||
container.hideInput()
|
||||
inputPanel.setHideForSelection(true)
|
||||
|
||||
val bottomPadding = bottomActionBar.measuredHeight + ((bottomActionBar.layoutParams as? ViewGroup.MarginLayoutParams)?.bottomMargin ?: 18.dp)
|
||||
ViewUtil.setPaddingBottom(binding.conversationItemRecycler, bottomPadding)
|
||||
binding.conversationItemRecycler.scrollBy(0, -(bottomPadding - additionalScrollOffset))
|
||||
animationsAllowed = true
|
||||
return false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user