Refactor code

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-05-10 11:18:02 +02:00 committed by Marcel Hibbe
parent f0670f9f15
commit ed5a12b7da
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
2 changed files with 17 additions and 22 deletions

View file

@ -3474,42 +3474,37 @@ class ChatActivity :
""
}
val statusMessageView = binding.chatToolbar.findViewById<TextView>(R.id.chat_toolbar_status_message)
if (currentConversation?.type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
var statusMessage = ""
if (currentConversation?.statusIcon != null) {
statusMessage += currentConversation?.statusIcon
}
if (currentConversation?.statusMessage != null) {
statusMessage += currentConversation?.statusMessage
}
if (statusMessage.isNotEmpty()) {
viewThemeUtils.platform.colorTextView(statusMessageView, ColorRole.ON_SURFACE)
statusMessageView.text = statusMessage
statusMessageView.visibility = View.VISIBLE
} else {
statusMessageView.visibility = View.GONE
}
statusMessageViewContents(statusMessage)
} else {
var descriptionMessage = ""
if (currentConversation?.type == ConversationType.ROOM_GROUP_CALL ||
currentConversation?.type == ConversationType.ROOM_PUBLIC_CALL
) {
var descriptionMessage = ""
descriptionMessage += currentConversation?.description
if (descriptionMessage.isNotEmpty()) {
viewThemeUtils.platform.colorTextView(statusMessageView, ColorRole.ON_SURFACE)
statusMessageView.text = descriptionMessage
statusMessageView.visibility = View.VISIBLE
} else {
statusMessageView.visibility = View.GONE
}
statusMessageViewContents(descriptionMessage)
}
}
}
private fun statusMessageViewContents(statusMessageContent: String) {
val statusMessageView = binding.chatToolbar.findViewById<TextView>(R.id.chat_toolbar_status_message)
if (statusMessageContent.isNotEmpty()) {
viewThemeUtils.platform.colorTextView(statusMessageView, ColorRole.ON_SURFACE)
statusMessageView.text = statusMessageContent
statusMessageView.visibility = View.VISIBLE
} else {
statusMessageView.visibility = View.GONE
}
}
public override fun onDestroy() {
super.onDestroy()
logConversationInfos("onDestroy")

View file

@ -40,13 +40,13 @@
android:lines="1"
android:textAlignment="viewStart"
android:textColor="@color/low_emphasis_text"
android:textSize="14sp"
android:textSize="13sp"
tools:text="Jane Doe" />
<ImageView
android:id="@+id/avatar_view"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/standard_margin"
android:contentDescription="@string/avatar" />