Skip to content

Commit

Permalink
MessageListAdapter: added notifyDataSetChanged to method "clear"
Browse files Browse the repository at this point in the history
  • Loading branch information
bevzaanton committed Jul 11, 2018
1 parent b814b66 commit 208e3e8
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public void onLoadMore(int page, int total) {
}

/*
* PUBLIC METHODS
* */
* PUBLIC METHODS
* */

/**
* Adds message to bottom of list and scroll if needed.
Expand Down Expand Up @@ -158,7 +158,7 @@ public void addToStart(MESSAGE message, boolean scroll) {
*/
public void addToEnd(List<MESSAGE> messages, boolean reverse) {
if (messages.isEmpty()) return;

if (reverse) Collections.reverse(messages);

if (!items.isEmpty()) {
Expand Down Expand Up @@ -205,7 +205,7 @@ public boolean update(String oldId, MESSAGE newMessage) {
/**
* Updates message by its id if it exists, add to start if not
*
* @param message message object to insert or update.
* @param message message object to insert or update.
*/
public void upsert(MESSAGE message) {
if (!update(message)) {
Expand Down Expand Up @@ -277,7 +277,10 @@ public boolean isEmpty() {
* Clears the messages list.
*/
public void clear() {
items.clear();
if (items != null) {
items.clear();
notifyDataSetChanged();
}
}

/**
Expand Down Expand Up @@ -434,8 +437,8 @@ public void setDateHeadersFormatter(DateFormatter.Formatter dateHeadersFormatter
}

/*
* PRIVATE METHODS
* */
* PRIVATE METHODS
* */
private void recountDateHeaders() {
List<Integer> indicesToDelete = new ArrayList<>();

Expand Down Expand Up @@ -616,8 +619,8 @@ void setStyle(MessagesListStyle style) {
}

/*
* WRAPPER
* */
* WRAPPER
* */
private class Wrapper<DATA> {
protected DATA item;
protected boolean isSelected;
Expand All @@ -628,8 +631,8 @@ private class Wrapper<DATA> {
}

/*
* LISTENERS
* */
* LISTENERS
* */

/**
* Interface definition for a callback to be invoked when next part of messages need to be loaded.
Expand Down

0 comments on commit 208e3e8

Please sign in to comment.