Skip to main content
Version: v4

Receipt

The CometChatReceipt component renders the receipts such as sending, sent, delivered, read and error state indicator of a message.

Image

How to integrate CometChatReceipt ?

Since CometChatReceipt is a custom view, it can be added directly in the layout file or you can use it in Java. CometChatReceipt includes various attributes and methods to customize its UI.

Usage in XML

<com.cometchat.chatuikit.shared.views.CometChatReceipt.CometChatReceipt
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/receipt"
/>

XML Attributes

To style or customize the CometChatMessageReceipt, you can use the available parameters or methods.

AttributesDescription
app:messageProgressIconIt is use to pass user defined image in to the MessageReceipt, to change the icon While sending the message.
app:messageSentIconIt is use to pass user defined image in to the MessageReceipt, to change the icon When Message is sent.
app:messageDeliveredIconIt is use to pass user defined image in to the MessageReceipt, to change the icon When Message is delivered.
app:messageReadIconIt is use to pass user defined image in to the MessageReceipt, to change the icon When Message is read.
app:messageErrorIconIt is use to pass user defined image in to the MessageReceipt, to change the icon While error occurs.
<com.cometchatworkspace.components.shared.secondaryComponents.CometChatMessageReceipt
android:id="@+id/receipt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:messageProgressIcon="@drawable/ic_message_progress"
app:messageSentIcon="@drawable/ic_message_sent"
app:messageDeliveredIcon="@drawable/ic_message_delivered"
app:messageReadIcon="@drawable/ic_message_read"
app:messageErrorIcon="@drawable/ic_message_error"
/>

Methods

MethodsTypeDescription
setReceiptReceiptThis method is used to set receipt
setWaitIconDrawableIt is use to pass user defined image in to the MessageReceipt, to change the icon While sending the message.
setSentIconDrawableIt is use to pass user defined image in to the MessageReceipt, to change the icon When Message is sent.
setDeliveredIconDrawableIt is use to pass user defined image in to the MessageReceipt, to change the icon When Message is delivered.
setReadIconDrawableIt is use to pass user defined image in to the MessageReceipt, to change the icon When Message is read.
setErrorIconDrawableIt is use to pass user defined image in to the MessageReceipt, to change the icon While error occurs.
CometChatReceipt receipt = findViewById(R.id.receipt);
//syntax for setReceipt(Receipt)
receipt.setReceipt(Receipt.SENT);
//syntax for setDeliveredIcon
receipt.setDeliveredIcon(getResources().getDrawable(R.drawable.ic_message_delivered));
//syntax for setReadIcon
receipt.setReadIcon(getResources().getDrawable(R.drawable.ic_message_read));
//syntax for setSentIcon
receipt.setSentIcon(getResources().getDrawable(R.drawable.ic_message_sent));
//syntax for setWaitIcon
receipt.setWaitIcon(getResources().getDrawable(R.drawable.cc_progress_drawable));
//syntax for setErrorIcon
receipt.setErrorIcon(getResources().getDrawable(R.drawable.cc_error));