From 9e7996b7668ebb5a3c38721004b325fa5c6d1478 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 16 Jan 2025 14:06:23 +0100 Subject: [PATCH 1/7] style(reaction): make reactions background rounded instead of pill-styled Signed-off-by: Andy Scherzinger --- app/src/main/res/drawable/reaction_self_background.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/drawable/reaction_self_background.xml b/app/src/main/res/drawable/reaction_self_background.xml index 9e088caee..057c39c22 100644 --- a/app/src/main/res/drawable/reaction_self_background.xml +++ b/app/src/main/res/drawable/reaction_self_background.xml @@ -19,5 +19,5 @@ android:right="1dp" android:top="1dp" /> - + From b26b598a6cb0d3337e89f83706f97e29e09c5d70 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 16 Jan 2025 14:07:04 +0100 Subject: [PATCH 2/7] style(reactions): Align reactions with text for preview messages Signed-off-by: Andy Scherzinger --- .../talk/adapters/messages/PreviewMessageViewHolder.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt index 02159ceab..fd2ddb823 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt @@ -150,6 +150,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : messageText.text = "" } itemView.setTag(R.string.replyable_message_view_tag, message.replyable) + val paddingSide = DisplayUtils.convertDpToPixel(8.0f, context!!).toInt() Reaction().showReactions( message, ::clickOnReaction, @@ -159,6 +160,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : true, viewThemeUtils!! ) + reactionsBinding!!.reactionsEmojiWrapper.setPadding(paddingSide,0,paddingSide,0) if (userAvatar != null) { if (message.isGrouped || message.isOneToOneConversation) { From a2dac5e0fa9e8a79711fd0b03362060d46076be6 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 16 Jan 2025 15:24:09 +0100 Subject: [PATCH 3/7] style(reactions): ensure correct color coding of own reaction backgrounds Resolves #4557 Signed-off-by: Andy Scherzinger --- .../messages/OutcomingTextMessageViewHolder.kt | 5 ++++- .../adapters/messages/PreviewMessageViewHolder.kt | 9 +++++++-- .../nextcloud/talk/adapters/messages/Reaction.kt | 15 +++++++++++---- .../talk/ui/theme/TalkSpecificViewThemeUtils.kt | 4 ++-- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt index dfb8b9e2e..907b3cd1d 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt @@ -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 ) } diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt index fd2ddb823..27f10d13b 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt @@ -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 diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt index 801c2220b..d348993e0 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt @@ -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, diff --git a/app/src/main/java/com/nextcloud/talk/ui/theme/TalkSpecificViewThemeUtils.kt b/app/src/main/java/com/nextcloud/talk/ui/theme/TalkSpecificViewThemeUtils.kt index 33d9e41e5..073ef7434 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/theme/TalkSpecificViewThemeUtils.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/theme/TalkSpecificViewThemeUtils.kt @@ -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 From 0a6a1a703fe92c23f67c7c349ba1983a5d98eaa9 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 16 Jan 2025 15:53:30 +0100 Subject: [PATCH 4/7] style(reactions): Add default vertical spacing at top of reactions Signed-off-by: Andy Scherzinger --- app/src/main/res/layout/reactions_inside_message.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/reactions_inside_message.xml b/app/src/main/res/layout/reactions_inside_message.xml index 089ad0d86..ea083ffcf 100644 --- a/app/src/main/res/layout/reactions_inside_message.xml +++ b/app/src/main/res/layout/reactions_inside_message.xml @@ -18,6 +18,7 @@ android:id="@+id/reactions_emoji_wrapper" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="@dimen/standard_half_margin" android:gravity="center_vertical" - android:orientation="horizontal"/> + android:orientation="horizontal" /> From e4088d0ddca5767e7351a0b8f841e69b4ea84ae5 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 16 Jan 2025 15:57:24 +0100 Subject: [PATCH 5/7] style(lint): Fix formatting Signed-off-by: Andy Scherzinger --- .../talk/adapters/messages/PreviewMessageViewHolder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt index 27f10d13b..3d8cfcc69 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt @@ -161,7 +161,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : viewThemeUtils!!, hasBubbleBackground(message) ) - reactionsBinding!!.reactionsEmojiWrapper.setPadding(paddingSide,0,paddingSide,0) + reactionsBinding!!.reactionsEmojiWrapper.setPadding(paddingSide, 0, paddingSide, 0) if (userAvatar != null) { if (message.isGrouped || message.isOneToOneConversation) { @@ -317,7 +317,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : } fun hasBubbleBackground(message: ChatMessage): Boolean { - return !message.isVoiceMessage && message.message != "{file}"; + return !message.isVoiceMessage && message.message != "{file}" } abstract val messageText: EmojiTextView From 9e3840c3a9eeef9ee50e75112437df6a43d5adb3 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 16 Jan 2025 16:25:28 +0100 Subject: [PATCH 6/7] style(lint): replace magic number with constant Signed-off-by: Andy Scherzinger --- .../talk/adapters/messages/PreviewMessageViewHolder.kt | 3 ++- detekt.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt index 3d8cfcc69..a70173c05 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt @@ -150,7 +150,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : messageText.text = "" } itemView.setTag(R.string.replyable_message_view_tag, message.replyable) - val paddingSide = DisplayUtils.convertDpToPixel(8.0f, context!!).toInt() + val paddingSide = DisplayUtils.convertDpToPixel(HORIZONTAL_REACTION_PADDING, context!!).toInt() Reaction().showReactions( message, ::clickOnReaction, @@ -339,5 +339,6 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : const val ACTOR_ID_CHANGELOG = "changelog" const val KEY_NAME = "name" const val MIN_IMAGE_HEIGHT = 100F + const val HORIZONTAL_REACTION_PADDING = 8.0F } } diff --git a/detekt.yml b/detekt.yml index 7ad14df30..f0922b2d9 100644 --- a/detekt.yml +++ b/detekt.yml @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: GPL-3.0-or-later build: - maxIssues: 82 + maxIssues: 78 weights: # complexity: 2 # LongParameterList: 1 From 9fcd46657685b9816b4b48acf5977d3d6089dddc Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 16 Jan 2025 18:25:07 +0100 Subject: [PATCH 7/7] style(icons): Update pdf icon to latest server version / material symbols Signed-off-by: Andy Scherzinger --- app/src/main/res/drawable/ic_mimetype_application_pdf.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/drawable/ic_mimetype_application_pdf.xml b/app/src/main/res/drawable/ic_mimetype_application_pdf.xml index d1ee120cb..f72565666 100755 --- a/app/src/main/res/drawable/ic_mimetype_application_pdf.xml +++ b/app/src/main/res/drawable/ic_mimetype_application_pdf.xml @@ -7,10 +7,10 @@ + android:fillColor="#DC5047" + 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" />