ProgressDataView is a view to easily switch between loading, empty, data and error states in your Android Application.
- 4 different states (loading, empty, error and data)
- Extends from Framelayout
- Add child views as default content
- Pass different state layout files in XML
compile 'com.rootsoft.progressdataview:progressdataview:1.0.3'
@BindView(R.id.progress_airports)
public ProgressDataView progressAirport;
public void fetchVisitedAirports(boolean showLoading) {
if (showLoading)
progressAirport.showLoading();
airportManager.getVisitedAirports(new AirportManager.VisitedAirportsCallback() {
@Override
public void onVisitedAirportsReceived(List<Airport> airports) {
if (airports.size() == 0) {
progressAirport.showEmpty();
return;
}
progressAirport.showContent();
}
@Override
public void onError(String message) {
progressAirport.showError();
}
});
}
<com.rootsoft.progressdataview.ProgressDataView
android:id="@+id/progress_airports"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:loadingLayout="@layout/layout_default_loading"
app:errorLayout="@layout/layout_default_error"
app:emptyLayout="@layout/layout_default_empty">
<android.support.v7.widget.RecyclerView
android:id="@+id/list_airports"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never">
</android.support.v7.widget.RecyclerView>
</com.rootsoft.progressdataview.ProgressDataView>