mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 12:38:33 +00:00
Fix bubbles jumping around when entering selection mode.
This commit is contained in:
@@ -61,6 +61,9 @@ open class InsetAwareConstraintLayout @JvmOverloads constructor(
|
|||||||
private var overridingKeyboard: Boolean = false
|
private var overridingKeyboard: Boolean = false
|
||||||
private var previousKeyboardHeight: Int = 0
|
private var previousKeyboardHeight: Int = 0
|
||||||
|
|
||||||
|
val isKeyboardShowing: Boolean
|
||||||
|
get() = previousKeyboardHeight > 0
|
||||||
|
|
||||||
init {
|
init {
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(this) { _, windowInsetsCompat ->
|
ViewCompat.setOnApplyWindowInsetsListener(this) { _, windowInsetsCompat ->
|
||||||
applyInsets(windowInsets = windowInsetsCompat.getInsets(windowTypes), keyboardInsets = windowInsetsCompat.getInsets(keyboardType))
|
applyInsets(windowInsets = windowInsetsCompat.getInsets(windowTypes), keyboardInsets = windowInsetsCompat.getInsets(keyboardType))
|
||||||
|
|||||||
@@ -1868,18 +1868,21 @@ class ConversationFragment :
|
|||||||
val additionalScrollOffset = 54.dp
|
val additionalScrollOffset = 54.dp
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
ViewUtil.animateIn(bottomActionBar, bottomActionBar.enterAnimation)
|
ViewUtil.animateIn(bottomActionBar, bottomActionBar.enterAnimation)
|
||||||
|
container.hideInput()
|
||||||
inputPanel.setHideForSelection(true)
|
inputPanel.setHideForSelection(true)
|
||||||
|
animationsAllowed = false
|
||||||
|
|
||||||
bottomActionBar.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener {
|
bottomActionBar.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener {
|
||||||
override fun onPreDraw(): Boolean {
|
override fun onPreDraw(): Boolean {
|
||||||
if (bottomActionBar.height == 0 && bottomActionBar.visible) {
|
if (bottomActionBar.height == 0 && bottomActionBar.visible) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomActionBar.viewTreeObserver.removeOnPreDrawListener(this)
|
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)
|
ViewUtil.setPaddingBottom(binding.conversationItemRecycler, bottomPadding)
|
||||||
binding.conversationItemRecycler.scrollBy(0, -(bottomPadding - additionalScrollOffset))
|
binding.conversationItemRecycler.scrollBy(0, -(bottomPadding - additionalScrollOffset))
|
||||||
|
animationsAllowed = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -2638,7 +2641,7 @@ class ConversationFragment :
|
|||||||
|
|
||||||
val snapshot = ConversationItemSelection.snapshotView(target, binding.conversationItemRecycler, messageRecord, videoBitmap)
|
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 bodyBubble = target.bubbleView
|
||||||
val selectedConversationModel = SelectedConversationModel(
|
val selectedConversationModel = SelectedConversationModel(
|
||||||
snapshot,
|
snapshot,
|
||||||
|
|||||||
Reference in New Issue
Block a user