Search in sources :

Example 1 with StickyHeaderDecoration

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);
    }
}
Also used : BaseMessage(com.cometchat.pro.models.BaseMessage) StickyHeaderDecoration(com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration)

Example 2 with StickyHeaderDecoration

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));
    }
}
Also used : CometChatUsersAdapter(com.cometchat.pro.uikit.ui_components.shared.cometchatUsers.CometChatUsersAdapter) StickyHeaderDecoration(com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration)

Example 3 with StickyHeaderDecoration

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);
}
Also used : StickyHeaderDecoration(com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration)

Aggregations

StickyHeaderDecoration (com.cometchat.pro.uikit.ui_resources.utils.sticker_header.StickyHeaderDecoration)3 BaseMessage (com.cometchat.pro.models.BaseMessage)1 CometChatUsersAdapter (com.cometchat.pro.uikit.ui_components.shared.cometchatUsers.CometChatUsersAdapter)1