-
Notifications
You must be signed in to change notification settings - Fork 554
5.x | Update Data Set
To update the entire data set the method updateDataSet has two modality:
1. Instant refresh, but no synchronization animations(1). It Skips all notifyItemXXX()
calls and just before calling notifyDataSetChanged()
, the adapter list is integrated with expandables expanded and headers to be shown.
updateDataSet(new_items(2));
updateDataSet(new_items(2), false);
2. Asynchronous refresh, to animate the changes between the current list and the new one.
It synchronizes all new and existent items with notifyItemXXX()
calls. An AsyncTask
and LinkedHashSet
are used to optimize the scan on Big List without blocking the main thread managing the user interface.
Notifications, expandables expanded and headers to be shown, are elaborated in the main thread after AsyncTask completes the background process.
updateDataSet(new_items(2), true);
Note:
(1) = Having stable ids, when calling notifyDataSetChanged() will still run animation. Stable ids are more useful in big list and where pictures (loaded from network) are involved. However, in this library single notifications are the normality called elsewhere. More on stable ids? Check issue comment #230 or google it.
(2) = Nullable. Remember to pass a copy of the list.
In both modality, onPostUpdate()
is invoked just before OnUpdateListener
method that is invoked as last operation.
onPostUpdate()
must be overridden by extending the FlexibleAdapter
class.
/**
* This method is called after the execution of Async Update and before the call
* to the OnUpdateListener#onUpdateEmptyView(int).
*/
protected void onPostUpdate() {
// Dedicated for user implementation
}
- Update Data Set
- Selection modes
- Headers and Sections
- Scrollable Headers and Footers
- Expandable items
- Drag&Drop and Swipe
- EndlessScroll / On Load More
- Search Filter
- FastScroller
- Adapter Animations
- Third party Layout Managers
- Payload
- Smooth Layout Managers
- Flexible Item Decoration
- Utils
- ActionModeHelper
- AnimatorHelper
- EmptyViewHelper
- UndoHelper
* = Under revision!