diff --git a/generate_bubbles.sh b/generate_bubbles.sh index 98157f4fae..5dc2bc2e0b 100755 --- a/generate_bubbles.sh +++ b/generate_bubbles.sh @@ -6,7 +6,7 @@ my_dir="$(dirname "$(realpath "$0")")" pushd "$my_dir" > /dev/null res_dir="vector/src/main/res" -god_bubble="vector/src/main/res/drawable/msg_godbubble.xml" +god_bubble="$res_dir/drawable/msg_godbubble.xml" # Multiline sed -i function mised() { @@ -91,6 +91,17 @@ function create_msg_bubble() { sed -i 's|||g' "$out_bubble" } +function create_rounded_xml() { + local roundness="$1" + local infile="$2" + if [ ! -z "$roundness" ]; then + local outfile="$(dirname "$infile")/$(basename "$infile" .xml)_$roundness.xml" + cp "$infile" "$outfile" + echo "$outfile" + sed -i "s|sc_bubble_radius|sc_bubble_${roundness}_radius|g" "$outfile" + fi +} + for roundness in "" "r1" "r2"; do for is_outgoing in 0 1; do for is_rtl in 0 1; do @@ -103,6 +114,10 @@ for roundness in "" "r1" "r2"; do #done done done + create_rounded_xml "$roundness" "$res_dir/drawable/timestamp_overlay.xml" + create_rounded_xml "$roundness" "$res_dir/drawable-ldrtl/timestamp_overlay.xml" + create_rounded_xml "$roundness" "$res_dir/drawable/background_image_border_incoming.xml" + create_rounded_xml "$roundness" "$res_dir/drawable/background_image_border_outgoing.xml" done 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 c8252a3c7a..6fe0d3dfc7 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 @@ -197,15 +197,14 @@ abstract class MessageImageVideoItem : AbsMessageItem { + !(messageLayout.isRealBubble || messageLayout.isPseudoBubble) || mode != ImageContentRenderer.Mode.THUMBNAIL -> { holder.mediaContentView.background = null } attributes.informationData.sentByMe -> { - holder.mediaContentView.setBackgroundResource(R.drawable.background_image_border_outgoing) + holder.mediaContentView.setBackgroundResource(messageLayout.bubbleAppearance.imageBorderOutgoing) } else -> { - holder.mediaContentView.setBackgroundResource(R.drawable.background_image_border_incoming) + holder.mediaContentView.setBackgroundResource(messageLayout.bubbleAppearance.imageBorderIncoming) } } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/ScMessageBubbleWrapView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/ScMessageBubbleWrapView.kt index 0574569b8c..1b0f2aeaf7 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/ScMessageBubbleWrapView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/view/ScMessageBubbleWrapView.kt @@ -339,7 +339,7 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs: bubbleDependentView.reserveFooterSpace(holder, footerWidth, footerHeight) } else { // We have no reserved space -> style it to ensure readability on arbitrary backgrounds - styleFooterOverlay() + styleFooterOverlay(messageLayout) } } else { when { @@ -437,8 +437,8 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs: views.bubbleFooterMessageTimeView.setTextColor(tintList) } - private fun styleFooterOverlay() { - views.bubbleFootView.setBackgroundResource(R.drawable.timestamp_overlay) + private fun styleFooterOverlay(messageLayout: TimelineMessageLayout.ScBubble) { + views.bubbleFootView.setBackgroundResource(messageLayout.bubbleAppearance.timestampOverlay) tintFooter(ThemeUtils.getColor(views.bubbleFootView.context, R.attr.timestamp_overlay_fg)) val padding = views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_overlay_padding) views.bubbleFootView.setPaddingRelative( diff --git a/vector/src/main/java/im/vector/app/features/themes/BubbleThemeUtils.kt b/vector/src/main/java/im/vector/app/features/themes/BubbleThemeUtils.kt index 593da8fc5a..b10edb75d3 100644 --- a/vector/src/main/java/im/vector/app/features/themes/BubbleThemeUtils.kt +++ b/vector/src/main/java/im/vector/app/features/themes/BubbleThemeUtils.kt @@ -116,6 +116,12 @@ data class ScBubbleAppearance( val textBubbleOutgoingNoTail: Int, @DrawableRes val textBubbleIncomingNoTail: Int, + @DrawableRes + val timestampOverlay: Int, + @DrawableRes + val imageBorderOutgoing: Int, + @DrawableRes + val imageBorderIncoming: Int, ) : Parcelable { fun getBubbleRadiusPx(context: Context): Int { return context.resources.getDimensionPixelSize(roundness) @@ -131,6 +137,9 @@ val defaultScBubbleAppearance = ScBubbleAppearance( R.drawable.msg_bubble_text_incoming, R.drawable.msg_bubble_text_outgoing_notail, R.drawable.msg_bubble_text_incoming_notail, + R.drawable.timestamp_overlay, + R.drawable.background_image_border_outgoing, + R.drawable.background_image_border_incoming, ) val r1ScBubbleAppearance = ScBubbleAppearance( @@ -139,6 +148,9 @@ val r1ScBubbleAppearance = ScBubbleAppearance( R.drawable.msg_bubble_r1_text_incoming, R.drawable.msg_bubble_r1_text_outgoing_notail, R.drawable.msg_bubble_r1_text_incoming_notail, + R.drawable.timestamp_overlay_r1, + R.drawable.background_image_border_outgoing_r1, + R.drawable.background_image_border_incoming_r1, ) @@ -148,4 +160,7 @@ val r2ScBubbleAppearance = ScBubbleAppearance( R.drawable.msg_bubble_r2_text_incoming, R.drawable.msg_bubble_r2_text_outgoing_notail, R.drawable.msg_bubble_r2_text_incoming_notail, + R.drawable.timestamp_overlay_r2, + R.drawable.background_image_border_outgoing_r2, + R.drawable.background_image_border_incoming_r2, ) diff --git a/vector/src/main/res/drawable-ldrtl/timestamp_overlay.xml b/vector/src/main/res/drawable-ldrtl/timestamp_overlay.xml index fb6ae76ef8..de3f7a853f 100644 --- a/vector/src/main/res/drawable-ldrtl/timestamp_overlay.xml +++ b/vector/src/main/res/drawable-ldrtl/timestamp_overlay.xml @@ -3,8 +3,8 @@ - + diff --git a/vector/src/main/res/drawable-ldrtl/timestamp_overlay_r1.xml b/vector/src/main/res/drawable-ldrtl/timestamp_overlay_r1.xml new file mode 100644 index 0000000000..ef4b41f79e --- /dev/null +++ b/vector/src/main/res/drawable-ldrtl/timestamp_overlay_r1.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/vector/src/main/res/drawable-ldrtl/timestamp_overlay_r2.xml b/vector/src/main/res/drawable-ldrtl/timestamp_overlay_r2.xml new file mode 100644 index 0000000000..73a590f313 --- /dev/null +++ b/vector/src/main/res/drawable-ldrtl/timestamp_overlay_r2.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/vector/src/main/res/drawable/background_image_border_incoming.xml b/vector/src/main/res/drawable/background_image_border_incoming.xml index b2ac60603c..cb99c3d93b 100644 --- a/vector/src/main/res/drawable/background_image_border_incoming.xml +++ b/vector/src/main/res/drawable/background_image_border_incoming.xml @@ -6,8 +6,8 @@ - - \ No newline at end of file + + diff --git a/vector/src/main/res/drawable/background_image_border_incoming_r1.xml b/vector/src/main/res/drawable/background_image_border_incoming_r1.xml new file mode 100644 index 0000000000..c21e2e9460 --- /dev/null +++ b/vector/src/main/res/drawable/background_image_border_incoming_r1.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/vector/src/main/res/drawable/background_image_border_incoming_r2.xml b/vector/src/main/res/drawable/background_image_border_incoming_r2.xml new file mode 100644 index 0000000000..8312d7cd2f --- /dev/null +++ b/vector/src/main/res/drawable/background_image_border_incoming_r2.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/vector/src/main/res/drawable/background_image_border_outgoing.xml b/vector/src/main/res/drawable/background_image_border_outgoing.xml index 066c8f4c6c..5110468fd0 100644 --- a/vector/src/main/res/drawable/background_image_border_outgoing.xml +++ b/vector/src/main/res/drawable/background_image_border_outgoing.xml @@ -6,8 +6,8 @@ - - \ No newline at end of file + + diff --git a/vector/src/main/res/drawable/background_image_border_outgoing_r1.xml b/vector/src/main/res/drawable/background_image_border_outgoing_r1.xml new file mode 100644 index 0000000000..35dc44ed8a --- /dev/null +++ b/vector/src/main/res/drawable/background_image_border_outgoing_r1.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/vector/src/main/res/drawable/background_image_border_outgoing_r2.xml b/vector/src/main/res/drawable/background_image_border_outgoing_r2.xml new file mode 100644 index 0000000000..015bfe7216 --- /dev/null +++ b/vector/src/main/res/drawable/background_image_border_outgoing_r2.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/vector/src/main/res/drawable/timestamp_overlay.xml b/vector/src/main/res/drawable/timestamp_overlay.xml index 00aa4c4c99..60bd10ba8d 100644 --- a/vector/src/main/res/drawable/timestamp_overlay.xml +++ b/vector/src/main/res/drawable/timestamp_overlay.xml @@ -3,8 +3,8 @@ - + diff --git a/vector/src/main/res/drawable/timestamp_overlay_r1.xml b/vector/src/main/res/drawable/timestamp_overlay_r1.xml new file mode 100644 index 0000000000..72d38245e9 --- /dev/null +++ b/vector/src/main/res/drawable/timestamp_overlay_r1.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/vector/src/main/res/drawable/timestamp_overlay_r2.xml b/vector/src/main/res/drawable/timestamp_overlay_r2.xml new file mode 100644 index 0000000000..f3e0b48010 --- /dev/null +++ b/vector/src/main/res/drawable/timestamp_overlay_r2.xml @@ -0,0 +1,10 @@ + + + + + + + +