Display card deck with parameters

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-10-10 15:25:56 +02:00
parent 56b0b80316
commit c80050d8f5
No known key found for this signature in database
GPG key ID: F7AA2A8B65B50220
6 changed files with 77 additions and 83 deletions

View file

@ -83,6 +83,7 @@ class IncomingDeckCardViewHolder(incomingView: View, payload: Any) : MessageHold
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
setAvatarAndAuthorOnMessageItem(message)
showDeckCard(message)
colorizeMessageBubble(message)
@ -91,8 +92,6 @@ class IncomingDeckCardViewHolder(incomingView: View, payload: Any) : MessageHold
// parent message handling
setParentMessageDataOnMessageItem(message)
showDeckCard(message)
binding.cardView.setOnLongClickListener { l: View? ->
commonMessageInterface.onOpenMessageActionsDialog(message)
true
@ -136,6 +135,8 @@ class IncomingDeckCardViewHolder(incomingView: View, payload: Any) : MessageHold
stackName,
boardName
)
binding.cardName.visibility = View.VISIBLE
binding.cardDescription.visibility = View.VISIBLE
binding.cardName.text = cardName
binding.cardDescription.text = cardDescription
}

View file

@ -87,6 +87,8 @@ class OutgoingDeckCardViewHolder(
itemView.isSelected = false
showDeckCard(message)
// parent message handling
setParentMessageDataOnMessageItem(message)
@ -111,8 +113,6 @@ class OutgoingDeckCardViewHolder(
binding.checkMark.contentDescription = readStatusContentDescriptionString
showDeckCard(message)
binding.cardView.setOnClickListener {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(cardLink))
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
@ -142,16 +142,16 @@ class OutgoingDeckCardViewHolder(
}
}
}
val cardDescription = String.format(
context.resources.getString(R.string.deck_card_description),
stackName,
boardName
)
if (cardName?.isNotEmpty() == true) {
val cardDescription = String.format(
context.resources.getString(R.string.deck_card_description),
stackName,
boardName
)
binding.cardName.text = cardName
binding.cardDescription.text = cardDescription
}
binding.cardName.visibility = View.VISIBLE
binding.cardDescription.visibility = View.VISIBLE
binding.cardName.text = cardName
binding.cardDescription.text = cardDescription
}
private fun longClickOnReaction(chatMessage: ChatMessage) {

View file

@ -83,6 +83,7 @@ import com.nextcloud.talk.activities.TakePhotoActivity
import com.nextcloud.talk.adapters.messages.CallStartedMessageInterface
import com.nextcloud.talk.adapters.messages.CallStartedViewHolder
import com.nextcloud.talk.adapters.messages.CommonMessageInterface
import com.nextcloud.talk.adapters.messages.IncomingDeckCardViewHolder
import com.nextcloud.talk.adapters.messages.IncomingLinkPreviewMessageViewHolder
import com.nextcloud.talk.adapters.messages.IncomingLocationMessageViewHolder
import com.nextcloud.talk.adapters.messages.IncomingPollMessageViewHolder
@ -96,6 +97,7 @@ import com.nextcloud.talk.adapters.messages.OutcomingPollMessageViewHolder
import com.nextcloud.talk.adapters.messages.OutcomingPreviewMessageViewHolder
import com.nextcloud.talk.adapters.messages.OutcomingTextMessageViewHolder
import com.nextcloud.talk.adapters.messages.OutcomingVoiceMessageViewHolder
import com.nextcloud.talk.adapters.messages.OutgoingDeckCardViewHolder
import com.nextcloud.talk.adapters.messages.PreviewMessageInterface
import com.nextcloud.talk.adapters.messages.PreviewMessageViewHolder
import com.nextcloud.talk.adapters.messages.SystemMessageInterface
@ -1291,6 +1293,18 @@ class ChatActivity :
R.layout.item_custom_outcoming_link_preview_message,
this
)
messageHolders.registerContentType(
CONTENT_TYPE_DECK_CARD,
IncomingDeckCardViewHolder::class.java,
payload,
R.layout.item_custom_incoming_deck_card_message,
OutgoingDeckCardViewHolder::class.java,
payload,
R.layout.item_custom_outcoming_deck_card_message,
this
)
return messageHolders
}

View file

@ -53,6 +53,11 @@
android:textSize="12sp"
tools:text="Jane Doe" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -71,31 +76,26 @@
android:layout_marginStart="10dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1.2"
android:maxLines="2"
android:textAlignment="viewStart"
android:textIsSelectable="false"
android:layout_marginBottom="12dp"
android:textStyle="bold"
android:visibility="gone"
tools:text="Name of Website"
app:layout_flexGrow="1"
tools:text="Card Name"
tools:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/cardDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lineSpacingMultiplier="1.2"
android:maxLines="2"
android:textAlignment="viewStart"
android:textIsSelectable="false"
android:visibility="gone"
tools:text="Description of Website"
app:layout_flexGrow="1"
tools:text="Card Description"
tools:visibility="visible" />
<TextView
@ -107,7 +107,6 @@
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
tools:text="12:38" />
</LinearLayout>
<include

View file

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?><!--
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Nextcloud Talk - Android Client
~
~ SPDX-FileCopyrightText: 2024 Sowjanya Kota<sowjanya.kch@gmail.com>
~ SPDX-FileCopyrightText: 2024 Sowjanya Kota <sowjanya.kch@gmail.com>
~ SPDX-License-Identifier: GPL-3.0-or-later
-->
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cardView"
android:id ="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
@ -16,93 +17,72 @@
android:layout_marginRight="16dp"
android:layout_marginBottom="2dp">
<ImageView
android:id="@id/messageUserAvatar"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentTop="true"
android:layout_marginEnd="8dp"
android:contentDescription="@string/avatar" />
<com.google.android.flexbox.FlexboxLayout
android:id="@id/bubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/message_incoming_bubble_margin_right"
android:layout_toEndOf="@id/messageUserAvatar"
android:orientation="vertical"
android:layout_alignParentEnd="true"
android:layout_marginStart="@dimen/message_outcoming_bubble_margin_left"
app:alignContent="stretch"
app:alignItems="stretch"
app:flexWrap="wrap">
app:flexWrap="wrap"
app:justifyContent="flex_end">
<include
android:id="@+id/message_quote"
layout="@layout/item_message_quote"
android:visibility="gone" />
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/messageAuthor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:alpha="0.6"
android:textAlignment="viewStart"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
android:textSize="12sp"
tools:text="Jane Doe" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/deckCardImage"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/baseline_assignment_24" />
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/cardName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1.2"
android:maxLines="2"
android:textAlignment="viewStart"
android:textIsSelectable="false"
android:textStyle="bold"
android:visibility="gone"
tools:text="Name of Website"
tools:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/deckCardImage"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/baseline_assignment_24" />
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/cardName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1.2"
app:layout_flexGrow="1"
android:textIsSelectable="false"
android:textStyle="bold"
android:visibility="gone"
tools:text="Card Name"
tools:visibility="visible" />
</LinearLayout>
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/cardDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lineSpacingMultiplier="1.2"
android:maxLines="2"
app:layout_flexGrow="1"
android:textAlignment="viewStart"
android:textIsSelectable="false"
android:visibility="gone"
tools:text="Description of Website"
tools:text="Card Description"
tools:visibility="visible" />
<TextView
android:id="@id/messageTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.6"
android:layout_gravity="end"
android:alpha="0.6"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
tools:text="12:38" />

View file

@ -515,7 +515,7 @@ How to translate with transifex:
<string name="typing_are_typing">are typing …</string>
<string name="typing_1_other">and 1 other is typing …</string>
<string name="typing_x_others">and %1$s others are typing …</string>
<string name="deck_card_description">%1$s in 2$s</string>
<string name="deck_card_description">%1$s in %2$s</string>
<!-- Upload -->
<string name="nc_add_file">Add to conversation</string>
<string name="nc_upload_picture_from_cam">Take photo</string>