From e4d0e0b0bf73e5085fc971d6f788d14592a65326 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 15 Oct 2019 11:02:16 +0200 Subject: [PATCH] Update after Ganfra's review --- .../detail/timeline/factory/MessageItemFactory.kt | 13 +++++++++---- .../timeline/helper/MessageItemAttributesFactory.kt | 3 --- .../room/detail/timeline/item/AbsMessageItem.kt | 2 -- 3 files changed, 9 insertions(+), 9 deletions(-) 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 4619eb4c8e..0bb5c3a1d8 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 @@ -53,6 +53,7 @@ import javax.inject.Inject class MessageItemFactory @Inject constructor( private val colorProvider: ColorProvider, + private val dimensionConverter: DimensionConverter, private val timelineMediaSizeProvider: TimelineMediaSizeProvider, private val htmlRenderer: Lazy, private val stringProvider: StringProvider, @@ -243,7 +244,7 @@ class MessageItemFactory @Inject constructor( return MessageTextItem_() .apply { if (informationData.hasBeenEdited) { - val spannable = annotateWithEdited(linkifiedBody, callback, attributes.dimensionConverter, informationData) + val spannable = annotateWithEdited(linkifiedBody, callback, informationData) message(spannable) } else { message(linkifiedBody) @@ -260,7 +261,6 @@ class MessageItemFactory @Inject constructor( private fun annotateWithEdited(linkifiedBody: CharSequence, callback: TimelineEventController.Callback?, - dimensionConverter: DimensionConverter, informationData: MessageInformationData): SpannableStringBuilder { val spannable = SpannableStringBuilder() spannable.append(linkifiedBody) @@ -276,7 +276,12 @@ class MessageItemFactory @Inject constructor( Spanned.SPAN_INCLUSIVE_EXCLUSIVE) // Note: text size is set to 14sp - spannable.setSpan(AbsoluteSizeSpan(dimensionConverter.spToPx(13)), editStart, editEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + spannable.setSpan( + AbsoluteSizeSpan(dimensionConverter.spToPx(13)), + editStart, + editEnd, + Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + spannable.setSpan(object : ClickableSpan() { override fun onClick(widget: View?) { callback?.onEditedDecorationClicked(informationData) @@ -326,7 +331,7 @@ class MessageItemFactory @Inject constructor( return MessageTextItem_() .apply { if (informationData.hasBeenEdited) { - val spannable = annotateWithEdited(message, callback, attributes.dimensionConverter, informationData) + val spannable = annotateWithEdited(message, callback, informationData) message(spannable) } else { message(message) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt index dddf507453..0e1229eeca 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt @@ -22,7 +22,6 @@ import im.vector.matrix.android.api.session.room.model.message.MessageContent import im.vector.riotx.EmojiCompatFontProvider import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.utils.DebouncedClickListener -import im.vector.riotx.core.utils.DimensionConverter 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.item.AbsMessageItem @@ -33,7 +32,6 @@ class MessageItemAttributesFactory @Inject constructor( private val avatarRenderer: AvatarRenderer, private val colorProvider: ColorProvider, private val avatarSizeProvider: AvatarSizeProvider, - private val dimensionConverter: DimensionConverter, private val emojiCompatFontProvider: EmojiCompatFontProvider) { fun create(messageContent: MessageContent?, @@ -44,7 +42,6 @@ class MessageItemAttributesFactory @Inject constructor( informationData = informationData, avatarRenderer = avatarRenderer, colorProvider = colorProvider, - dimensionConverter = dimensionConverter, itemLongClickListener = View.OnLongClickListener { view -> callback?.onEventLongClicked(informationData, messageContent, view) ?: false }, diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt index 461028c3d0..bddee50861 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/AbsMessageItem.kt @@ -29,7 +29,6 @@ import im.vector.riotx.R import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.ui.views.ReadMarkerView import im.vector.riotx.core.utils.DebouncedClickListener -import im.vector.riotx.core.utils.DimensionConverter import im.vector.riotx.features.home.AvatarRenderer import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController import im.vector.riotx.features.reactions.widget.ReactionButton @@ -173,7 +172,6 @@ abstract class AbsMessageItem : BaseEventItem() { val informationData: MessageInformationData, val avatarRenderer: AvatarRenderer, val colorProvider: ColorProvider, - val dimensionConverter: DimensionConverter, val itemLongClickListener: View.OnLongClickListener? = null, val itemClickListener: View.OnClickListener? = null, val memberClickListener: View.OnClickListener? = null,