Fix crash...

This commit is contained in:
Benoit Marty 2023-12-20 09:38:59 +01:00 committed by Benoit Marty
parent fac8dd333a
commit 644587a98c

View File

@ -35,6 +35,7 @@ import im.vector.app.features.home.room.detail.timeline.url.PreviewUrlUiState
import im.vector.app.features.home.room.detail.timeline.url.PreviewUrlView
import im.vector.app.features.media.ImageContentRenderer
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
import io.element.android.wysiwyg.EditorStyledTextView
import io.noties.markwon.MarkwonPlugin
import org.matrix.android.sdk.api.extensions.orFalse
@ -138,13 +139,19 @@ 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)
var richMessageView: AppCompatTextView? = null
var richMessageView: EditorStyledTextView? = null
private set
var plainMessageView: AppCompatTextView? = null
private set
fun requireRichMessageView(): AppCompatTextView {
val view = richMessageView ?: richMessageStub.inflate().findViewById(R.id.messageTextView)
val view = richMessageView ?: richMessageStub.inflate().findViewById<EditorStyledTextView>(R.id.messageTextView).also {
// Required to ensure that `inlineCodeBgHelper` and `codeBlockBgHelper` are initialized
it.updateStyle(
styleConfig = it.styleConfig,
mentionDisplayHandler = null,
)
}
richMessageView = view
return view
}