Switch to upstream MessageAudioItem

Change-Id: Ie58f9894e66d0366e3fe49a0e13752b1e55235e7
This commit is contained in:
SpiritCroc 2022-04-26 17:33:52 +02:00
parent 130fe7f887
commit 2316328631
5 changed files with 5 additions and 33 deletions

View File

@ -419,7 +419,6 @@ class MessageItemFactory @Inject constructor(
.contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder)
.highlighted(highlight)
.leftGuideline(avatarSizeProvider.leftGuideline)
.filename(messageContent.body)
}
private fun buildVerificationRequestMessageItem(
@ -489,7 +488,7 @@ class MessageItemFactory @Inject constructor(
informationData: MessageInformationData,
highlight: Boolean,
attributes: AbsMessageItem.Attributes,
) = if (true || messageContent.voiceMessageIndicator != null) {
) = if (messageContent.voiceMessageIndicator != null) {
buildVoiceMessageItem(params, messageContent, informationData, highlight, attributes)
} else {
buildAudioMessageItem(params, messageContent, informationData, highlight, attributes)

View File

@ -96,7 +96,8 @@ abstract class MessageAudioItem : AbsMessageItem<MessageAudioItem.Holder>() {
}
private fun applyLayoutTint(holder: 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)

View File

@ -60,9 +60,6 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
@JvmField
var isLocalFile = false
@EpoxyAttribute
var filename: CharSequence? = null
@EpoxyAttribute
lateinit var contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder
@ -116,16 +113,6 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
}
holder.voicePlaybackWaveform.summarize()
// SC: fallback audio name if no waveform (we also use this for audio messages!)
if (waveform.isEmpty() && !filename.isNullOrBlank()) {
holder.voicePlaybackWaveform.isInvisible = true
holder.voiceMessageName.isVisible = true
holder.voiceMessageName.text = filename
} else {
holder.voicePlaybackWaveform.isVisible = true
holder.voiceMessageName.isGone = true
}
holder.voicePlaybackWaveform.setOnTouchListener { view, motionEvent ->
when (motionEvent.action) {
MotionEvent.ACTION_UP -> {
@ -198,7 +185,6 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
val voicePlaybackTime by bind<TextView>(R.id.voicePlaybackTime)
val voicePlaybackWaveform by bind<AudioWaveformView>(R.id.voicePlaybackWaveform)
val progressLayout by bind<ViewGroup>(R.id.messageFileUploadProgressLayout)
val voiceMessageName by bind<TextView>(R.id.voiceMessageName)
}
companion object {

View File

@ -6,6 +6,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:minWidth="@dimen/chat_bubble_fixed_size"
tools:viewBindingIgnore="true">
<androidx.constraintlayout.widget.ConstraintLayout
@ -104,4 +105,4 @@
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
</LinearLayout>

View File

@ -53,21 +53,6 @@
app:layout_constraintStart_toEndOf="@id/voicePlaybackTime"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/voiceMessageName"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:autoLink="none"
android:gravity="center"
android:singleLine="true"
android:ellipsize="middle"
app:layout_constraintStart_toStartOf="@id/voicePlaybackWaveform"
app:layout_constraintEnd_toEndOf="@id/voicePlaybackWaveform"
app:layout_constraintTop_toTopOf="@id/voicePlaybackWaveform"
app:layout_constraintBottom_toBottomOf="@id/voicePlaybackWaveform" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include