MessageList
is a Composite Component that displays a list of messages and effectively manages real-time operations. It includes various types of messages such as Text Messages, Media Messages, Stickers, and more.
MessageList
is primarily a list of the base component MessageBubble. The MessageBubble Component is utilized to create different types of chat bubbles depending on the message type.
layout.xml
file.
MessageList
component to the layout will only display the loading indicator. To fetch messages for a specific entity, you need to supplement it with User
or Group
Object.onThreadRepliesClick
is triggered when you click on the threaded message bubble. The onThreadRepliesClick
action doesn’t have a predefined behavior. You can override this action using the following code snippet.
MessagesRequestBuilder
in the MessageList Component to customize your message list. Numerous options are available to alter the builder to meet your specific needs. For additional details on MessagesRequestBuilder
, please visit MessagesRequestBuilder.
In the example below, we are applying a filter to the messages based on a search substring and for a specific user. This means that only messages that contain the search term and are associated with the specified user will be displayed
Component
. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
The MessageList Component does not emit any events of its own.
Property | Description | Code |
---|---|---|
Border Width | used to set border width | .setBorderWidth(int) |
Border Color | used to set border color | .setBorderColor(@ColorInt int) |
Corner Radius | used to set corner radius | .setCornerRadius(int) |
LoadingIcon Tint | used to set loading icon tint | .setLoadingIconTint(@ColorInt int) |
EmptyText Appearance | used to set empty state text Appearance | .setLoadingIconTint(@StyleRes int) |
ErrorText Appearance | used to set error text Appearance | .setErrorTextAppearance(@StyleRes int) |
EmptyText Color | used to set empty state text color | .setEmptyTextColor(@ColorInt int) |
ErrorText Color | used to set error state text color | .setErrorTextColor(@ColorInt int) |
NameText Color | used to set sender/receiver name text color on a message bubble. | .setNameTextColor(@ColorInt int) |
NameText Appearance | used to set sender/receiver name text appearance on a message bubble | .setNameTextAppearance(@StyleRes int) |
TimeStampText Color | used to set time stamp text appearance | .setTimeStampTextAppearance(@StyleRes int) |
ThreadReplySeparator Color | used to set thread reply separator color | .setThreadReplySeparatorColor(@ColorInt int) |
ThreadReplyText Color | used to set thread reply text color | .setThreadReplyTextColor(@ColorInt int) |
ThreadReplyText Appearance | used to set thread reply text appearance | .setThreadReplyTextAppearance(@StyleRes int) |
ThreadReplyIcon Tint | used to set thread reply icon tint | .setThreadReplyIconTint(@ColorInt int) |
Background | This method will set the background color for message list | .setBackground(@ColorInt int) |
Background | This will set drawable component for list background | .setBackground(@drawable int) |
Avatar
component in the Conversations
Component, you can use the following code snippet. For more information, visit Avatar Styles.
Property | Description | Code |
---|---|---|
User | Used to pass user object of which header specific details will be shown | .setUser(user); |
Group | Used to pass group object of which header specific details will be shown | .setGroup(Group); |
Messages Alignment | used to set the alignmet of messages in CometChatMessageList. It can be either leftAligned or standard | .setAlignment(UIKitConstants.MessageListAlignment); |
EmptyState Text | used to set text which will be visible when no messages are available | .emptyStateText("Your_EMPTY_STATE_TEXT"); |
ErrorState Text | used to set text which will be visible when error in messages retrieval | .errorStateText("Your_ERROR_STATE_TEXT"); |
Hide Error | used to toggle visibility of error in MessageList | .hideError(false); |
Disable Sound For Messages | used to enable/disable sound for incoming/outgoing messages , default false | .disableSoundForMessages(false); |
CustomSound For Messages | used to set custom sound for outgoing message | .setCustomSoundForMessages(@RawRes resource); |
Set ReadIcon | used to set custom read icon visible at read receipt | .setReadIcon(@DrawableRes resource); |
Set DeliverIcon | used to set custom delivered icon visible at read receipt | .setDeliverIcon(@DrawableRes resource); |
Set SentIcon | used to set custom sent icon visible at read receipt | .setSentIcon(@DrawableRes resource); |
Set SentIcon | used to set custom sent icon visible at read receipt | .setSentIcon(@DrawableRes resource); |
Set WaitIcon | used to set custom wait icon visible at read receipt | .setWaitIconIcon(@DrawableRes resource); |
Show Avatar | used to toggle visibility for avatar | .showAvatar(false); |
Hide Timestamp | used to toggle visibility for of timestamp | .hideTimestamp(false); |
Set TimeStampAlignment | used to set receipt’s time stamp alignment .It can be either top or bottom | .setTimeStampAlignment(UIKitConstants.TimeStampAlignment); |
Set newMessageIndicatorText | used to set new message indicator text | .newMessageIndicatorText("Your_CUSTOM_TEXT"); |
Toggle scrollToBottomOnNewMessage | should scroll to bottom on new message? , by default false | .scrollToBottomOnNewMessage(true); |
Toggle scrollToBottomOnNewMessage | should scroll to bottom on new message? , by default false | .scrollToBottomOnNewMessage(true); |
Hide Receipt | Used to control visibility of read receipts without disabling the functionality of marking messages as read and delivered. | .hideReceipt(false); |
Disable Mentions | Sets whether mentions in text should be disabled. Processes the text formatters If there are text formatters available and the disableMentions flag is set to true, it removes any formatters that are instances of CometChatMentionsFormatter. | .setDisableMentions(true); |
Disable Reactions | Sets A boolean value indicating whether to disable reactions.Pass true to disable reactions, false to enable them. | .disableReactions(true); |
Add Reaction Icon | Sets The resource ID to be set for the add reaction icon.This ID refers to the drawable resource representing the icon. | .setAddReactionIcon(R.drawable.your_icon); |
Hide Add Reactions Icon | Sets A boolean value indicating whether to hide the add reactions icon. Pass true to hide the icon, false to show it. | .hideAddReactionsIcon(true); |
Set Quick Reactions | The list of quick reactions to be set.This list will replace the predefined set of reactions | .setQuickReactions(Arrays.asList("👻","😈","🙀","🤡","❤️"); |
setDateSeparatorPattern()
. This method accepts a function with a return type String. Inside the function, you can create your own pattern and return it as a String.
ErrorStateView
using setEmptyStateView
to match the error view of your app.
error_state_view_layout.xml
. You can choose any view you prefer. This view should be inflated and passed to the setErrorStateView()
method.
setEmptyStateView()
function provides the ability to set a custom empty state view in your app. An empty state view is displayed when there are no messages for a particular user.
empty_view_layout.xml
, you can set it as the empty state view by passing it as a parameter to the setEmptyStateView() function.
setLoadingStateView
function allows you to set a custom loading view in your app. This feature enables you to maintain a consistent look and feel throughout your application,
ContentLoadingProgressBar
to loading_view_layout.xml
. You can choose any view you prefer. This view should be inflated and passed to the setLoadingStateView()
method.
MessageInformationConfiguration
object.
MessageInformationConfiguration
indeed provides access to all the Action, Filters, Styles, Functionality, and Advanced properties of the MesssageInformation component.
Please note that the properties marked with the 🛑 symbol are not accessible within the Configuration Object.
Example
MessageInformationConfiguration
.