Change usage of SpannableStringBuilder when this is not required

This commit is contained in:
Benoit Marty 2021-12-13 13:14:20 +01:00
parent df3f8bd88e
commit ab70ee5ae2
2 changed files with 3 additions and 3 deletions

View File

@ -16,6 +16,7 @@
package im.vector.app.features.home.room.detail.timeline.factory package im.vector.app.features.home.room.detail.timeline.factory
import android.text.Spannable
import android.text.SpannableStringBuilder import android.text.SpannableStringBuilder
import android.text.Spanned import android.text.Spanned
import android.text.TextPaint import android.text.TextPaint
@ -515,7 +516,7 @@ class MessageItemFactory @Inject constructor(
private fun annotateWithEdited(linkifiedBody: CharSequence, private fun annotateWithEdited(linkifiedBody: CharSequence,
callback: TimelineEventController.Callback?, callback: TimelineEventController.Callback?,
informationData: MessageInformationData): SpannableStringBuilder { informationData: MessageInformationData): Spannable {
val spannable = SpannableStringBuilder() val spannable = SpannableStringBuilder()
spannable.append(linkifiedBody) spannable.append(linkifiedBody)
val editedSuffix = stringProvider.getString(R.string.edited_suffix) val editedSuffix = stringProvider.getString(R.string.edited_suffix)

View File

@ -16,7 +16,6 @@
package im.vector.app.features.home.room.detail.timeline.tools package im.vector.app.features.home.room.detail.timeline.tools
import android.text.SpannableStringBuilder
import android.text.style.ClickableSpan import android.text.style.ClickableSpan
import android.view.MotionEvent import android.view.MotionEvent
import android.widget.TextView import android.widget.TextView
@ -45,7 +44,7 @@ fun CharSequence.findPillsAndProcess(scope: CoroutineScope, processBlock: (PillI
fun CharSequence.linkify(callback: TimelineEventController.UrlClickCallback?): CharSequence { fun CharSequence.linkify(callback: TimelineEventController.UrlClickCallback?): CharSequence {
val text = this.toString() val text = this.toString()
val spannable = SpannableStringBuilder(this) val spannable = toSpannable()
MatrixLinkify.addLinks(spannable, object : MatrixPermalinkSpan.Callback { MatrixLinkify.addLinks(spannable, object : MatrixPermalinkSpan.Callback {
override fun onUrlClicked(url: String) { override fun onUrlClicked(url: String) {
callback?.onUrlClicked(url, text) callback?.onUrlClicked(url, text)