Align display name of conversation to center when description is empty.

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-05-14 10:41:25 +02:00 committed by Marcel Hibbe
parent a2739b506c
commit 5996699812
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -7,7 +7,9 @@
package com.nextcloud.talk.openconversations.adapters
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
@ -34,9 +36,17 @@ class OpenConversationsAdapter(val user: User, private val onClick: (OpenConvers
}
fun bindItem(conversation: OpenConversation) {
val nameTextLayoutParams: RelativeLayout.LayoutParams = itemBinding.nameText.layoutParams as
RelativeLayout.LayoutParams
currentConversation = conversation
itemBinding.nameText.text = conversation.displayName
itemBinding.descriptionText.text = conversation.description
if (conversation.description == "") {
itemBinding.descriptionText.visibility = View.GONE
nameTextLayoutParams.addRule(RelativeLayout.CENTER_VERTICAL)
} else {
itemBinding.descriptionText.text = conversation.description
}
// load avatar from server when https://github.com/nextcloud/spreed/issues/9600 is solved
// itemBinding.avatarView.loadUserAvatar(user, conversation.displayName, true, false)