diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt index 1fb5726ccc..3e731426e8 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt @@ -21,6 +21,7 @@ import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.ProgressBar +import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.view.ViewCompat import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute @@ -95,6 +96,18 @@ abstract class MessageImageVideoItem : AbsMessageItem width of the ImageView not adapted to the actual content + // -> Align image within ImageView to same side as message bubbles + holder.imageView.scaleType = if (reverseBubble) ImageView.ScaleType.FIT_END else ImageView.ScaleType.FIT_START + // Case: Message information (sender name + date) makes the containing view wider than the ImageView + // -> Align ImageView within its parent to the same side as message bubbles + (holder.imageView.layoutParams as ConstraintLayout.LayoutParams).horizontalBias = if (reverseBubble) 1f else 0f + } + + class Holder : AbsMessageItem.Holder(STUB_ID) { val progressLayout by bind(R.id.messageMediaUploadProgressLayout) val imageView by bind(R.id.messageThumbnailView)