mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Merge pull request #4620 from nextcloud/fix/4557/reactionsBackground
Fix reactions background
This commit is contained in:
commit
779c1627aa
@ -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
|
||||||
@ -150,6 +150,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
|
|||||||
messageText.text = ""
|
messageText.text = ""
|
||||||
}
|
}
|
||||||
itemView.setTag(R.string.replyable_message_view_tag, message.replyable)
|
itemView.setTag(R.string.replyable_message_view_tag, message.replyable)
|
||||||
|
val paddingSide = DisplayUtils.convertDpToPixel(HORIZONTAL_REACTION_PADDING, context!!).toInt()
|
||||||
Reaction().showReactions(
|
Reaction().showReactions(
|
||||||
message,
|
message,
|
||||||
::clickOnReaction,
|
::clickOnReaction,
|
||||||
@ -157,8 +158,10 @@ 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)
|
||||||
|
|
||||||
if (userAvatar != null) {
|
if (userAvatar != null) {
|
||||||
if (message.isGrouped || message.isOneToOneConversation) {
|
if (message.isGrouped || message.isOneToOneConversation) {
|
||||||
@ -313,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
|
||||||
@ -332,5 +339,6 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
|
|||||||
const val ACTOR_ID_CHANGELOG = "changelog"
|
const val ACTOR_ID_CHANGELOG = "changelog"
|
||||||
const val KEY_NAME = "name"
|
const val KEY_NAME = "name"
|
||||||
const val MIN_IMAGE_HEIGHT = 100F
|
const val MIN_IMAGE_HEIGHT = 100F
|
||||||
|
const val HORIZONTAL_REACTION_PADDING = 8.0F
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:tint="#dc5047"
|
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#dc5047"
|
android:fillColor="#DC5047"
|
||||||
android:pathData="M20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM11.5,9.5c0,0.83 -0.67,1.5 -1.5,1.5L9,11v1.25c0,0.41 -0.34,0.75 -0.75,0.75s-0.75,-0.34 -0.75,-0.75L7.5,8c0,-0.55 0.45,-1 1,-1L10,7c0.83,0 1.5,0.67 1.5,1.5v1zM16.5,11.5c0,0.83 -0.67,1.5 -1.5,1.5h-2c-0.28,0 -0.5,-0.22 -0.5,-0.5v-5c0,-0.28 0.22,-0.5 0.5,-0.5h2c0.83,0 1.5,0.67 1.5,1.5v3zM20.5,7.75c0,0.41 -0.34,0.75 -0.75,0.75L19,8.5v1h0.75c0.41,0 0.75,0.34 0.75,0.75s-0.34,0.75 -0.75,0.75L19,11v1.25c0,0.41 -0.34,0.75 -0.75,0.75s-0.75,-0.34 -0.75,-0.75L17.5,8c0,-0.55 0.45,-1 1,-1h1.25c0.41,0 0.75,0.34 0.75,0.75zM9,9.5h1v-1L9,8.5v1zM3,6c-0.55,0 -1,0.45 -1,1v13c0,1.1 0.9,2 2,2h13c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L5,20c-0.55,0 -1,-0.45 -1,-1L4,7c0,-0.55 -0.45,-1 -1,-1zM14,11.5h1v-3h-1v3z" />
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M5.75,15.125L7,15.125L7,12.625L8.25,12.625C8.604,12.625 8.901,12.505 9.141,12.265C9.38,12.026 9.5,11.729 9.5,11.375L9.5,10.125C9.5,9.771 9.38,9.474 9.141,9.234C8.901,8.995 8.604,8.875 8.25,8.875L5.75,8.875L5.75,15.125ZM7,11.375L7,10.125L8.25,10.125L8.25,11.375L7,11.375ZM10.75,15.125L13.25,15.125C13.604,15.125 13.901,15.005 14.141,14.765C14.38,14.526 14.5,14.229 14.5,13.875L14.5,10.125C14.5,9.771 14.38,9.474 14.141,9.234C13.901,8.995 13.604,8.875 13.25,8.875L10.75,8.875L10.75,15.125ZM12,13.875L12,10.125L13.25,10.125L13.25,13.875L12,13.875ZM15.75,15.125L17,15.125L17,12.625L18.25,12.625L18.25,11.375L17,11.375L17,10.125L18.25,10.125L18.25,8.875L15.75,8.875L15.75,15.125ZM4.5,22C3.812,22 3.224,21.755 2.735,21.266C2.245,20.776 2,20.188 2,19.5L2,4.5C2,3.813 2.245,3.224 2.735,2.734C3.224,2.245 3.812,2 4.5,2L19.5,2C20.188,2 20.776,2.245 21.266,2.734C21.755,3.224 22,3.813 22,4.5L22,19.5C22,20.188 21.755,20.776 21.266,21.266C20.776,21.755 20.188,22 19.5,22L4.5,22Z" />
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -19,5 +19,5 @@
|
|||||||
android:right="1dp"
|
android:right="1dp"
|
||||||
android:top="1dp" />
|
android:top="1dp" />
|
||||||
|
|
||||||
<corners android:radius="15dp" />
|
<corners android:radius="8dp" />
|
||||||
</shape>
|
</shape>
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
android:id="@+id/reactions_emoji_wrapper"
|
android:id="@+id/reactions_emoji_wrapper"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/standard_half_margin"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"/>
|
android:orientation="horizontal" />
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
build:
|
build:
|
||||||
maxIssues: 82
|
maxIssues: 78
|
||||||
weights:
|
weights:
|
||||||
# complexity: 2
|
# complexity: 2
|
||||||
# LongParameterList: 1
|
# LongParameterList: 1
|
||||||
|
Loading…
Reference in New Issue
Block a user