-
Notifications
You must be signed in to change notification settings - Fork 554
5.x | EmptyViewHelper
Davide Steduto edited this page Dec 26, 2017
·
8 revisions
- Introduction
-
Callbacks
- onUpdateEmptyDataView
- onUpdateEmptyFilterView
❗️ Note: Available in next release
This Helper class is very simple: User provides pre-configured empty views for data and filter result, the helper will show and hides the views in accordance with the Adapter callbacks. Usage (with fragments):
// Empty views handling, should add after FastScroller to better handle it.
mAdapter.addListener(new EmptyViewHelper(mAdapter,
getView().findViewById(R.id.empty_view),
getView().findViewById(R.id.filter_view),
(EmptyViewHelper.OnEmptyViewListener) getActivity()) // Optional see below!!
);
Two new callbacks are provided for optional customization, for instance: user wants to display something else.
/**
* IMPLEMENT OnEmptyViewListener interface ONLY IN CASE OF MORE CUSTOMIZATION.
*/
public class MainActivity extends AppCompatActivity
implements EmptyViewHelper.OnEmptyViewListener {
@Override
public void onUpdateEmptyDataView(int size) {
String message = "Refreshed " + size + " items in " + mAdapter.getTime() + "ms";
Snackbar.make(findViewById(R.id.main_view), message, Snackbar.LENGTH_SHORT)
.show();
}
@Override
public void onUpdateEmptyFilterView(int size) {
String message = "Filtered " + size + " items in " + mAdapter.getTime() + "ms";
Snackbar.make(findViewById(R.id.main_view), message, Snackbar.LENGTH_SHORT)
.show();
}
}
- 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!