MessageImageVideoItem: Hide play button for autoplaying animated images
This patch updates the logic checking whether to show the playContentView to not show it when an animated image message would autoplay its animation. Signed-off-by: networkException <git@nwex.de>
This commit is contained in:
parent
9d0fe46723
commit
b138ac8601
|
@ -34,6 +34,7 @@ import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStat
|
||||||
import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
|
import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
|
||||||
import im.vector.app.features.home.room.detail.timeline.style.granularRoundedCorners
|
import im.vector.app.features.home.room.detail.timeline.style.granularRoundedCorners
|
||||||
import im.vector.app.features.media.ImageContentRenderer
|
import im.vector.app.features.media.ImageContentRenderer
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.message.MessageType
|
||||||
|
|
||||||
@EpoxyModelClass(layout = R.layout.item_timeline_event_base)
|
@EpoxyModelClass(layout = R.layout.item_timeline_event_base)
|
||||||
abstract class MessageImageVideoItem : AbsMessageItem<MessageImageVideoItem.Holder>() {
|
abstract class MessageImageVideoItem : AbsMessageItem<MessageImageVideoItem.Holder>() {
|
||||||
|
@ -80,7 +81,17 @@ abstract class MessageImageVideoItem : AbsMessageItem<MessageImageVideoItem.Hold
|
||||||
ViewCompat.setTransitionName(holder.imageView, "imagePreview_${id()}")
|
ViewCompat.setTransitionName(holder.imageView, "imagePreview_${id()}")
|
||||||
holder.mediaContentView.onClick(attributes.itemClickListener)
|
holder.mediaContentView.onClick(attributes.itemClickListener)
|
||||||
holder.mediaContentView.setOnLongClickListener(attributes.itemLongClickListener)
|
holder.mediaContentView.setOnLongClickListener(attributes.itemLongClickListener)
|
||||||
holder.playContentView.visibility = if (playable) View.VISIBLE else View.GONE
|
|
||||||
|
val isImageMessage = attributes.informationData.messageType == MessageType.MSGTYPE_IMAGE
|
||||||
|
val autoplayAnimatedImages = attributes.autoplayAnimatedImages
|
||||||
|
|
||||||
|
holder.playContentView.visibility = if (playable && isImageMessage && autoplayAnimatedImages) {
|
||||||
|
View.GONE
|
||||||
|
} else if (playable) {
|
||||||
|
View.VISIBLE
|
||||||
|
} else {
|
||||||
|
View.GONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun unbind(holder: Holder) {
|
override fun unbind(holder: Holder) {
|
||||||
|
|
Loading…
Reference in New Issue