Fix bubbles jumping around when entering selection mode.

This commit is contained in:
Cody Henthorne
2023-07-18 15:26:46 -04:00
committed by Nicholas
parent 67d4f666ce
commit 4910050891
2 changed files with 9 additions and 3 deletions

View File

@@ -61,6 +61,9 @@ open class InsetAwareConstraintLayout @JvmOverloads constructor(
private var overridingKeyboard: Boolean = false
private var previousKeyboardHeight: Int = 0
val isKeyboardShowing: Boolean
get() = previousKeyboardHeight > 0
init {
ViewCompat.setOnApplyWindowInsetsListener(this) { _, windowInsetsCompat ->
applyInsets(windowInsets = windowInsetsCompat.getInsets(windowTypes), keyboardInsets = windowInsetsCompat.getInsets(keyboardType))

View File

@@ -1868,18 +1868,21 @@ class ConversationFragment :
val additionalScrollOffset = 54.dp
if (isVisible) {
ViewUtil.animateIn(bottomActionBar, bottomActionBar.enterAnimation)
container.hideInput()
inputPanel.setHideForSelection(true)
animationsAllowed = false
bottomActionBar.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener {
override fun onPreDraw(): Boolean {
if (bottomActionBar.height == 0 && bottomActionBar.visible) {
return false
}
bottomActionBar.viewTreeObserver.removeOnPreDrawListener(this)
val bottomPadding = bottomActionBar.height + 18.dp
val bottomPadding = bottomActionBar.height + ((bottomActionBar.layoutParams as? ViewGroup.MarginLayoutParams)?.bottomMargin ?: 18.dp)
ViewUtil.setPaddingBottom(binding.conversationItemRecycler, bottomPadding)
binding.conversationItemRecycler.scrollBy(0, -(bottomPadding - additionalScrollOffset))
animationsAllowed = true
return false
}
})
@@ -2638,7 +2641,7 @@ class ConversationFragment :
val snapshot = ConversationItemSelection.snapshotView(target, binding.conversationItemRecycler, messageRecord, videoBitmap)
val focusedView = if (container.isInputShowing) null else itemView.rootView.findFocus()
val focusedView = if (container.isInputShowing || !container.isKeyboardShowing) null else itemView.rootView.findFocus()
val bodyBubble = target.bubbleView
val selectedConversationModel = SelectedConversationModel(
snapshot,