allowing nullable message content in order to reset the content when recycling and an item doesn't contain a message
This commit is contained in:
parent
0df07d0a1e
commit
6380ee9176
|
@ -96,13 +96,12 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
|
||||||
renderSendState(holder.messageView, holder.messageView)
|
renderSendState(holder.messageView, holder.messageView)
|
||||||
holder.messageView.onClick(attributes.itemClickListener)
|
holder.messageView.onClick(attributes.itemClickListener)
|
||||||
holder.messageView.onLongClickIgnoringLinks(attributes.itemLongClickListener)
|
holder.messageView.onLongClickIgnoringLinks(attributes.itemLongClickListener)
|
||||||
|
holder.messageView.setTextWithEmojiSupport(message?.charSequence, bindingOptions)
|
||||||
message?.let { holder.messageView.setTextWithEmojiSupport(it.charSequence, bindingOptions) }
|
|
||||||
markwonPlugins?.forEach { plugin -> plugin.afterSetText(holder.messageView) }
|
markwonPlugins?.forEach { plugin -> plugin.afterSetText(holder.messageView) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun AppCompatTextView.setTextWithEmojiSupport(message: CharSequence, bindingOptions: BindingOptions?) {
|
private fun AppCompatTextView.setTextWithEmojiSupport(message: CharSequence?, bindingOptions: BindingOptions?) {
|
||||||
if (bindingOptions?.canUseTextFuture.orFalse()) {
|
if (bindingOptions?.canUseTextFuture.orFalse() && message != null) {
|
||||||
val textFuture = PrecomputedTextCompat.getTextFuture(message, TextViewCompat.getTextMetricsParams(this), null)
|
val textFuture = PrecomputedTextCompat.getTextFuture(message, TextViewCompat.getTextMetricsParams(this), null)
|
||||||
setTextFuture(textFuture)
|
setTextFuture(textFuture)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue