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

View File

@ -96,7 +96,8 @@ abstract class MessageAudioItem : AbsMessageItem<MessageAudioItem.Holder>() {
} }
private fun applyLayoutTint(holder: 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 Color.TRANSPARENT
} else { } else {
ThemeUtils.getColor(holder.view.context, R.attr.vctr_content_quinary) ThemeUtils.getColor(holder.view.context, R.attr.vctr_content_quinary)

View File

@ -60,9 +60,6 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
@JvmField @JvmField
var isLocalFile = false var isLocalFile = false
@EpoxyAttribute
var filename: CharSequence? = null
@EpoxyAttribute @EpoxyAttribute
lateinit var contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder lateinit var contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder
@ -116,16 +113,6 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
} }
holder.voicePlaybackWaveform.summarize() 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 -> holder.voicePlaybackWaveform.setOnTouchListener { view, motionEvent ->
when (motionEvent.action) { when (motionEvent.action) {
MotionEvent.ACTION_UP -> { MotionEvent.ACTION_UP -> {
@ -198,7 +185,6 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
val voicePlaybackTime by bind<TextView>(R.id.voicePlaybackTime) val voicePlaybackTime by bind<TextView>(R.id.voicePlaybackTime)
val voicePlaybackWaveform by bind<AudioWaveformView>(R.id.voicePlaybackWaveform) val voicePlaybackWaveform by bind<AudioWaveformView>(R.id.voicePlaybackWaveform)
val progressLayout by bind<ViewGroup>(R.id.messageFileUploadProgressLayout) val progressLayout by bind<ViewGroup>(R.id.messageFileUploadProgressLayout)
val voiceMessageName by bind<TextView>(R.id.voiceMessageName)
} }
companion object { companion object {

View File

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

View File

@ -53,21 +53,6 @@
app:layout_constraintStart_toEndOf="@id/voicePlaybackTime" app:layout_constraintStart_toEndOf="@id/voicePlaybackTime"
app:layout_constraintTop_toTopOf="parent" /> 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> </androidx.constraintlayout.widget.ConstraintLayout>
<include <include