mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-15 10:48:54 +03:00
View filename in audio message if waveform message
Change-Id: I80f85abf74566d8fdfbf4fad1c213612c753a87d
This commit is contained in:
parent
e3b590bb8e
commit
a7680ddbac
3 changed files with 33 additions and 0 deletions
|
@ -272,6 +272,7 @@ class MessageItemFactory @Inject constructor(
|
|||
.contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder)
|
||||
.highlighted(highlight)
|
||||
.leftGuideline(avatarSizeProvider.leftGuideline)
|
||||
.filename(messageContent.body)
|
||||
}
|
||||
|
||||
private fun buildVerificationRequestMessageItem(messageContent: MessageVerificationRequestContent,
|
||||
|
|
|
@ -18,10 +18,13 @@ package im.vector.app.features.home.room.detail.timeline.item
|
|||
|
||||
import android.content.Context
|
||||
import android.text.format.DateUtils
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageButton
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import com.airbnb.epoxy.EpoxyAttribute
|
||||
import com.airbnb.epoxy.EpoxyModelClass
|
||||
|
@ -55,6 +58,9 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
|
|||
@EpoxyAttribute
|
||||
var izDownloaded = false
|
||||
|
||||
@EpoxyAttribute
|
||||
var filename: CharSequence? = null
|
||||
|
||||
@EpoxyAttribute
|
||||
lateinit var contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder
|
||||
|
||||
|
@ -85,6 +91,16 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
|
|||
waveform.forEach { amplitude ->
|
||||
holder.voicePlaybackWaveform.update(amplitude)
|
||||
}
|
||||
|
||||
// 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.voicePlaybackControlButton.setOnClickListener { playbackControlButtonClickListener?.invoke(it) }
|
||||
|
@ -136,6 +152,7 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
|
|||
val voicePlaybackWaveform by bind<AudioRecordView>(R.id.voicePlaybackWaveform)
|
||||
val progressLayout by bind<ViewGroup>(R.id.messageFileUploadProgressLayout)
|
||||
val voicePlaybackLayout by bind<ConstraintLayout>(R.id.voicePlaybackLayout)
|
||||
val voiceMessageName by bind<TextView>(R.id.voiceMessageName)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -59,6 +59,21 @@
|
|||
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>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue