public final class MessageCollection
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MessageCollection.Builder
A builder to create the
MessageCollection. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes current
MessageCollection and stops all events from being received. |
GroupChannel |
getChannel()
Returns the
GroupChannel tracked by MessageCollection |
java.util.Comparator<BaseMessage> |
getComparator()
Returns a new
for sorting succeeded BaseMessage
using the BaseMessageListParams.shouldReverse() set in this collection. |
java.util.List<BaseMessage> |
getFailedMessages()
Return read-only failed message lists.
|
java.util.List<BaseMessage> |
getPendingMessages()
Return read-only pending message lists.
|
long |
getStartingPoint()
Returns the starting point of the collection.
|
java.util.List<BaseMessage> |
getSucceededMessages()
Returns list of succeeded message list in this collection.
|
boolean |
hasNext()
Returns whether there's more data to load in next (latest) direction.
|
boolean |
hasPrevious()
Returns whether there's more data to load in previous (oldest) direction.
|
void |
initialize(MessageCollectionInitPolicy initPolicy,
MessageCollectionInitHandler handler)
Initializes this collection from
startingPoint. |
void |
loadNext(BaseChannel.GetMessagesHandler handler)
Loads next (latest direction) message lists.
|
void |
loadPrevious(BaseChannel.GetMessagesHandler handler)
Loads previous (oldest direction) message lists.
|
void |
removeAllFailedMessages(RemoveAllFailedMessagesHandler handler)
Remove all failed messages of this MessageCollection
|
void |
removeFailedMessages(java.util.List<BaseMessage> failedMessages,
RemoveFailedMessagesHandler handler)
Remove specific failed messages of this MessageCollection
|
void |
setMessageCollectionHandler(MessageCollectionHandler handler)
Sets the message collection handler to be used for this
MessageCollection. |
public void setMessageCollectionHandler(MessageCollectionHandler handler)
MessageCollection.handler - MessageCollectionHandler.public java.util.Comparator<BaseMessage> getComparator()
for sorting succeeded BaseMessage
using the BaseMessageListParams.shouldReverse() set in this collection.
Noted that it's working correctly only for succeeded messagesBaseMessageListParams.setReverse(boolean)public void dispose()
MessageCollection and stops all events from being received.public java.util.List<BaseMessage> getSucceededMessages()
public long getStartingPoint()
public boolean hasNext()
public boolean hasPrevious()
public void initialize(MessageCollectionInitPolicy initPolicy, MessageCollectionInitHandler handler)
startingPoint.initPolicy - MessageCollectionInitPolicy used in how to deal with cache results and api results.handler - MessageCollectionInitHandler used in providing the cache results and api results.public java.util.List<BaseMessage> getPendingMessages()
public java.util.List<BaseMessage> getFailedMessages()
public void loadNext(BaseChannel.GetMessagesHandler handler)
handler - BaseMessage.GetMessageHandler to receive the message list.public void loadPrevious(BaseChannel.GetMessagesHandler handler)
handler - BaseMessage.GetMessageHandler to receive the message list.public void removeFailedMessages(java.util.List<BaseMessage> failedMessages, RemoveFailedMessagesHandler handler)
failedMessages - failed messages that want to removehandler - RemoveFailedMessagesHandler used in providing the removal resultspublic void removeAllFailedMessages(RemoveAllFailedMessagesHandler handler)
handler - RemoveAllFailedMessagesHandler used in providing the removal resultspublic GroupChannel getChannel()
GroupChannel tracked by MessageCollectionGroupChannel tracked by MessageCollection Copyright © 2021, Sendbird or its affiliates. All rights reserved.
Report a bug or request a feature
For further developer documentation, see Chat SDK Documentation. That documentation contains more detailed descriptions, conceptual overviews, definitions of terms, and code examples.