MarkoMilos / Paginate

Library for creating simple pagination functionality upon RecyclerView and AbsListView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recyclerview goes to the bottom automatically and triggers onLoadMore infinitely

noecende opened this issue · comments

I don't know whats going on. I use this library with Paging library (without BoundaryCallback), when the first page is loaded, the recyclerview scrolls to the bottom and continues loading data until it loads all the items in the server.

Have you managed to fix the problem?

From your description, I cannot reproduce this issue.

Can you describe a bit more or better yet provide a short example demonstrating this issue?

Answering the following would also help:

  • How did you set up your Paginate?
  • How many items do you have initially?
  • How many items are you adding per page?
  • What LayoutManager do you use and how is it setup?
  • Are you performing anything else custom upon RecyclerView, LayoutManager, or Adapter that might cause scrolling besides.

I am also facing same issue
this is how i am initializing
`private void renderPopularList(final PopularMoviesResponse moviesResponse) {
RecyclerView recyclerViewPopular = (RecyclerView) findViewById(R.id.rv_popular);
popularMovieAdapter = new PopularMovieAdapter(this, moviesResponse);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
recyclerViewPopular.setLayoutManager(linearLayoutManager);
recyclerViewPopular.setAdapter(popularMovieAdapter);
int spacingInPixels = getResources().getDimensionPixelSize(R.dimen.spacing);
recyclerViewPopular.addItemDecoration(new SpacesItemDecoration(spacingInPixels));

    final int threshold=moviesResponse.getTotalResults() / moviesResponse.getTotalPages();
    Paginate.Callbacks callbacks = new Paginate.Callbacks() {

        @Override
        public void onLoadMore() {
            // Load next page of data (e.g. network or database)
            loading = true;
            getNewItems(moviesResponse.getPage());
        }

        @Override
        public boolean isLoading() {
            // Indicate whether new page loading is in progress or not
            return loading;
        }

        @Override
        public boolean hasLoadedAllItems() {
            // Indicate whether all data (pages) are loaded or not
             boolean loaded=moviesResponse.getPage()==moviesResponse.getTotalPages();
             if(loaded)
                 loading=false;
             return loaded;
        }
    };

    Paginate.with(recyclerViewPopular, callbacks)
            .setLoadingTriggerThreshold(threshold)
            .addLoadingListItem(true)
            .setLoadingListItemCreator(new CustomLoadingListItemCreator())
            .setLoadingListItemSpanSizeLookup(new LoadingListItemSpanLookup() {
                @Override
                public int getSpanSize() {
                    return 1;
                }
            })
            .build();

}`

I am also facing same problem. any solution?

this issue occur due to parent scrolling view like scrollview, Nestedscrollview etc