mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
Merge pull request #2706 from nextcloud/bugfix/2705/fixToShowAuthorNameInGroupConversation
Bugfix/2705/fix to show author name in group conversation
This commit is contained in:
commit
35af42e5bf
@ -122,6 +122,7 @@ class IncomingLinkPreviewMessageViewHolder(incomingView: View, payload: Any) : M
|
|||||||
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
||||||
val author: String = message.actorDisplayName!!
|
val author: String = message.actorDisplayName!!
|
||||||
if (!TextUtils.isEmpty(author)) {
|
if (!TextUtils.isEmpty(author)) {
|
||||||
|
binding.messageAuthor.visibility = View.VISIBLE
|
||||||
binding.messageAuthor.text = author
|
binding.messageAuthor.text = author
|
||||||
binding.messageUserAvatar.setOnClickListener {
|
binding.messageUserAvatar.setOnClickListener {
|
||||||
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
||||||
|
@ -126,6 +126,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) : Mess
|
|||||||
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
||||||
val author: String = message.actorDisplayName!!
|
val author: String = message.actorDisplayName!!
|
||||||
if (!TextUtils.isEmpty(author)) {
|
if (!TextUtils.isEmpty(author)) {
|
||||||
|
binding.messageAuthor.visibility = View.VISIBLE
|
||||||
binding.messageAuthor.text = author
|
binding.messageAuthor.text = author
|
||||||
binding.messageUserAvatar.setOnClickListener {
|
binding.messageUserAvatar.setOnClickListener {
|
||||||
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
||||||
|
@ -146,6 +146,7 @@ class IncomingPollMessageViewHolder(incomingView: View, payload: Any) : MessageH
|
|||||||
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
||||||
val author: String = message.actorDisplayName!!
|
val author: String = message.actorDisplayName!!
|
||||||
if (!TextUtils.isEmpty(author)) {
|
if (!TextUtils.isEmpty(author)) {
|
||||||
|
binding.messageAuthor.visibility = View.VISIBLE
|
||||||
binding.messageAuthor.text = author
|
binding.messageAuthor.text = author
|
||||||
binding.messageUserAvatar.setOnClickListener {
|
binding.messageUserAvatar.setOnClickListener {
|
||||||
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
*
|
*
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* @author Tim Krüger
|
* @author Tim Krüger
|
||||||
|
* @author Marcel Hibbe
|
||||||
|
* Copyright (C) 2022-2023 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* Copyright (C) 2021-2022 Tim Krüger <t@timkrueger.me>
|
* Copyright (C) 2021-2022 Tim Krüger <t@timkrueger.me>
|
||||||
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
*
|
*
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
* @author Mario Danic
|
* @author Mario Danic
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* @author Tim Krüger
|
* @author Tim Krüger
|
||||||
|
* @author Marcel Hibbe
|
||||||
|
* Copyright (C) 2022-2023 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
|
* Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
|
||||||
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||||
@ -75,20 +77,10 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) : MessageHolde
|
|||||||
override fun onBind(message: ChatMessage) {
|
override fun onBind(message: ChatMessage) {
|
||||||
super.onBind(message)
|
super.onBind(message)
|
||||||
sharedApplication!!.componentApplication.inject(this)
|
sharedApplication!!.componentApplication.inject(this)
|
||||||
processAuthor(message)
|
|
||||||
|
|
||||||
if (!message.isGrouped && !message.isOneToOneConversation) {
|
setAvatarAndAuthorOnMessageItem(message)
|
||||||
showAvatarOnChatMessage(message)
|
|
||||||
} else {
|
|
||||||
if (message.isOneToOneConversation) {
|
|
||||||
binding.messageUserAvatar.visibility = View.GONE
|
|
||||||
} else {
|
|
||||||
binding.messageUserAvatar.visibility = View.INVISIBLE
|
|
||||||
}
|
|
||||||
binding.messageAuthor.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted)
|
colorizeMessageBubble(message)
|
||||||
|
|
||||||
itemView.isSelected = false
|
itemView.isSelected = false
|
||||||
|
|
||||||
@ -139,15 +131,43 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) : MessageHolde
|
|||||||
commonMessageInterface.onClickReaction(chatMessage, emoji)
|
commonMessageInterface.onClickReaction(chatMessage, emoji)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processAuthor(message: ChatMessage) {
|
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
||||||
if (!TextUtils.isEmpty(message.actorDisplayName)) {
|
val author: String = message.actorDisplayName!!
|
||||||
binding.messageAuthor.text = message.actorDisplayName
|
if (!TextUtils.isEmpty(author)) {
|
||||||
|
binding.messageAuthor.visibility = View.VISIBLE
|
||||||
|
binding.messageAuthor.text = author
|
||||||
binding.messageUserAvatar.setOnClickListener {
|
binding.messageUserAvatar.setOnClickListener {
|
||||||
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.messageAuthor.setText(R.string.nc_nick_guest)
|
binding.messageAuthor.setText(R.string.nc_nick_guest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!message.isGrouped && !message.isOneToOneConversation) {
|
||||||
|
setAvatarOnMessage(message)
|
||||||
|
} else {
|
||||||
|
if (message.isOneToOneConversation) {
|
||||||
|
binding.messageUserAvatar.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
binding.messageUserAvatar.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
binding.messageAuthor.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setAvatarOnMessage(message: ChatMessage) {
|
||||||
|
binding.messageUserAvatar.visibility = View.VISIBLE
|
||||||
|
if (message.actorType == "guests") {
|
||||||
|
// do nothing, avatar is set
|
||||||
|
} else if (message.actorType == "bots" && message.actorId == "changelog") {
|
||||||
|
binding.messageUserAvatar.loadChangelogBotAvatar()
|
||||||
|
} else if (message.actorType == "bots") {
|
||||||
|
binding.messageUserAvatar.loadBotsAvatar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun colorizeMessageBubble(message: ChatMessage) {
|
||||||
|
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processParentMessage(message: ChatMessage) {
|
private fun processParentMessage(message: ChatMessage) {
|
||||||
|
@ -223,6 +223,7 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message
|
|||||||
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
||||||
val author: String = message.actorDisplayName!!
|
val author: String = message.actorDisplayName!!
|
||||||
if (!TextUtils.isEmpty(author)) {
|
if (!TextUtils.isEmpty(author)) {
|
||||||
|
binding.messageAuthor.visibility = View.VISIBLE
|
||||||
binding.messageAuthor.text = author
|
binding.messageAuthor.text = author
|
||||||
binding.messageUserAvatar.setOnClickListener {
|
binding.messageUserAvatar.setOnClickListener {
|
||||||
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
(payload as? MessagePayload)?.profileBottomSheet?.showFor(message.actorId!!, itemView.context)
|
||||||
|
@ -56,11 +56,6 @@
|
|||||||
layout="@layout/item_message_quote"
|
layout="@layout/item_message_quote"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<WebView
|
|
||||||
android:id="@+id/webview"
|
|
||||||
android:layout_width="400dp"
|
|
||||||
android:layout_height="200dp" />
|
|
||||||
|
|
||||||
<androidx.emoji2.widget.EmojiTextView
|
<androidx.emoji2.widget.EmojiTextView
|
||||||
android:id="@+id/messageAuthor"
|
android:id="@+id/messageAuthor"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -70,6 +65,11 @@
|
|||||||
android:textColor="@color/textColorMaxContrast"
|
android:textColor="@color/textColorMaxContrast"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/webview"
|
||||||
|
android:layout_width="400dp"
|
||||||
|
android:layout_height="200dp" />
|
||||||
|
|
||||||
<androidx.emoji2.widget.EmojiTextView
|
<androidx.emoji2.widget.EmojiTextView
|
||||||
android:id="@id/messageText"
|
android:id="@id/messageText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
Loading…
Reference in New Issue
Block a user