Slyce-Inc/SlyceMessaging

setLoadMoreMessagesListener has issues loading less number of messages

Opened this issue · 0 comments

I am using the following code :
`slyceMessagingFragment.setLoadMoreMessagesListener(new LoadMoreMessagesListener() {
@OverRide
public List loadMoreMessages() {
Log.d("info", "loadMoreMessages()");

            if (!hasLoadedMore) {
                hasLoadedMore = true;
                ArrayList<Message> messages = new ArrayList<>();

                for (int i = 0; i < 2; i++)
                    messages.add(getRandomMessage());
                Log.d("info", "loadMoreMessages() returns");
                return messages;
            } else {
                slyceMessagingFragment.setMoreMessagesExist(false);
                Log.d("info","loadMoreMessages() false");
                return new ArrayList<>();
            }
        }
    });

    slyceMessagingFragment.setMoreMessagesExist(true);`

In this case, whenever i send a new message, the window gets cleared up of all messages.