Fix issue with timeline message view reuse while rich text editor is enabled (#8688)

This commit is contained in:
jonnyandrew 2023-11-17 17:09:18 +00:00 committed by GitHub
parent fd5530a2f9
commit 63ef40f58b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 6 deletions

1
changelog.d/8688.bugfix Normal file
View File

@ -0,0 +1 @@
Fix issue with timeline message view reuse while rich text editor is enabled

View File

@ -85,8 +85,13 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
}
holder.previewUrlView.delegate = previewUrlCallback
holder.previewUrlView.renderMessageLayout(attributes.informationData.messageLayout)
val messageView: AppCompatTextView = if (useRichTextEditorStyle) holder.richMessageView else holder.plainMessageView
if (useRichTextEditorStyle) {
holder.plainMessageView?.isVisible = false
} else {
holder.richMessageView?.isVisible = false
}
val messageView: AppCompatTextView = if (useRichTextEditorStyle) holder.requireRichMessageView() else holder.requirePlainMessageView()
messageView.isVisible = true
if (useBigFont) {
messageView.textSize = 44F
} else {
@ -133,11 +138,21 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
val previewUrlView by bind<PreviewUrlView>(R.id.messageUrlPreview)
private val richMessageStub by bind<ViewStub>(R.id.richMessageTextViewStub)
private val plainMessageStub by bind<ViewStub>(R.id.plainMessageTextViewStub)
val richMessageView: AppCompatTextView by lazy {
richMessageStub.inflate().findViewById(R.id.messageTextView)
var richMessageView: AppCompatTextView? = null
private set
var plainMessageView: AppCompatTextView? = null
private set
fun requireRichMessageView(): AppCompatTextView {
val view = richMessageView ?: richMessageStub.inflate().findViewById(R.id.messageTextView)
richMessageView = view
return view
}
val plainMessageView: AppCompatTextView by lazy {
plainMessageStub.inflate().findViewById(R.id.messageTextView)
fun requirePlainMessageView(): AppCompatTextView {
val view = plainMessageView ?: plainMessageStub.inflate().findViewById(R.id.messageTextView)
plainMessageView = view
return view
}
}