style(reactions): ensure correct color coding of own reaction backgrounds

Resolves #4557

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2025-01-16 15:24:09 +01:00
parent b26b598a6c
commit a2dac5e0fa
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
4 changed files with 24 additions and 9 deletions

View File

@ -89,6 +89,7 @@ class OutcomingTextMessageViewHolder(itemView: View) :
itemView
)
var isBubbled = true
if (
(message.messageParameters == null || message.messageParameters!!.size <= 0) &&
TextMatchers.isMessageWithSingleEmoticonOnly(message.text)
@ -96,6 +97,7 @@ class OutcomingTextMessageViewHolder(itemView: View) :
textSize = (textSize * TEXT_SIZE_MULTIPLIER).toFloat()
layoutParams.isWrapBefore = true
realView.isSelected = true
isBubbled = false
}
setBubbleOnChatMessage(message)
@ -154,7 +156,8 @@ class OutcomingTextMessageViewHolder(itemView: View) :
binding.reactions,
context,
true,
viewThemeUtils
viewThemeUtils,
isBubbled
)
}

View File

@ -28,13 +28,13 @@ import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.components.filebrowser.models.BrowserFile
import com.nextcloud.talk.components.filebrowser.webdav.ReadFilesystemOperation
import com.nextcloud.talk.data.user.model.User
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.users.UserManager
import com.nextcloud.talk.utils.DateUtils
@ -158,7 +158,8 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
reactionsBinding!!,
messageText.context,
true,
viewThemeUtils!!
viewThemeUtils!!,
hasBubbleBackground(message)
)
reactionsBinding!!.reactionsEmojiWrapper.setPadding(paddingSide,0,paddingSide,0)
@ -315,6 +316,10 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
this.previewMessageInterface = previewMessageInterface
}
fun hasBubbleBackground(message: ChatMessage): Boolean {
return !message.isVoiceMessage && message.message != "{file}";
}
abstract val messageText: EmojiTextView
abstract val messageCaption: EmojiTextView
abstract val previewContainer: View

View File

@ -26,7 +26,8 @@ class Reaction {
binding: ReactionsInsideMessageBinding,
context: Context,
isOutgoingMessage: Boolean,
viewThemeUtils: ViewThemeUtils
viewThemeUtils: ViewThemeUtils,
isBubbled: Boolean = true
) {
binding.reactionsEmojiWrapper.removeAllViews()
@ -64,7 +65,8 @@ class Reaction {
viewThemeUtils,
isOutgoingMessage,
isSelfReaction
)
),
isBubbled
)
emojiWithAmountWrapper.setOnClickListener {
@ -86,7 +88,8 @@ class Reaction {
context: Context,
emoji: String,
amount: Int,
layoutInfo: EmojiWithAmountWrapperLayoutInfo
layoutInfo: EmojiWithAmountWrapperLayoutInfo,
isBubbled: Boolean
): LinearLayout {
val emojiWithAmountWrapper = LinearLayout(context)
emojiWithAmountWrapper.orientation = LinearLayout.HORIZONTAL
@ -96,7 +99,11 @@ class Reaction {
emojiWithAmountWrapper.layoutParams = layoutInfo.wrapperParams
if (layoutInfo.isSelfReaction) {
layoutInfo.viewThemeUtils.talk.setCheckedBackground(emojiWithAmountWrapper, layoutInfo.isOutgoingMessage)
layoutInfo.viewThemeUtils.talk.setCheckedBackground(
emojiWithAmountWrapper,
layoutInfo.isOutgoingMessage,
isBubbled
)
emojiWithAmountWrapper.setPaddingRelative(
layoutInfo.paddingSide,

View File

@ -168,12 +168,12 @@ class TalkSpecificViewThemeUtils @Inject constructor(
}
}
fun setCheckedBackground(linearLayout: LinearLayout, outgoing: Boolean) {
fun setCheckedBackground(linearLayout: LinearLayout, outgoing: Boolean, isBubbled: Boolean) {
withScheme(linearLayout) { scheme ->
val drawable = AppCompatResources
.getDrawable(linearLayout.context, R.drawable.reaction_self_background)!!
.mutate()
val backgroundColor = if (outgoing) {
val backgroundColor = if (outgoing && isBubbled) {
ContextCompat.getColor(
linearLayout.context,
R.color.bg_message_list_incoming_bubble