Add a video indicator on the miniature (videos are now previewable)

This commit is contained in:
Benoit Marty 2021-04-30 14:24:49 +02:00 committed by Benoit Marty
parent 5e1c503d2e
commit 8ff65b3816
2 changed files with 14 additions and 0 deletions

View file

@ -18,6 +18,7 @@ package im.vector.app.features.attachments.preview
import android.view.View
import android.widget.ImageView
import androidx.core.view.isVisible
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import com.bumptech.glide.Glide
@ -65,6 +66,7 @@ abstract class AttachmentMiniaturePreviewItem : AttachmentPreviewItem<Attachment
override fun bind(holder: Holder) {
super.bind(holder)
holder.imageView.isChecked = checked
holder.miniatureVideoIndicator.isVisible = attachment.type == ContentAttachmentData.Type.VIDEO
holder.view.setOnClickListener(clickListener)
}
@ -72,6 +74,7 @@ abstract class AttachmentMiniaturePreviewItem : AttachmentPreviewItem<Attachment
override val imageView: CheckableImageView
get() = miniatureImageView
private val miniatureImageView by bind<CheckableImageView>(R.id.attachmentMiniatureImageView)
val miniatureVideoIndicator by bind<ImageView>(R.id.attachmentMiniatureVideoIndicator)
}
}

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
@ -17,4 +18,14 @@
android:scaleType="centerCrop"
tools:src="@tools:sample/backgrounds/scenic" />
<ImageView
android:id="@+id/attachmentMiniatureVideoIndicator"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:contentDescription="@string/a11y_video"
app:srcCompat="@drawable/ic_play_arrow"
app:tint="@color/white"
tools:ignore="MissingPrefix" />
</androidx.cardview.widget.CardView>