From 59966998125c3358d26714674a10ff00a438d339 Mon Sep 17 00:00:00 2001 From: sowjanyakch Date: Tue, 14 May 2024 10:41:25 +0200 Subject: [PATCH] Align display name of conversation to center when description is empty. Signed-off-by: sowjanyakch --- .../adapters/OpenConversationsAdapter.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/openconversations/adapters/OpenConversationsAdapter.kt b/app/src/main/java/com/nextcloud/talk/openconversations/adapters/OpenConversationsAdapter.kt index 52ab261be..645b49c5f 100644 --- a/app/src/main/java/com/nextcloud/talk/openconversations/adapters/OpenConversationsAdapter.kt +++ b/app/src/main/java/com/nextcloud/talk/openconversations/adapters/OpenConversationsAdapter.kt @@ -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)