mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-29 06:28:45 +03:00
Outline pictures
Closes https://github.com/SchildiChat/SchildiChat-android/issues/49 Change-Id: I3119db2d62e1c924870cd57f19bf21e3fa1bb72f
This commit is contained in:
parent
709f8b0b05
commit
42e6068ce2
3 changed files with 41 additions and 0 deletions
|
@ -31,6 +31,7 @@ import im.vector.app.core.files.LocalFilesHelper
|
||||||
import im.vector.app.core.glide.GlideApp
|
import im.vector.app.core.glide.GlideApp
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder
|
import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder
|
||||||
import im.vector.app.features.media.ImageContentRenderer
|
import im.vector.app.features.media.ImageContentRenderer
|
||||||
|
import im.vector.app.features.themes.BubbleThemeUtils
|
||||||
|
|
||||||
@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>() {
|
||||||
|
@ -105,6 +106,20 @@ abstract class MessageImageVideoItem : AbsMessageItem<MessageImageVideoItem.Hold
|
||||||
// Case: Message information (sender name + date) makes the containing view wider than the ImageView
|
// 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
|
// -> Align ImageView within its parent to the same side as message bubbles
|
||||||
(holder.imageView.layoutParams as ConstraintLayout.LayoutParams).horizontalBias = if (reverseBubble) 1f else 0f
|
(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 {
|
override fun allowFooterOverlay(holder: Holder): Boolean {
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@android:color/transparent" />
|
||||||
|
<stroke android:width="1dp" android:color="?sc_message_bg_incoming" />
|
||||||
|
<!-- add padding to actually draw around the image -->
|
||||||
|
<padding android:left="1dp" android:top="1dp" android:right="1dp"
|
||||||
|
android:bottom="1dp" />
|
||||||
|
<!-- rounded corners like for message bubbles and the image itself -->
|
||||||
|
<corners android:bottomRightRadius="3dp"
|
||||||
|
android:bottomLeftRadius="3dp"
|
||||||
|
android:topLeftRadius="3dp"
|
||||||
|
android:topRightRadius="3dp"/>
|
||||||
|
</shape>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@android:color/transparent" />
|
||||||
|
<stroke android:width="1dp" android:color="?sc_message_bg_outgoing" />
|
||||||
|
<!-- add padding to actually draw around the image -->
|
||||||
|
<padding android:left="1dp" android:top="1dp" android:right="1dp"
|
||||||
|
android:bottom="1dp" />
|
||||||
|
<!-- rounded corners like for message bubbles and the image itself -->
|
||||||
|
<corners android:bottomRightRadius="3dp"
|
||||||
|
android:bottomLeftRadius="3dp"
|
||||||
|
android:topLeftRadius="3dp"
|
||||||
|
android:topRightRadius="3dp"/>
|
||||||
|
</shape>
|
Loading…
Reference in a new issue