mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Bubbles: clean up after review
This commit is contained in:
parent
1bf2523437
commit
9e0086742c
14 changed files with 18 additions and 24 deletions
|
@ -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
|
||||
|
|
|
@ -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<String, ContentDownloadUpdater>()
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ abstract class AbsBaseMessageItem<H : AbsBaseMessageItem.Holder> : 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) {
|
||||
|
|
|
@ -84,9 +84,9 @@ abstract class MessageFileItem : AbsMessageItem<MessageFileItem.Holder>() {
|
|||
}
|
||||
}
|
||||
// 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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -80,7 +80,7 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
|
|||
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
|
||||
|
|
|
@ -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<MessageVoiceItem.Holder>() {
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
@ -55,5 +55,5 @@
|
|||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/messageThreadSummaryAvatarImageView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Pouet" />
|
||||
tools:text="@sample/messages.json/data/message" />
|
||||
</merge>
|
||||
|
|
Loading…
Reference in a new issue