Skip to content

Commit

Permalink
allowing nullable message content in order to reset the content when …
Browse files Browse the repository at this point in the history
…recycling and an item doesn't contain a message
  • Loading branch information
ouchadam committed Jan 5, 2022
1 parent 627da49 commit b5ce8dc
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
renderSendState(holder.messageView, holder.messageView)
holder.messageView.onClick(attributes.itemClickListener)
holder.messageView.onLongClickIgnoringLinks(attributes.itemLongClickListener)

message?.let { holder.messageView.setTextWithEmojiSupport(it, bindingOptions) }
holder.messageView.setTextWithEmojiSupport(message, bindingOptions)
}

private fun AppCompatTextView.setTextWithEmojiSupport(message: CharSequence, bindingOptions: BindingOptions?) {
if (bindingOptions?.canUseTextFuture.orFalse()) {
private fun AppCompatTextView.setTextWithEmojiSupport(message: CharSequence?, bindingOptions: BindingOptions?) {
if (bindingOptions?.canUseTextFuture.orFalse() && message != null) {
val textFuture = PrecomputedTextCompat.getTextFuture(message, TextViewCompat.getTextMetricsParams(this), null)
setTextFuture(textFuture)
} else {
Expand Down

0 comments on commit b5ce8dc

Please sign in to comment.