Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increasing TOTAL_PAGES stops scrolling #5

Open
kamleshrao opened this issue Sep 26, 2018 · 3 comments
Open

Increasing TOTAL_PAGES stops scrolling #5

kamleshrao opened this issue Sep 26, 2018 · 3 comments

Comments

@kamleshrao
Copy link

kamleshrao commented Sep 26, 2018

I tried increasing the value of TOTAL_PAGES in MainActivity to 15. When I run the App after making this change, the App does not scroll to 2nd page.

After "Movie 10", the progress bar is shown endless.

What am I missing?

Part 2 of my requirement is I don't want to fix the TOTAL_PAGES. It should be dynamic based on the amount of data I have in Database. I want to use the scrolling until I reach the last record from my Database query which is returned via API. How can I achieve this?

@saikat-bbil
Copy link

I also got the same problem.
If I tried TOTAL_PAGES to 15 then the bottom progressbar always showing & I can't go to 2nd page.
Did you find any solution?

@raiaslam
Copy link

I tried increasing the value of TOTAL_PAGES in MainActivity to 15. When I run the App after making this change, the App does not scroll to 2nd page.

After "Movie 10", the progress bar is shown endless.

What am I missing?

Part 2 of my requirement is I don't want to fix the TOTAL_PAGES. It should be dynamic based on the amount of data I have in Database. I want to use the scrolling until I reach the last record from my Database query which is returned via API. How can I achieve this?

Please get size of your array list and set to TOTAL_PAGES .

@PhongDinh12
Copy link

Class PaginationScrollListener edit as follows
@OverRide
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);

    int visibleItemCount = layoutManager.getChildCount();
    int totalItemCount = layoutManager.getItemCount();
    int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();

    if (!isLoading() && !isLastPage()) {
        if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount
                && firstVisibleItemPosition >= 0) {
            loadMoreItems();
        }
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants