Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
- super.onScrollStateChanged(recyclerView, newState);
- if (newState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
- isScrolling = true;
- }
- }
- @Override
- public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
- super.onScrolled(recyclerView, dx, dy);
- int currentItems = mLayoutManager.getChildCount();
- int totalItems = mLayoutManager.getItemCount();
- int scrollOutItems = mLayoutManager.findFirstVisibleItemPosition();
- if (isScrolling) {
- if ((currentItems + scrollOutItems) == totalItems
- && scrollOutItems >= 0) {
- isScrolling = false;
- mPage++;
- mScrollCallback.onScrollEnd(mPage);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement