use of com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration in project android-java-chat-push-notification-app by cometchat-pro.
the class CometChatMessageList method initMessageAdapter.
/**
* This method is used to initialize the message adapter if it is empty else it helps
* to update the messagelist in adapter.
*
* @param messageList is a list of messages which will be added.
*/
private void initMessageAdapter(List<BaseMessage> messageList) {
if (messageAdapter == null) {
messageAdapter = new MessageAdapter(getActivity(), messageList, CometChatMessageList.class.getName());
rvChatListView.setAdapter(messageAdapter);
stickyHeaderDecoration = new StickyHeaderDecoration(messageAdapter);
rvChatListView.addItemDecoration(stickyHeaderDecoration, 0);
scrollToBottom();
messageAdapter.notifyDataSetChanged();
} else {
messageAdapter.updateList(messageList);
}
if (!isBlockedByMe && rvSmartReply.getAdapter().getItemCount() == 0) {
BaseMessage lastMessage = messageAdapter.getLastMessage();
checkSmartReply(lastMessage);
}
}
use of com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration in project android-java-chat-push-notification-app by cometchat-pro.
the class CometChatAddMembers method setAdapter.
private void setAdapter(List<User> users) {
if (userListAdapter == null) {
userListAdapter = new CometChatUsersAdapter(getContext(), Utils.userSort(users));
StickyHeaderDecoration stickyHeaderDecoration = new StickyHeaderDecoration(userListAdapter);
rvUserList.addItemDecoration(stickyHeaderDecoration, 0);
rvUserList.setAdapter(userListAdapter);
} else {
userListAdapter.updateList(Utils.userSort(users));
}
}
use of com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration in project android-java-chat-push-notification-app by cometchat-pro.
the class UserListViewModel method setUserListAdapter.
private void setUserListAdapter(CometChatUsers cometChatUserList, boolean showHeader) {
userListAdapter = new CometChatUsersAdapter(context);
if (showHeader) {
StickyHeaderDecoration stickyHeaderDecoration = new StickyHeaderDecoration(userListAdapter);
cometChatUserList.addItemDecoration(stickyHeaderDecoration, 0);
}
cometChatUserList.setAdapter(userListAdapter);
}
Aggregations