@MainThread public class DatasourceObservable extends Observable<DatasourceObserver>
DatasourceObservable provides methods for registering, unregistering
and dispatching data changes in the datasources to the registered DatasourceObservers.mObservers| Constructor and Description |
|---|
DatasourceObservable() |
| Modifier and Type | Method and Description |
|---|---|
void |
notifyChanged()
Notifies the registered observers that the data in the datasource have been changed.
|
void |
notifyItemMoved(int fromPosition,
int toPosition)
Notifies the registered observers that the data have been moved to the another position
in the datasource.
|
void |
notifyItemRangeChanged(int positionStart,
int itemCount,
Object payload)
Notifies the registered observers that the data in the datasource have been changed.
|
void |
notifyItemRangeInserted(int positionStart,
int itemCount)
Notifies the registered observers that the new data have been inserted to the datasource.
|
void |
notifyItemRangeRemoved(int positionStart,
int itemCount)
Notifies the registered observers that the data have been removed from the datasource.
|
hasObservers, registerObserver, unregisterAll, unregisterObserverpublic void notifyChanged()
public void notifyItemRangeChanged(int positionStart,
int itemCount,
@Nullable
Object payload)
positionStart - Position of the first data item that has changed.itemCount - Number of the data items that have changed.payload - Optional parameter, use null to identify a "full" update.public void notifyItemRangeInserted(int positionStart,
int itemCount)
positionStart - Position of the first data item that was inserted.itemCount - Number of the data items inserted.public void notifyItemRangeRemoved(int positionStart,
int itemCount)
positionStart - Position of the first data item that was removed.itemCount - Number of the data items removed.public void notifyItemMoved(int fromPosition,
int toPosition)
fromPosition - Previous position of the data item.toPosition - New position of the data item.