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