Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rvBillsAndDates.addOnScrollListener(new RecyclerView.OnScrollListener() {
- @Override
- public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
- super.onScrolled(recyclerView, dx, dy);
- // Log.e("AllBillsFragment=>","onScroll called");
- if (dy > 0) {
- visibleItemCount = llm.getChildCount();
- totalItemCount = llm.getItemCount();
- pastVisibleCount = llm.findFirstVisibleItemPosition();
- if (isLoading) {
- if (totalItemCount > previousTotal) {
- isLoading = false;
- previousTotal = totalItemCount;
- }
- }
- if (!isLoading && (totalItemCount - visibleItemCount) <= (pastVisibleCount + view_threshold)) {
- if (mCategoryID == "all") {
- mCategoryID = null;
- }
- if (nextPageNumber <= totalPages){
- nextPageNumber++;
- if (mCategoryID == null) {
- pagination(null);
- isLoading = true;
- } else {
- pagination(mCategoryID);
- isLoading = true;
- }
- } else {
- Toast.makeText(getContext(),"No More Data Found.",Toast.LENGTH_SHORT).show();
- }
- }
- }else {
- Logger.i(" onScroll:=> onScroll not working ");
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement