简体   繁体   中英

Applozic : How to show the user first unread message rather than latest unread message?

This is a question wrt a chat app developed using applozic sdk. Currently in the chat detail page, the latest conversation is loaded. But I want to show the unread message that arrived first rather than the latest message arrived. How can it be achieved ?

What you can do is, when you are opening the chat details, you must be having something called, unread count which would indicate the number of messages that haven't been read yet, correct. So you can use this value to scroll your list to that particular message rather than scrolling to bottom.

You can use this in onChildAdded, by getting the unSeenMessageCount as an int

if (unSeenMessageCount == 0) {

    rvChat.scrollToPosition(chatsAdapter.getItemCount() - 1);

} else {

    rvChat.scrollToPosition(chatsAdapter.getItemCount() - unSeenMessageCount);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM