Skip to content

Commit f1bd64d

Browse files
author
Valentin Hinov
committed
Small changes to the detectMoves functionality to maintain API consistency with 2.4.0
1 parent eece713 commit f1bd64d

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

library/src/main/java/com/xwray/groupie/GroupAdapter.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public int getSpanCount() {
8787
* updates will no longer work and you must use this method to update exclusively.
8888
* <br/> <br/>
8989
* If you want to receive a callback once the update is complete call the
90-
* {@link #updateAsync(List, OnAsyncUpdateListener)} version
90+
* {@link #updateAsync(List, boolean, OnAsyncUpdateListener)} version
9191
*
9292
* This will default detectMoves to true.
9393
*
@@ -98,6 +98,25 @@ public void updateAsync(@NonNull final List<? extends Group> newGroups) {
9898
this.updateAsync(newGroups, true, null);
9999
}
100100

101+
/**
102+
* Updates the adapter with a new list that will be diffed on a background thread
103+
* and displayed once diff results are calculated.
104+
*
105+
* NOTE: This update method is NOT compatible with partial updates (change notifications
106+
* driven by individual groups and items). If you update using this method, all partial
107+
* updates will no longer work and you must use this method to update exclusively.
108+
* <br/> <br/>
109+
*
110+
* This will default detectMoves to true.
111+
*
112+
* @see #updateAsync(List, boolean, OnAsyncUpdateListener)
113+
* @param newGroups List of {@link Group}
114+
*/
115+
@SuppressWarnings("unused")
116+
public void updateAsync(@NonNull final List<? extends Group> newGroups, @Nullable final OnAsyncUpdateListener onAsyncUpdateListener) {
117+
this.updateAsync(newGroups, true, onAsyncUpdateListener);
118+
}
119+
101120
/**
102121
* Updates the adapter with a new list that will be diffed on a background thread
103122
* and displayed once diff results are calculated.
@@ -138,7 +157,7 @@ public void update(@NonNull final Collection<? extends Group> newGroups) {
138157
* Updates the adapter with a new list that will be diffed on the <em>main</em> thread
139158
* and displayed once diff results are calculated. Not recommended for huge lists.
140159
* @param newGroups List of {@link Group}
141-
* @param detectMoves is passed to {@link DiffUtil#calculateDiff(DiffUtil.Callback, boolean)}. Set to true
160+
* @param detectMoves is passed to {@link DiffUtil#calculateDiff(DiffUtil.Callback, boolean)}. Set to false
142161
* if you don't want DiffUtil to detect moved items.
143162
*/
144163
@SuppressWarnings("unused")

library/src/main/java/com/xwray/groupie/Section.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public void clear() {
139139
*
140140
* This will default detectMoves to true.
141141
*
142+
* @see #update(Collection, boolean)
142143
* @param newBodyGroups The new content of the section
143144
*/
144145
public void update(@NonNull final Collection<? extends Group> newBodyGroups) {

0 commit comments

Comments
 (0)