Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PBE-4110] fix quoted message styling #5287

Merged
merged 4 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package io.getstream.chat.ui.sample.application

import android.content.Context
import android.graphics.Color
import androidx.core.content.ContextCompat
import com.google.firebase.FirebaseApp
import io.getstream.android.push.firebase.FirebasePushDeviceGenerator
import io.getstream.android.push.huawei.HuaweiPushDeviceGenerator
Expand All @@ -40,6 +41,7 @@ import io.getstream.chat.android.ui.feature.messages.list.adapter.viewholder.dec
import io.getstream.chat.android.ui.helper.StyleTransformer
import io.getstream.chat.android.ui.helper.TransformStyle
import io.getstream.chat.ui.sample.BuildConfig
import io.getstream.chat.ui.sample.R
import io.getstream.chat.ui.sample.debugger.CustomChatClientDebugger
import io.getstream.chat.ui.sample.feature.HostActivity
import io.getstream.chat.ui.sample.feature.chat.messagelist.decorator.CustomDecoratorProviderFactory
Expand Down Expand Up @@ -162,6 +164,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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,27 +153,25 @@ 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(
aleksandar-apostolov marked this conversation as resolved.
Show resolved Hide resolved
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))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@
<item name="streamUiMessageTextStyleThreadSeparator">normal</item>

<!-- Message Reply background color -->
<item name="streamUiMessageReplyBackgroundColorMine">@color/stream_ui_grey_gainsboro</item>
<item name="streamUiMessageReplyBackgroundColorTheirs">@color/stream_ui_bars_background</item>
<item name="streamUiMessageReplyBackgroundColorMine">@color/stream_ui_bars_background</item>
<item name="streamUiMessageReplyBackgroundColorTheirs">@color/stream_ui_grey_gainsboro</item>

<!-- Message Reply text style mine -->
<item name="streamUiMessageReplyTextSizeMine">@dimen/stream_ui_text_medium</item>
Expand Down
Loading