Conversations
in your Fragment
, use the following code snippet.OnBackPressListener
is triggered when you press the back button in the app bar. It has a predefined behavior; when clicked, it navigates to the previous activity. However, you can override this action using the following code snippet.
ConversationsRequestBuilder
in the Conversations Component to filter the conversation list. You can modify the builder as per your specific requirements with multiple options available to know more refer to ConversationRequestBuilder.
You can set filters using the following parameters.
User
or Groups
Tag
Tag
Tag
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.
CometChatConversations
Component to customize the styling.
Methods | Description | Code |
---|---|---|
setBackIconVisibility | Used to toggle visibility for back button in the app bar | .setBackIconVisibility(View.VISIBLE); |
setToolbarVisibility | Used to toggle visibility for back button in the app bar | .setToolbarVisibility(View.GONE); |
setLoadingStateVisibility | Used to hide loading state while fetching Users | .setLoadingStateVisibility(View.GONE); |
setDeleteConversationOptionVisibility | Used to toggle visibility for delete option on a long press of conversation item | .setDeleteConversationOptionVisibility(View.GONE); |
setErrorStateVisibility | Used to hide error state on fetching conversations | .setErrorStateVisibility(View.GONE); |
setEmptyStateVisibility | Used to hide empty state on fetching conversations | .setEmptyStateVisibility(View.GONE); |
setSeparatorVisibility | Used to control visibility of Separators in the list view | .setSeparatorVisibility(View.GONE); |
setUsersStatusVisibility | Used to control visibility of status indicator shown if user is online | .setUsersStatusVisibility(View.GONE); |
setGroupTypeVisibility | Used to control visibility of status indicator shown for the group type | .setGroupTypeVisibility(View.GONE); |
setReceiptsVisibility | Used to hide receipts shown in the subtitle of the conversation item without disabling the functionality of marking messages as read and delivered. | .setReceiptsVisibility(View.GONE); |
disableSoundForMessages | This method disables sound notifications for incoming messages | .disableSoundForMessages(true); |
setCustomSoundForMessages | This method enables users to personalize their chat experience by setting a custom sound file for incoming message notifications. | .setCustomSoundForMessages(com.cometchat.chatuikit.R.raw.cometchat_beep2); |
setSelectionMode | This method determines the selection mode for conversations, enabling users to select either a single conversation or multiple conversations at once. | .setSelectionMode(UIKitConstants.SelectionMode.MULTIPLE); |
time(long timestamp)
→ Custom full timestamp format
today(long timestamp)
→ Called when a message is from today
yesterday(long timestamp)
→ Called for yesterday’s messages
lastWeek(long timestamp)
→ Messages from the past week
otherDays(long timestamp)
→ Older messages
minute(long timestamp)
/ hour(long timestamp)
→ Exact time unit
minutes(long diffInMinutesFromNow, long timestamp)
→ e.g., “5 minutes ago”
hours(long diffInHourFromNow, long timestamp)
→ e.g., “2 hours ago”
leading_view.xml
as a custom layout file. Which we will inflate in setLeadingView()
setLeadingView
you need to inflate the XML and initialize the views using the conversation objects.
custom_title_view.xml
as a custom layout file. Which we will inflate in setTitleView()
setTitleView
you need to inflate the XML and initialize the views using the conversation objects.
custom_tail_view.xml
as a custom layout file. Which we will inflate in setTrailingView()
setTrailingView
you need to inflate the XML and initialize the views using the conversation objects.
item_converation_list.xml
as a custom layout file. Which we will inflate in setListItemView()
setItemView
you need to inflate the XML and initialize the views using the conversation objects.
view_menu.xml
as a custom view file. Which we will inflate and pass it to .setMenu
.
setMenu
. You can get the child view reference and can handle click actions.