mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-10 22:34:15 +01:00
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:
parent
b26b598a6c
commit
a2dac5e0fa
@ -89,6 +89,7 @@ class OutcomingTextMessageViewHolder(itemView: View) :
|
|||||||
itemView
|
itemView
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var isBubbled = true
|
||||||
if (
|
if (
|
||||||
(message.messageParameters == null || message.messageParameters!!.size <= 0) &&
|
(message.messageParameters == null || message.messageParameters!!.size <= 0) &&
|
||||||
TextMatchers.isMessageWithSingleEmoticonOnly(message.text)
|
TextMatchers.isMessageWithSingleEmoticonOnly(message.text)
|
||||||
@ -96,6 +97,7 @@ class OutcomingTextMessageViewHolder(itemView: View) :
|
|||||||
textSize = (textSize * TEXT_SIZE_MULTIPLIER).toFloat()
|
textSize = (textSize * TEXT_SIZE_MULTIPLIER).toFloat()
|
||||||
layoutParams.isWrapBefore = true
|
layoutParams.isWrapBefore = true
|
||||||
realView.isSelected = true
|
realView.isSelected = true
|
||||||
|
isBubbled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
setBubbleOnChatMessage(message)
|
setBubbleOnChatMessage(message)
|
||||||
@ -154,7 +156,8 @@ class OutcomingTextMessageViewHolder(itemView: View) :
|
|||||||
binding.reactions,
|
binding.reactions,
|
||||||
context,
|
context,
|
||||||
true,
|
true,
|
||||||
viewThemeUtils
|
viewThemeUtils,
|
||||||
|
isBubbled
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@ import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
|||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
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.models.BrowserFile
|
||||||
import com.nextcloud.talk.components.filebrowser.webdav.ReadFilesystemOperation
|
import com.nextcloud.talk.components.filebrowser.webdav.ReadFilesystemOperation
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
|
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
|
||||||
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
|
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
|
||||||
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
|
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.ui.theme.ViewThemeUtils
|
||||||
import com.nextcloud.talk.users.UserManager
|
import com.nextcloud.talk.users.UserManager
|
||||||
import com.nextcloud.talk.utils.DateUtils
|
import com.nextcloud.talk.utils.DateUtils
|
||||||
@ -158,7 +158,8 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
|
|||||||
reactionsBinding!!,
|
reactionsBinding!!,
|
||||||
messageText.context,
|
messageText.context,
|
||||||
true,
|
true,
|
||||||
viewThemeUtils!!
|
viewThemeUtils!!,
|
||||||
|
hasBubbleBackground(message)
|
||||||
)
|
)
|
||||||
reactionsBinding!!.reactionsEmojiWrapper.setPadding(paddingSide,0,paddingSide,0)
|
reactionsBinding!!.reactionsEmojiWrapper.setPadding(paddingSide,0,paddingSide,0)
|
||||||
|
|
||||||
@ -315,6 +316,10 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
|
|||||||
this.previewMessageInterface = previewMessageInterface
|
this.previewMessageInterface = previewMessageInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hasBubbleBackground(message: ChatMessage): Boolean {
|
||||||
|
return !message.isVoiceMessage && message.message != "{file}";
|
||||||
|
}
|
||||||
|
|
||||||
abstract val messageText: EmojiTextView
|
abstract val messageText: EmojiTextView
|
||||||
abstract val messageCaption: EmojiTextView
|
abstract val messageCaption: EmojiTextView
|
||||||
abstract val previewContainer: View
|
abstract val previewContainer: View
|
||||||
|
@ -26,7 +26,8 @@ class Reaction {
|
|||||||
binding: ReactionsInsideMessageBinding,
|
binding: ReactionsInsideMessageBinding,
|
||||||
context: Context,
|
context: Context,
|
||||||
isOutgoingMessage: Boolean,
|
isOutgoingMessage: Boolean,
|
||||||
viewThemeUtils: ViewThemeUtils
|
viewThemeUtils: ViewThemeUtils,
|
||||||
|
isBubbled: Boolean = true
|
||||||
) {
|
) {
|
||||||
binding.reactionsEmojiWrapper.removeAllViews()
|
binding.reactionsEmojiWrapper.removeAllViews()
|
||||||
|
|
||||||
@ -64,7 +65,8 @@ class Reaction {
|
|||||||
viewThemeUtils,
|
viewThemeUtils,
|
||||||
isOutgoingMessage,
|
isOutgoingMessage,
|
||||||
isSelfReaction
|
isSelfReaction
|
||||||
)
|
),
|
||||||
|
isBubbled
|
||||||
)
|
)
|
||||||
|
|
||||||
emojiWithAmountWrapper.setOnClickListener {
|
emojiWithAmountWrapper.setOnClickListener {
|
||||||
@ -86,7 +88,8 @@ class Reaction {
|
|||||||
context: Context,
|
context: Context,
|
||||||
emoji: String,
|
emoji: String,
|
||||||
amount: Int,
|
amount: Int,
|
||||||
layoutInfo: EmojiWithAmountWrapperLayoutInfo
|
layoutInfo: EmojiWithAmountWrapperLayoutInfo,
|
||||||
|
isBubbled: Boolean
|
||||||
): LinearLayout {
|
): LinearLayout {
|
||||||
val emojiWithAmountWrapper = LinearLayout(context)
|
val emojiWithAmountWrapper = LinearLayout(context)
|
||||||
emojiWithAmountWrapper.orientation = LinearLayout.HORIZONTAL
|
emojiWithAmountWrapper.orientation = LinearLayout.HORIZONTAL
|
||||||
@ -96,7 +99,11 @@ class Reaction {
|
|||||||
emojiWithAmountWrapper.layoutParams = layoutInfo.wrapperParams
|
emojiWithAmountWrapper.layoutParams = layoutInfo.wrapperParams
|
||||||
|
|
||||||
if (layoutInfo.isSelfReaction) {
|
if (layoutInfo.isSelfReaction) {
|
||||||
layoutInfo.viewThemeUtils.talk.setCheckedBackground(emojiWithAmountWrapper, layoutInfo.isOutgoingMessage)
|
layoutInfo.viewThemeUtils.talk.setCheckedBackground(
|
||||||
|
emojiWithAmountWrapper,
|
||||||
|
layoutInfo.isOutgoingMessage,
|
||||||
|
isBubbled
|
||||||
|
)
|
||||||
|
|
||||||
emojiWithAmountWrapper.setPaddingRelative(
|
emojiWithAmountWrapper.setPaddingRelative(
|
||||||
layoutInfo.paddingSide,
|
layoutInfo.paddingSide,
|
||||||
|
@ -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 ->
|
withScheme(linearLayout) { scheme ->
|
||||||
val drawable = AppCompatResources
|
val drawable = AppCompatResources
|
||||||
.getDrawable(linearLayout.context, R.drawable.reaction_self_background)!!
|
.getDrawable(linearLayout.context, R.drawable.reaction_self_background)!!
|
||||||
.mutate()
|
.mutate()
|
||||||
val backgroundColor = if (outgoing) {
|
val backgroundColor = if (outgoing && isBubbled) {
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
linearLayout.context,
|
linearLayout.context,
|
||||||
R.color.bg_message_list_incoming_bubble
|
R.color.bg_message_list_incoming_bubble
|
||||||
|
Loading…
Reference in New Issue
Block a user