简体   繁体   English

Applozic:如何向用户显示第一条未读消息而不是最新的未读消息?

[英]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.这是一个使用 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您可以在 onChildAdded 中使用它,方法是将 unSeenMessageCount 作为 int

if (unSeenMessageCount == 0) {

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

} else {

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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