Only animate on banner creation.

This commit is contained in:
Michelle Tang
2025-12-11 12:14:48 -05:00
committed by Alex Hart
parent d98f51395f
commit 4d8ed34d94
2 changed files with 7 additions and 3 deletions

View File

@@ -139,7 +139,7 @@ class ConversationBannerView @JvmOverloads constructor(
hide(voiceNotePlayerStub)
}
fun showPinnedMessageStub(messages: List<ConversationMessage>, canUnpin: Boolean, hasWallpaper: Boolean) {
fun showPinnedMessageStub(messages: List<ConversationMessage>, canUnpin: Boolean, hasWallpaper: Boolean, shouldAnimate: Boolean) {
val firstRender = !pinnedMessageStub.isVisible
val view = pinnedMessageStub.get()
@@ -158,7 +158,7 @@ class ConversationBannerView @JvmOverloads constructor(
}
}
if (firstRender) {
if (firstRender && shouldAnimate) {
view.visibility = INVISIBLE
view.post {
view.visible = true
@@ -172,6 +172,8 @@ class ConversationBannerView @JvmOverloads constructor(
.setDuration(ANIMATION_DURATION)
.start()
}
} else {
view.visible = true
}
}

View File

@@ -571,6 +571,7 @@ class ConversationFragment :
private var scrollListener: ScrollListener? = null
private var keyboardEvents: KeyboardEvents? = null
private var progressDialog: ProgressCardDialogFragment? = null
private var firstPinRender: Boolean = true
private val jumpAndPulseScrollStrategy = object : ScrollToPositionDelegate.ScrollStrategy {
override fun performScroll(recyclerView: RecyclerView, layoutManager: LinearLayoutManager, position: Int, smooth: Boolean) {
@@ -1354,10 +1355,11 @@ class ConversationFragment :
private fun presentPinnedMessage(pinnedMessages: List<ConversationMessage>, hasWallpaper: Boolean) {
if (pinnedMessages.isNotEmpty()) {
binding.conversationBanner.showPinnedMessageStub(messages = pinnedMessages, canUnpin = conversationGroupViewModel.canEditGroupInfo(), hasWallpaper = hasWallpaper)
binding.conversationBanner.showPinnedMessageStub(messages = pinnedMessages, canUnpin = conversationGroupViewModel.canEditGroupInfo(), hasWallpaper = hasWallpaper, shouldAnimate = !firstPinRender)
} else {
binding.conversationBanner.hidePinnedMessageStub()
}
firstPinRender = false
}
private fun presentTypingIndicator() {