Search code examples
androidscrollandroid-recyclerviewgridlayoutmanagersuperslim

Detect RecyclerView's GridLayoutManager End Of Scroll with SuperSLiM library


I have been searching for a while but can't find a solution to detect end of scroll of recycler view with grid layout manager. Using code below actually work, but it is for linear layout manager not for grid layout manager.

            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int scrollState) {
                final int treeshold = 0;
                try {
                    if (scrollState == RecyclerView.SCROLL_STATE_IDLE) {
                        if (((LinearLayoutManager) recyclerView.getLayoutManager()).findLastVisibleItemPosition() >= yourData.size()
                                - 1 - treeshold) {
                            //your load more logic
                        }
                    }
                } catch (Exception e) {
                }
            }

The idea is that i want to implement load more function to my application, so i need to detect end of scroll.

Edit : maybe the problem not the grid view itself. I used com.tonicartos.superslim library to get sticky header view. I wonder that it might be the problem


Solution

  • I just sent an email directly to Mr. Artos about this problem and got a reply: "It likely won't work properly until the next version is finished. I wrote about it on my blog at http://www.tonicartos.com/2015/12/superslim-milestone-1_23.html?m=1"