diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt index 51fd8d81bd..7789ae0e76 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -25,8 +25,6 @@ import android.text.style.AbsoluteSizeSpan import android.text.style.ClickableSpan import android.text.style.ForegroundColorSpan import android.view.View -import android.view.WindowManager -import android.view.WindowMetrics import dagger.Lazy import im.vector.app.R import im.vector.app.core.epoxy.ClickListener diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentDownloadStateTrackerBinder.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentDownloadStateTrackerBinder.kt index e4405570a6..8f5f80c834 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentDownloadStateTrackerBinder.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentDownloadStateTrackerBinder.kt @@ -22,14 +22,12 @@ import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat import dagger.hilt.android.scopes.ActivityScoped import im.vector.app.R import im.vector.app.core.di.ActiveSessionHolder -import im.vector.app.core.error.ErrorFormatter -import im.vector.app.features.home.room.detail.timeline.MessageColorProvider import im.vector.app.features.home.room.detail.timeline.item.MessageFileItem import org.matrix.android.sdk.api.session.file.ContentDownloadStateTracker import javax.inject.Inject @ActivityScoped -class ContentDownloadStateTrackerBinder @Inject constructor(private val activeSessionHolder: ActiveSessionHolder){ +class ContentDownloadStateTrackerBinder @Inject constructor(private val activeSessionHolder: ActiveSessionHolder) { private val updateListeners = mutableMapOf() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsBaseMessageItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsBaseMessageItem.kt index ac9ef1522d..9621b1c2f9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsBaseMessageItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsBaseMessageItem.kt @@ -99,7 +99,7 @@ abstract class AbsBaseMessageItem : BaseEventItem holder.view.onClick(baseAttributes.itemClickListener) holder.view.setOnLongClickListener(baseAttributes.itemLongClickListener) - (holder.view as? TimelineMessageLayoutRenderer)?.render(baseAttributes.informationData.messageLayout) + (holder.view as? TimelineMessageLayoutRenderer)?.renderMessageLayout(baseAttributes.informationData.messageLayout) } override fun unbind(holder: H) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt index e736c0e2da..8b6899daee 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt @@ -84,9 +84,9 @@ abstract class MessageFileItem : AbsMessageItem() { } } // holder.view.setOnClickListener(clickListener) - val backgroundTint = if(attributes.informationData.messageLayout is TimelineMessageLayout.Bubble){ + val backgroundTint = if (attributes.informationData.messageLayout is TimelineMessageLayout.Bubble) { Color.TRANSPARENT - }else { + } else { ThemeUtils.getColor(holder.view.context, R.attr.vctr_content_quinary) } holder.mainLayout.backgroundTintList = ColorStateList.valueOf(backgroundTint) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt index 6f801d9eb7..8485c40ef9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt @@ -23,7 +23,6 @@ import androidx.core.view.ViewCompat import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass -import com.bumptech.glide.load.resource.bitmap.GranularRoundedCorners import com.bumptech.glide.load.resource.bitmap.RoundedCorners import im.vector.app.R import im.vector.app.core.epoxy.ClickListener diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageTextItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageTextItem.kt index ed9bc87834..bc9e4a7ff1 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageTextItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageTextItem.kt @@ -80,7 +80,7 @@ abstract class MessageTextItem : AbsMessageItem() { safePreviewUrlRetriever.addListener(attributes.informationData.eventId, previewUrlViewUpdater) } holder.previewUrlView.delegate = previewUrlCallback - holder.previewUrlView.render(attributes.informationData.messageLayout) + holder.previewUrlView.renderMessageLayout(attributes.informationData.messageLayout) if (useBigFont) { holder.messageView.textSize = 44F diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt index 1058e3c1f9..e9f728d976 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt @@ -23,7 +23,6 @@ import android.view.View import android.view.ViewGroup import android.widget.ImageButton import android.widget.TextView -import androidx.core.content.ContextCompat import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass @@ -86,9 +85,9 @@ abstract class MessageVoiceItem : AbsMessageItem() { } } - val backgroundTint = if(attributes.informationData.messageLayout is TimelineMessageLayout.Bubble){ + val backgroundTint = if (attributes.informationData.messageLayout is TimelineMessageLayout.Bubble) { Color.TRANSPARENT - }else { + } else { ThemeUtils.getColor(holder.view.context, R.attr.vctr_content_quinary) } holder.voicePlaybackLayout.backgroundTintList = ColorStateList.valueOf(backgroundTint) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayoutFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayoutFactory.kt index 373e9cfa68..bded4505b5 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayoutFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayoutFactory.kt @@ -41,7 +41,7 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess private val vectorPreferences: VectorPreferences) { companion object { - // Can't be rendered in bubbles, so get back to default layout + // Can be rendered in bubbles, other types will fallback to default private val EVENT_TYPES_WITH_BUBBLE_LAYOUT = setOf( EventType.MESSAGE, EventType.POLL_START, @@ -162,7 +162,9 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess ) } - private fun buildCornersRadius(isIncoming: Boolean, isFirstFromThisSender: Boolean, isLastFromThisSender: Boolean): TimelineMessageLayout.Bubble.CornersRadius { + private fun buildCornersRadius(isIncoming: Boolean, + isFirstFromThisSender: Boolean, + isLastFromThisSender: Boolean): TimelineMessageLayout.Bubble.CornersRadius { return if ((isIncoming && !isRTL) || (!isIncoming && isRTL)) { TimelineMessageLayout.Bubble.CornersRadius( topStartRadius = if (isFirstFromThisSender) cornerRadius else 0f, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlView.kt index 905d420463..bb306c2016 100755 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlView.kt @@ -25,7 +25,6 @@ import androidx.core.view.isVisible import com.google.android.material.card.MaterialCardView import im.vector.app.R import im.vector.app.core.extensions.setTextOrHide -import im.vector.app.core.glide.GlideApp import im.vector.app.core.utils.DimensionConverter import im.vector.app.databinding.ViewUrlPreviewBinding import im.vector.app.features.home.room.detail.timeline.TimelineEventController @@ -33,7 +32,6 @@ import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLay import im.vector.app.features.home.room.detail.timeline.view.TimelineMessageLayoutRenderer import im.vector.app.features.media.ImageContentRenderer import im.vector.app.features.themes.ThemeUtils -import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.session.media.PreviewUrlData /** @@ -81,7 +79,7 @@ class PreviewUrlView @JvmOverloads constructor( } } - override fun render(messageLayout: TimelineMessageLayout) { + override fun renderMessageLayout(messageLayout: TimelineMessageLayout) { when (messageLayout) { is TimelineMessageLayout.Default -> { val backgroundColor = ThemeUtils.getColor(context, R.attr.vctr_system) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/MessageBubbleView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/MessageBubbleView.kt index 0f4db38028..de40a681b3 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/MessageBubbleView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/MessageBubbleView.kt @@ -94,7 +94,7 @@ class MessageBubbleView @JvmOverloads constructor(context: Context, attrs: Attri } } - override fun render(messageLayout: TimelineMessageLayout) { + override fun renderMessageLayout(messageLayout: TimelineMessageLayout) { if (messageLayout !is TimelineMessageLayout.Bubble) { Timber.v("Can't render messageLayout $messageLayout") return diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/TimelineMessageLayoutRenderer.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/TimelineMessageLayoutRenderer.kt index a339119f46..0c42662801 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/TimelineMessageLayoutRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/TimelineMessageLayoutRenderer.kt @@ -19,5 +19,5 @@ package im.vector.app.features.home.room.detail.timeline.view import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout interface TimelineMessageLayoutRenderer { - fun render(messageLayout: TimelineMessageLayout) + fun renderMessageLayout(messageLayout: TimelineMessageLayout) } diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt index d73b87d42c..bdf9f284b8 100755 --- a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt @@ -862,9 +862,9 @@ class VectorPreferences @Inject constructor(private val context: Context) { } /** - * Tells if the emoji keyboard button should be visible or not. + * Tells if the timeline messages should be shown in a bubble or not. * - * @return true to show emoji keyboard button. + * @return true to show timeline message in bubble. */ fun useMessageBubblesLayout(): Boolean { return defaultPrefs.getBoolean(SETTINGS_INTERFACE_BUBBLE_KEY, false) diff --git a/vector/src/main/res/layout/view_message_bubble.xml b/vector/src/main/res/layout/view_message_bubble.xml index b86f52bf63..7e4d3e8f7d 100644 --- a/vector/src/main/res/layout/view_message_bubble.xml +++ b/vector/src/main/res/layout/view_message_bubble.xml @@ -200,7 +200,7 @@ android:layout_height="wrap_content" android:layout_below="@id/informationBottom" android:layout_toStartOf="@id/messageEndGuideline" - android:layout_toEndOf="@+id/messageStartGuideline" + android:layout_toEndOf="@id/messageStartGuideline" android:contentDescription="@string/room_threads_filter"> + tools:text="@sample/messages.json/data/message" />