diff --git a/vector/src/main/java/im/vector/riotx/core/epoxy/bottomsheet/BottomSheetItemMessagePreview.kt b/vector/src/main/java/im/vector/riotx/core/epoxy/bottomsheet/BottomSheetItemMessagePreview.kt index 7f6ff6fc78..fdad24c34e 100644 --- a/vector/src/main/java/im/vector/riotx/core/epoxy/bottomsheet/BottomSheetItemMessagePreview.kt +++ b/vector/src/main/java/im/vector/riotx/core/epoxy/bottomsheet/BottomSheetItemMessagePreview.kt @@ -16,6 +16,7 @@ */ package im.vector.riotx.core.epoxy.bottomsheet +import android.text.method.MovementMethod import android.widget.ImageView import android.widget.TextView import com.airbnb.epoxy.EpoxyAttribute @@ -25,8 +26,6 @@ import im.vector.riotx.core.epoxy.VectorEpoxyHolder import im.vector.riotx.core.epoxy.VectorEpoxyModel import im.vector.riotx.core.extensions.setTextOrHide import im.vector.riotx.features.home.AvatarRenderer -import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController -import im.vector.riotx.features.home.room.detail.timeline.tools.createLinkMovementMethod import im.vector.riotx.features.home.room.detail.timeline.tools.findPillsAndProcess /** @@ -48,12 +47,12 @@ abstract class BottomSheetItemMessagePreview : VectorEpoxyModel null } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt index 417f8d2f9a..de2686de04 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -42,6 +42,7 @@ import im.vector.riotx.core.utils.isLocalFile import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController import im.vector.riotx.features.home.room.detail.timeline.helper.* import im.vector.riotx.features.home.room.detail.timeline.item.* +import im.vector.riotx.features.home.room.detail.timeline.tools.createLinkMovementMethod import im.vector.riotx.features.home.room.detail.timeline.tools.linkify import im.vector.riotx.features.html.CodeVisitor import im.vector.riotx.features.html.EventHtmlRenderer @@ -270,7 +271,7 @@ class MessageItemFactory @Inject constructor( .leftGuideline(avatarSizeProvider.leftGuideline) .attributes(attributes) .highlighted(highlight) - .urlClickCallback(callback) + .movementMethod(createLinkMovementMethod(callback)) } private fun buildCodeBlockItem(formattedBody: CharSequence, @@ -348,7 +349,7 @@ class MessageItemFactory @Inject constructor( .attributes(attributes) .message(message) .highlighted(highlight) - .urlClickCallback(callback) + .movementMethod(createLinkMovementMethod(callback)) } private fun buildEmoteMessageItem(messageContent: MessageEmoteContent, @@ -372,7 +373,7 @@ class MessageItemFactory @Inject constructor( .leftGuideline(avatarSizeProvider.leftGuideline) .attributes(attributes) .highlighted(highlight) - .urlClickCallback(callback) + .movementMethod(createLinkMovementMethod(callback)) } private fun buildRedactedItem(attributes: AbsMessageItem.Attributes, diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MessageTextItem.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MessageTextItem.kt index 15aa5aa4cb..5ee0576be7 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MessageTextItem.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/MessageTextItem.kt @@ -16,14 +16,13 @@ package im.vector.riotx.features.home.room.detail.timeline.item +import android.text.method.MovementMethod import androidx.appcompat.widget.AppCompatTextView import androidx.core.text.PrecomputedTextCompat import androidx.core.widget.TextViewCompat import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import im.vector.riotx.R -import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController -import im.vector.riotx.features.home.room.detail.timeline.tools.createLinkMovementMethod import im.vector.riotx.features.home.room.detail.timeline.tools.findPillsAndProcess @EpoxyModelClass(layout = R.layout.item_timeline_event_base) @@ -36,11 +35,11 @@ abstract class MessageTextItem : AbsMessageItem() { @EpoxyAttribute var useBigFont: Boolean = false @EpoxyAttribute - var urlClickCallback: TimelineEventController.UrlClickCallback? = null + var movementMethod: MovementMethod? = null override fun bind(holder: Holder) { super.bind(holder) - holder.messageView.movementMethod = createLinkMovementMethod(urlClickCallback) + holder.messageView.movementMethod = movementMethod if (useBigFont) { holder.messageView.textSize = 44F } else {