Adapter - Type of the adapter to which will be this data change listener attached.public interface OnDataChangeListener<Adapter,Data>
This listener may be useful for example when there need to be saved and restored current scroll
position of a collection view for which a specific adapter provides its data set. Then in such
scenario we can save the current scroll position in onDataChange(Object, Object) and
restore it in onDataChanged(Object, Object).
Both these callbacks should be guarantied to be called by the associated adapter if this listener is attached to it.
| Modifier and Type | Method and Description |
|---|---|
void |
onDataChange(Adapter adapter,
Data data)
Invoked whenever the specified data are about to be changed in the given adapter.
|
void |
onDataChanged(Adapter adapter,
Data data)
Invoked after
onDataChange(Object, Object) callback has been fired and data change
has been finished. |
void onDataChange(@NonNull Adapter adapter, @Nullable Data data)
During duration of this call, the adapter still references the previous data.
adapter - The adapter of which data are about to be changed.data - The data to be changed. May be null.void onDataChanged(@NonNull Adapter adapter, @Nullable Data data)
onDataChange(Object, Object) callback has been fired and data change
has been finished.
When this callback is fired, the adapter already references the changed data.
adapter - The adapter where the data has been changed.data - The changed data. May be null.