From 42e6068ce2f337684a5ada03acc3ad8ac56943f6 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Thu, 6 May 2021 17:53:33 +0200 Subject: [PATCH] Outline pictures Closes https://github.com/SchildiChat/SchildiChat-android/issues/49 Change-Id: I3119db2d62e1c924870cd57f19bf21e3fa1bb72f --- .../detail/timeline/item/MessageImageVideoItem.kt | 15 +++++++++++++++ .../drawable/background_image_border_incoming.xml | 13 +++++++++++++ .../drawable/background_image_border_outgoing.xml | 13 +++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 vector/src/main/res/drawable/background_image_border_incoming.xml create mode 100644 vector/src/main/res/drawable/background_image_border_outgoing.xml 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 c77a755f5e..a871e73690 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 @@ -31,6 +31,7 @@ import im.vector.app.core.files.LocalFilesHelper import im.vector.app.core.glide.GlideApp import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder import im.vector.app.features.media.ImageContentRenderer +import im.vector.app.features.themes.BubbleThemeUtils @EpoxyModelClass(layout = R.layout.item_timeline_event_base) abstract class MessageImageVideoItem : AbsMessageItem() { @@ -105,6 +106,20 @@ abstract class MessageImageVideoItem : AbsMessageItem Align ImageView within its parent to the same side as message bubbles (holder.imageView.layoutParams as ConstraintLayout.LayoutParams).horizontalBias = if (reverseBubble) 1f else 0f + + // Image outline + when { + bubbleStyle == BubbleThemeUtils.BUBBLE_STYLE_NONE || mode != ImageContentRenderer.Mode.THUMBNAIL -> { + // Don't show it for non-bubble layouts, don't show for Stickers, ... + holder.mediaContentView.background = null + } + attributes.informationData.sentByMe -> { + holder.mediaContentView.setBackgroundResource(R.drawable.background_image_border_outgoing) + } + else -> { + holder.mediaContentView.setBackgroundResource(R.drawable.background_image_border_incoming) + } + } } override fun allowFooterOverlay(holder: Holder): Boolean { diff --git a/vector/src/main/res/drawable/background_image_border_incoming.xml b/vector/src/main/res/drawable/background_image_border_incoming.xml new file mode 100644 index 0000000000..b2ac60603c --- /dev/null +++ b/vector/src/main/res/drawable/background_image_border_incoming.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/drawable/background_image_border_outgoing.xml b/vector/src/main/res/drawable/background_image_border_outgoing.xml new file mode 100644 index 0000000000..066c8f4c6c --- /dev/null +++ b/vector/src/main/res/drawable/background_image_border_outgoing.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file