mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-07 14:33:26 +01:00
[sec-merge related] Render encryption warnings for all layouts again
Change-Id: I3af2a350af2988803f7114d1652a85dd3f75681d
This commit is contained in:
parent
97d0dbcfb8
commit
0b917fc935
@ -33,7 +33,6 @@ import im.vector.app.R
|
||||
import im.vector.app.core.epoxy.ClickListener
|
||||
import im.vector.app.core.epoxy.onClick
|
||||
import im.vector.app.core.extensions.getDrawableAsSpannable
|
||||
import im.vector.app.core.ui.views.BubbleDependentView
|
||||
import im.vector.app.core.ui.views.ShieldImageView
|
||||
import im.vector.app.core.utils.DimensionConverter
|
||||
import im.vector.app.features.home.AvatarRenderer
|
||||
@ -42,6 +41,7 @@ import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
||||
import im.vector.app.features.home.room.detail.timeline.helper.AvatarSizeProvider
|
||||
import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
|
||||
import im.vector.app.features.home.room.detail.timeline.view.TimelineMessageLayoutRenderer
|
||||
import im.vector.app.features.home.room.detail.timeline.view.infoInBubbles
|
||||
import im.vector.app.features.home.room.detail.timeline.view.scRenderMessageLayout
|
||||
import im.vector.app.features.reactions.widget.ReactionButton
|
||||
import im.vector.app.features.themes.ThemeUtils
|
||||
@ -85,8 +85,8 @@ abstract class AbsBaseMessageItem<H : AbsBaseMessageItem.Holder>(@LayoutRes layo
|
||||
override fun bind(holder: H) {
|
||||
super.bind(holder)
|
||||
renderReactions(holder, baseAttributes.informationData.reactionsSummary)
|
||||
if (baseAttributes.informationData.messageLayout.showE2eDecoration) {
|
||||
holder.e2EDecorationView.renderE2EDecoration(baseAttributes.informationData.e2eDecoration)
|
||||
if (!baseAttributes.informationData.messageLayout.showsE2eDecorationInFooter()) {
|
||||
holder.getEffectiveE2eDecorationView().renderE2EDecoration(baseAttributes.informationData.e2eDecoration)
|
||||
}
|
||||
holder.view.onClick(baseAttributes.itemClickListener)
|
||||
holder.view.setOnLongClickListener(baseAttributes.itemLongClickListener)
|
||||
@ -190,6 +190,8 @@ abstract class AbsBaseMessageItem<H : AbsBaseMessageItem.Holder>(@LayoutRes layo
|
||||
val reactionsContainer by bind<ViewGroup>(R.id.reactionsContainer)
|
||||
val informationBottom by bind<ViewGroup>(R.id.informationBottom)
|
||||
val e2EDecorationView by bind<ShieldImageView>(R.id.messageE2EDecoration)
|
||||
|
||||
open fun getEffectiveE2eDecorationView() = e2EDecorationView
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,6 @@ import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
||||
import im.vector.app.features.home.room.detail.timeline.view.TimelineMessageLayoutRenderer
|
||||
import im.vector.app.features.home.room.detail.timeline.view.scOnlyRenderMessageLayout
|
||||
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
|
||||
import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
|
||||
|
||||
@EpoxyModelClass
|
||||
abstract class NoticeItem : BaseEventItem<NoticeItem.Holder>(R.layout.item_timeline_event_base_noinfo) {
|
||||
@ -45,7 +44,7 @@ abstract class NoticeItem : BaseEventItem<NoticeItem.Holder>(R.layout.item_timel
|
||||
holder.view.setOnLongClickListener(attributes.itemLongClickListener)
|
||||
holder.avatarImageView.onClick(attributes.avatarClickListener)
|
||||
|
||||
if (attributes.informationData.messageLayout.showE2eDecoration) {
|
||||
if (!attributes.informationData.messageLayout.showsE2eDecorationInFooter()) {
|
||||
holder.e2EDecorationView.renderE2EDecoration(attributes.informationData.e2eDecoration)
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ package im.vector.app.features.home.room.detail.timeline.style
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.DrawableRes
|
||||
import im.vector.app.R
|
||||
import im.vector.app.features.home.room.detail.timeline.view.infoInBubbles
|
||||
import im.vector.app.features.themes.ScBubbleAppearance
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@ -28,14 +29,14 @@ sealed interface TimelineMessageLayout : Parcelable {
|
||||
val showAvatar: Boolean
|
||||
val showDisplayName: Boolean
|
||||
val showTimestamp: Boolean
|
||||
val showE2eDecoration: Boolean
|
||||
|
||||
open fun showsE2eDecorationInFooter(): Boolean = false
|
||||
|
||||
@Parcelize
|
||||
data class Default(
|
||||
override val showAvatar: Boolean,
|
||||
override val showDisplayName: Boolean,
|
||||
override val showTimestamp: Boolean,
|
||||
override val showE2eDecoration: Boolean,
|
||||
// Keep defaultLayout generated on epoxy items
|
||||
override val layoutRes: Int = 0,
|
||||
) : TimelineMessageLayout
|
||||
@ -45,7 +46,6 @@ sealed interface TimelineMessageLayout : Parcelable {
|
||||
override val showAvatar: Boolean,
|
||||
override val showDisplayName: Boolean,
|
||||
override val showTimestamp: Boolean = true,
|
||||
override val showE2eDecoration: Boolean = true,
|
||||
val addTopMargin: Boolean = false,
|
||||
val isIncoming: Boolean,
|
||||
val isPseudoBubble: Boolean,
|
||||
@ -73,7 +73,6 @@ sealed interface TimelineMessageLayout : Parcelable {
|
||||
override val showAvatar: Boolean,
|
||||
override val showDisplayName: Boolean,
|
||||
override val showTimestamp: Boolean = true,
|
||||
override val showE2eDecoration: Boolean = false,
|
||||
val bubbleAppearance: ScBubbleAppearance,
|
||||
val isIncoming: Boolean,
|
||||
val reverseBubble: Boolean,
|
||||
@ -103,6 +102,8 @@ sealed interface TimelineMessageLayout : Parcelable {
|
||||
bubbleAppearance.textBubbleIncomingNoTail
|
||||
}
|
||||
}
|
||||
) : TimelineMessageLayout
|
||||
) : TimelineMessageLayout {
|
||||
override fun showsE2eDecorationInFooter(): Boolean = infoInBubbles(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -200,8 +200,7 @@ class TimelineMessageLayoutFactory @Inject constructor(
|
||||
else -> TimelineMessageLayout.Default(
|
||||
showAvatar = false,
|
||||
showDisplayName = false,
|
||||
showTimestamp = vectorPreferences.alwaysShowTimeStamps(),
|
||||
showE2eDecoration = false
|
||||
showTimestamp = vectorPreferences.alwaysShowTimeStamps()
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -249,12 +248,11 @@ class TimelineMessageLayoutFactory @Inject constructor(
|
||||
return messageContent?.msgType in MSG_TYPES_WITHOUT_BUBBLE_LAYOUT
|
||||
}
|
||||
|
||||
private fun buildModernLayout(showInformation: Boolean, forScBubbles: Boolean = false): TimelineMessageLayout.Default {
|
||||
private fun buildModernLayout(showInformation: Boolean): TimelineMessageLayout.Default {
|
||||
return TimelineMessageLayout.Default(
|
||||
showAvatar = showInformation,
|
||||
showDisplayName = showInformation,
|
||||
showTimestamp = showInformation || vectorPreferences.alwaysShowTimeStamps(),
|
||||
showE2eDecoration = !forScBubbles
|
||||
showTimestamp = showInformation || vectorPreferences.alwaysShowTimeStamps()
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ import im.vector.app.databinding.ViewMessageBubbleScBinding
|
||||
import im.vector.app.features.home.room.detail.timeline.item.AbsMessageItem
|
||||
import im.vector.app.features.home.room.detail.timeline.item.AnonymousReadReceipt
|
||||
import im.vector.app.features.home.room.detail.timeline.item.BaseEventItem
|
||||
import im.vector.app.features.home.room.detail.timeline.item.E2EDecoration
|
||||
import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData
|
||||
import im.vector.app.features.home.room.detail.timeline.item.SendStateDecoration
|
||||
import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
|
||||
@ -207,6 +208,10 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
|
||||
views.eventSendingIndicator.isVisible = attributes.informationData.sendStateDecoration == SendStateDecoration.SENDING_MEDIA
|
||||
}
|
||||
|
||||
if (attributes.informationData.messageLayout.showsE2eDecorationInFooter()) {
|
||||
views.bubbleFooterMessageE2EDecoration.renderE2EDecoration(attributes.informationData.e2eDecoration)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -497,8 +502,18 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
|
||||
views.bubbleFooterReadReceipt.paddingBottom
|
||||
}
|
||||
|
||||
var footerWidth = timeWidth + readReceiptWidth
|
||||
var footerHeight = max(timeHeight, readReceiptHeight)
|
||||
val e2eWidth: Int
|
||||
val e2eHeight: Int
|
||||
if (informationData?.e2eDecoration in listOf(null, E2EDecoration.NONE)) {
|
||||
e2eWidth = 0
|
||||
e2eHeight = 0
|
||||
} else {
|
||||
e2eWidth = views.bubbleFooterMessageE2EDecoration.layoutParams.width + views.bubbleFooterMessageE2EDecoration.paddingLeft + views.bubbleFooterMessageE2EDecoration.paddingRight
|
||||
e2eHeight = views.bubbleFooterMessageE2EDecoration.layoutParams.height + views.bubbleFooterMessageE2EDecoration.paddingTop + views.bubbleFooterMessageE2EDecoration.paddingBottom
|
||||
}
|
||||
|
||||
var footerWidth = timeWidth + readReceiptWidth + e2eWidth
|
||||
var footerHeight = max(max(timeHeight, readReceiptHeight), e2eHeight)
|
||||
// Reserve extra padding, if we do have actual content
|
||||
if (footerWidth > 0) {
|
||||
footerWidth += views.bubbleFootView.paddingLeft + views.bubbleFootView.paddingRight
|
||||
|
@ -192,6 +192,16 @@
|
||||
tools:tint="?vctr_content_secondary"
|
||||
tools:src="@drawable/ic_processing_msg"
|
||||
android:contentDescription="@string/footer_read_receipt_content_description" />
|
||||
|
||||
<im.vector.app.core.ui.views.ShieldImageView
|
||||
android:id="@+id/bubbleFooterMessageE2EDecoration"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user