[bubble merge] Update some attachments in SC bubbles

Change-Id: I30b45fd3377fd423d47c2e4bd94645ce64c001d6
This commit is contained in:
SpiritCroc 2022-02-20 12:54:49 +01:00
parent fd4051d00a
commit 87ba082411
7 changed files with 27 additions and 12 deletions

View File

@ -87,10 +87,11 @@ 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
|| attributes.informationData.messageLayout is TimelineMessageLayout.ScBubble) {
Color.TRANSPARENT
} else {
ThemeUtils.getColor(holder.view.context, R.attr.vctr_content_quinary)
ThemeUtils.getColor(holder.view.context, R.attr.sc_message_bg_incoming)
}
holder.mainLayout.backgroundTintList = ColorStateList.valueOf(backgroundTint)
holder.filenameView.onClick(attributes.itemClickListener)
@ -109,7 +110,7 @@ abstract class MessageFileItem : AbsMessageItem<MessageFileItem.Holder>() {
override fun getViewStubMinimumWidth(holder: Holder): Int {
// Guess text width for name and time
// On first call, holder.fileImageView.width is not initialized yet
val imageWidth = holder.fileImageView.resources.getDimensionPixelSize(R.dimen.chat_avatar_size)
val imageWidth = holder.fileImageView.resources.getDimensionPixelSize(R.dimen.file_icon_size)
val minimumWidthWithText =
ceil(guessTextWidth(holder.filenameView, filename)).toInt() +
imageWidth +
@ -118,6 +119,11 @@ abstract class MessageFileItem : AbsMessageItem<MessageFileItem.Holder>() {
return max(absoluteMinimumWidth, minimumWidthWithText)
}
override fun applyScBubbleStyle(messageLayout: TimelineMessageLayout.ScBubble, holder: Holder) {
// Undo padding from TimelineContentMediaPillStyle
holder.mainLayout.setPadding(0, 0, 0, 0)
}
override fun getViewStubId() = STUB_ID
class Holder : AbsMessageItem.Holder(STUB_ID) {

View File

@ -60,10 +60,10 @@ abstract class MessageLocationItem : AbsMessageItem<MessageLocationItem.Holder>(
val location = locationUrl ?: return
val messageLayout = attributes.informationData.messageLayout
val dimensionConverter = DimensionConverter(holder.view.resources)
val imageCornerTransformation = if (messageLayout is TimelineMessageLayout.Bubble) {
messageLayout.cornersRadius.granularRoundedCorners()
} else {
RoundedCorners(dimensionConverter.dpToPx(8))
val imageCornerTransformation = when (messageLayout) {
is TimelineMessageLayout.ScBubble -> RoundedCorners(dimensionConverter.dpToPx(3))
is TimelineMessageLayout.Bubble -> messageLayout.cornersRadius.granularRoundedCorners()
else -> RoundedCorners(dimensionConverter.dpToPx(8))
}
holder.staticMapImageView.updateLayoutParams {
width = mapWidth

View File

@ -100,10 +100,11 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
}
}
val backgroundTint = if (attributes.informationData.messageLayout is TimelineMessageLayout.Bubble) {
val backgroundTint = if (attributes.informationData.messageLayout is TimelineMessageLayout.Bubble ||
attributes.informationData.messageLayout is TimelineMessageLayout.ScBubble) {
Color.TRANSPARENT
} else {
ThemeUtils.getColor(holder.view.context, R.attr.vctr_content_quinary)
ThemeUtils.getColor(holder.view.context, R.attr.sc_message_bg_incoming)
}
holder.voicePlaybackLayout.backgroundTintList = ColorStateList.valueOf(backgroundTint)
holder.voicePlaybackControlButton.setOnClickListener { playbackControlButtonClickListener?.invoke(it) }
@ -146,6 +147,11 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
voiceMessagePlaybackTracker.unTrack(attributes.informationData.eventId)
}
override fun applyScBubbleStyle(messageLayout: TimelineMessageLayout.ScBubble, holder: Holder) {
// Undo padding from TimelineContentMediaPillStyle
holder.voicePlaybackLayout.setPadding(0, 0, 0, 0)
}
override fun getViewStubId() = STUB_ID
class Holder : AbsMessageItem.Holder(STUB_ID) {

View File

@ -87,6 +87,7 @@ class PreviewUrlView @JvmOverloads constructor(
val guidelineBegin = DimensionConverter(resources).dpToPx(8)
views.urlPreviewStartGuideline.setGuidelineBegin(guidelineBegin)
}
is TimelineMessageLayout.ScBubble,
is TimelineMessageLayout.Bubble -> {
setCardBackgroundColor(Color.TRANSPARENT)
rippleColor = ColorStateList.valueOf(Color.TRANSPARENT)

View File

@ -18,8 +18,8 @@
<FrameLayout
android:id="@+id/messageFileImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_width="@dimen/file_icon_size"
android:layout_height="@dimen/file_icon_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">

View File

@ -77,7 +77,7 @@
android:layout_height="46dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginEnd="4dp"
android:visibility="gone"
tools:visibility="visible" />

View File

@ -32,4 +32,6 @@
<dimen name="sc_footer_reverse_margin_end">8dp</dimen>
<dimen name="sc_footer_rtl_mismatch_extra_padding">4dp</dimen>
<dimen name="file_icon_size">32dp</dimen>
</resources>