Fix crash...
This commit is contained in:
parent
fac8dd333a
commit
644587a98c
|
@ -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.home.room.detail.timeline.url.PreviewUrlView
|
||||||
import im.vector.app.features.media.ImageContentRenderer
|
import im.vector.app.features.media.ImageContentRenderer
|
||||||
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
|
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
|
||||||
|
import io.element.android.wysiwyg.EditorStyledTextView
|
||||||
import io.noties.markwon.MarkwonPlugin
|
import io.noties.markwon.MarkwonPlugin
|
||||||
import org.matrix.android.sdk.api.extensions.orFalse
|
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)
|
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)
|
||||||
var richMessageView: AppCompatTextView? = null
|
var richMessageView: EditorStyledTextView? = null
|
||||||
private set
|
private set
|
||||||
var plainMessageView: AppCompatTextView? = null
|
var plainMessageView: AppCompatTextView? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
fun requireRichMessageView(): AppCompatTextView {
|
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
|
richMessageView = view
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue