CometChatUI
using the below code snippet Make sure to add the following code snippet after onSuccess
of CometChat login.
onSuccess
of CometChat login.layout.xml
add the following snippet to use the CometChatConversationListScreen
.Adding the following code snippet will give you a fully working list of conversations.
setItemClickListener
. The setItemClickListener
has OnItemClick()
to handle single click and OnItemLongClick()
to handle long click events.CometChatUserList
is a fragment with a List of users. The Fragment has all the necessary listeners and methods required to display the user’s list.
layout.xml
add the following snippet to use the CometChatUserList
. Adding the following code snippet will give you a fully working list of users.
setItemClickListener
. The setItemClickListener
has OnItemClick()
to handle single click and OnItemLongClick()
to handle long click events.CometChatGroupList
is a fragment with a List of groups Fragment has all the necessary listeners and methods required to display the list of groups
layout.xml
add the following snippet to use the CometChatGroupList
.Adding the following code snippet will give you a full working list of groups.
setItemClickListener
. The setItemClickListener
has OnItemClick()
to handle single click and OnItemLongClick()
to handle long click events.CometChatMessageList
is a fragment that consists of send and received messages. It is capable of sending and receiving different types of messages such as text, image, and documents.
CometChatMessageList
follow the below code snippets. CometChatMessageList
is a dynamic so it will require some arguments. Launch CometChatChatMessageListActivity using below code and pass the required parameters in intent.
layout.xml
CometChatUserProfile
is a fragment which provides detail about the currently logged-in user in the CometChat.
layout.xml
uiKit
library. You will find those components in shared
folder under ui_components
. Below are core components that are being used in uiKit
library.
layout.xml
add the following code snippet.
avatar_shape
is a static property. It should be either circle
or rectangle
. whereas the avatar URL needs to be set dynamically following is the sample code for the same.
User
and Group
object. The setAvatar()
method accepts User
or Group
object if Avatar of User
or Group
is not available it automatically show the initials of the user or group name as a placeholder Avatar.
CometChatAvatar field element | Relevant attributes/methods |
---|---|
Avatar Shape | app:avatar_shape |
Avatar | app:avatar Method - setAvatar(@NonNull User) - setAvatar(@NonNull Group) - setAvatar(@NonNull String) - setAvatar(@NonNull Drawable, @NonNull String) |
Avatar Initial | app:avatar_initials Method - setInitials(@NonNull String) |
Border Color | app:border_color |
Border Width | app:border_width |
layout.xml
add the following code
app:user_status
attribute and method setUserStatus
to set Status of the user.
The app:user_status
attribute can also be used with DataBinding in the following manner
e.g app:user_status="@{user.status}"
you can also use different objects according to their use case. The attribute will continue to work as long as receives a string parameter
CometChatUserPresence field element | Relevant attributes/methods |
---|---|
User Status | app:user_status <br /><br />**Method** - setUserStatus(@NonNull String) |
layout.xml
setCount
method. The setCount
method takes an int as a parameter.
app: count
can also be used with DataBinding
CometChatBadgeCount field element | Relevant attributes/methods |
---|---|
Count | app:count Method - setCount(int) |
Count Size | app:count_size Method - setCountSize(float) |
Count Background Color | app:count_background_color Method - setCountBackground(@ColorRes color) |
Count Color | app:count_color Method - setCountSize(float) |
CometChatUsers
is custom RecyclerView which helps to display a list of users present in your CometChat app.
CometChatUsers
using DataBinding in the following mannerlayout.xml
add the following code :
UsersRequestBuilder()
. Visit the below link for more details on how to retrieve a list of users.
Documentation
Retrive Users -Learn how to fetch various types of users.
In onSuccess
of the fetchNext
method you can set the data the ObservableArrayList
you have created. The advantage of using the ObservableArrayList
is one doesn’t have to manually set the data on binding.setUserList(userList);
every time you get a new set of data.
CometChatUser
in the following manner.layout.xml
add the following code
CometChatUsers
you can make use of setItemClickListener
class.CometChatUsers
component provides different properties to control the behavior of CometChatUsers
view.
CometChatUsers field elements | Relevant attributes/methods |
---|---|
Update List | - setUserList(List<User>) |
Update | - update (User) |
Remove | - remove(String) |
Add | - add(User) |
CometChatGroups
is a custom RecyclerView that helps you to display a list of groups.
CometChatGroups
in the following manner.layout.xml
add the following code snippet
GroupsRequestBuilder()
.Visit the below link for more details on how to retrieve a list of group.
Documentation
Retrive Groups -Learn how to fetch various types of groups.
In onSuccess
of the fetchNext
method you can set the data the ObservableArrayList
you have created. The advantage of using the ObservableArrayList
is one doesn’t have to manually set the data on binding.setGroupList(groupList);
every time you get a new set of data.
CometChatGroups
in the following manner.layout.xml
add the following code
CometChatGroups
you can make use of setItemClickListener
class.CometChatGroupList
component provides different properties to control the behavior of CometChatGroupList
view. You can perform different operations like an update, remove, add, etc.
CometChatGroups field elements | Relevant attributes/methods |
---|---|
Update List | - setGroupList(List<Group>) |
Update | - update (Group) |
Remove | - remove(String) |
Add | - add(Group) |
CometChatConversations
is a custom RecyclerView which will help you to display a list of all the users and groups in which the logged-in user has made any conversation.
CometChatConversations
in the following manner.layout.xml
add the following code.
ConversationsRequestBuilder()
.visit the below link for more details on how to retrieve a list of conversation
Documentation
Retrive Conversations -Learn how to build a recent chats list using conversations.
In onSuccess
of the fetchNext
method you can set the data the ObservableArrayList
you have created. The advantage of using the ObservableArrayList
is one doesn’t have to manually set the data on binding.setConversationList(conversationList);
every time you get a new set of data.
CometChatConversations
in the following manner.layout.xml
add the following code
onSuccess
of the fetchNext
method of ConversationsRequestBuilder
, you can set the data. You can refer how to Retrieve Conversations
CometChatConversations
you can make use of the ConversationItemClickListener
class.CometChatConversations
component provides different properties to control the behavior of the CometChatConversations
view. You can perform different operations like an update, remove, add, etc
CometChatConversations field elements | Relevant attributes/methods |
---|---|
Update List | - setConversationList(List<Conversation>) |
Update | - update (Conversation) |
Remove | - remove(Conversation) |
Add | # add(Conversation) |
CometChatCalls
is custom RecyclerView which will help you to display list of calls.
CometChatCalls
in the following manner.
In your layout.xml
add the following code :
onSuccess
of the fetchNext
method of MessagesRequestBuilder
you can set the data. You need to add setCategory(CometChatConstants.CATEGORY_CALL)
in your MessagesRequestBuilder
to fetch only call messages
You can refer an example here.
CometChatCalls
you can make use of ItemClickListener
class.CometChatCalls
.
This event is performed when clicking on the User or Group item displayed in the call list.
CometChatCallList
component provides different properties to control the behavior of the CometChatCallList
view. You can perform different operations like an update, remove.
CometChatCalls field e | Relevant attributes/methods |
---|---|
Update List | setCallList(List<Call>) |
Update | update(Call) |
Remove | remove(Call) |