-
Notifications
You must be signed in to change notification settings - Fork 29
Pagination
Roman Tcaregorodtcev edited this page Oct 30, 2019
·
1 revision
To add pagination into project you just need to setPaginationCallback to OmegaRecyclerView (Example).
mRecyclerView.setPaginationCallback(new OnPageRequestListener() {
@Override
public void onPageRequest(int page) {
// You can load data inside this callback
}
@Override
public int getPagePreventionForEnd() {
return PREVENTION_VALUE; // PREVENTION_VALUE - how many positions until the end you want to be informed
}
});
You have two ways to add your custom pagination layout and error layout.
First way:
<com.omega_r.libs.omegarecyclerview.OmegaRecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:paginationLayout="@layout/item_progress"
app:paginationErrorLayout="@layout/item_error_loading"/>
Second way:
You can implement PaginationView in your Adapter class.
public class RecyclerAdapter extends OmegaRecyclerView.Adapter<RecyclerView.ViewHolder> implements PaginationViewCreator {
....
@Nullable
@Override
public View createPaginationView(ViewGroup parent, LayoutInflater inflater) {
return inflater.inflate(R.layout.item_progress, parent, false);
}
@Nullable
@Override
public View createPaginationErrorView(ViewGroup parent, LayoutInflater inflater) {
View view = inflater.inflate(R.layout.item_error_loading, parent, false);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// on error clicked....
}
});
return view;
}
mRecyclerView.showProgressPagination(); // show progress
mRecyclerView.hidePagination(); // hide pagination
mRecyclerView.showErrorPagination(); // show error
-
- ViewPager Transformers
- AccordionTransformer
- BackgroundToForegroundTransformer
- CubeInTransformer
- CubeOutTransformer
- DepthPageTransformer
- FadeTransformer
- FlipTransformer
- ForegroundToBackground
- RotateDownTransformer
- RotateUpTransformer
- StackTransformer
- TabletTransformer
- ZoomInTransformer
- ZoomOutSlideTransformer