diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7d03d5f12..6d475a01842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ ## stream-chat-android-ui-components ### 🐞 Fixed - Fixed crash on `AttachmentGalleryActivity`. [#5284](https://github.com/GetStream/stream-chat-android/pull/5284) +- Fixed quoted message styling to be consistent with `isMine` property. [#5287](https://github.com/GetStream/stream-chat-android/pull/5287) + * 🚨If you are overriding `TransformStyle.messageReplyStyleTransformer`, please ensure you validate your UI after this change. ### ⬆️ Improved diff --git a/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/application/ChatInitializer.kt b/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/application/ChatInitializer.kt index 5fe41022658..5071b6d13c6 100644 --- a/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/application/ChatInitializer.kt +++ b/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/application/ChatInitializer.kt @@ -162,6 +162,33 @@ class ChatInitializer( ) } + /*val lightGray = ContextCompat.getColor(context, R.color.stream_ui_grey_whisper) + TransformStyle.messageListItemStyleTransformer = StyleTransformer { defaultStyle -> + defaultStyle.copy( + messageBackgroundColorMine = Color.BLACK, + messageBackgroundColorTheirs = lightGray, + textStyleMine = defaultStyle.textStyleMine.copy( + color = Color.WHITE, + ), + textStyleTheirs = defaultStyle.textStyleTheirs.copy( + color = Color.BLACK, + ), + ) + } + + TransformStyle.messageReplyStyleTransformer = StyleTransformer { defaultStyle -> + defaultStyle.copy( + messageBackgroundColorMine = lightGray, + messageBackgroundColorTheirs = Color.BLACK, + textStyleMine = defaultStyle.textStyleMine.copy( + color = Color.BLACK, + ), + textStyleTheirs = defaultStyle.textStyleTheirs.copy( + color = Color.WHITE, + ), + ) + }*/ + ChatUI.decoratorProviderFactory = CustomDecoratorProviderFactory() + DecoratorProviderFactory.defaultFactory() } } diff --git a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/view/MessageReplyView.kt b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/view/MessageReplyView.kt index 9e148106604..7fee8c903b7 100644 --- a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/view/MessageReplyView.kt +++ b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/adapter/view/MessageReplyView.kt @@ -153,27 +153,29 @@ public class MessageReplyView : FrameLayout { } setTint(color) } - quotedMessage.isMine(ChatClient.instance().getCurrentUser()) -> { + isMine -> { paintStyle = Paint.Style.FILL_AND_STROKE - val color = if (isMine) { - style?.messageBackgroundColorTheirs ?: context.getColorCompat(R.color.stream_ui_white) - } else { - style?.messageBackgroundColorMine ?: context.getColorCompat(R.color.stream_ui_grey_whisper) - } - setTint(color) - style?.messageStrokeColorMine?.let(::setStrokeTint) + setStrokeTint( + style?.messageStrokeColorMine + ?: context.getColorCompat(R.color.stream_ui_literal_transparent), + ) strokeWidth = style?.messageStrokeWidthMine ?: DEFAULT_STROKE_WIDTH + setTint( + style?.messageBackgroundColorMine + ?: context.getColorCompat(R.color.stream_ui_white), + ) } else -> { paintStyle = Paint.Style.FILL_AND_STROKE setStrokeTint( style?.messageStrokeColorTheirs - ?: context.getColorCompat(R.color.stream_ui_grey_whisper), + ?: context.getColorCompat(R.color.stream_ui_grey_gainsboro), ) strokeWidth = style?.messageStrokeWidthTheirs ?: DEFAULT_STROKE_WIDTH - val tintColor = - style?.messageBackgroundColorTheirs ?: context.getColorCompat(R.color.stream_ui_white) - setTint(tintColor) + setTint( + style?.messageBackgroundColorTheirs + ?: context.getColorCompat(R.color.stream_ui_grey_whisper), + ) } } } diff --git a/stream-chat-android-ui-components/src/main/res/values/styles.xml b/stream-chat-android-ui-components/src/main/res/values/styles.xml index 4daf1b6655e..0f2d416ad21 100644 --- a/stream-chat-android-ui-components/src/main/res/values/styles.xml +++ b/stream-chat-android-ui-components/src/main/res/values/styles.xml @@ -364,8 +364,8 @@ normal - @color/stream_ui_grey_gainsboro - @color/stream_ui_bars_background + @color/stream_ui_bars_background + @color/stream_ui_grey_gainsboro @dimen/stream_ui_text_medium