Malinskiy / SuperRecyclerView

Pumped up RecyclerView
2.63k stars 469 forks source link

Bug in OnMoreListener #119

Open ravi7874 opened 7 years ago

ravi7874 commented 7 years ago

When i scroll to second last item and hold to that item OnMoreListener continuously run and executes code. Check video in below attachment.

WhatsApp Video 2017-05-26 at 3.35.29 PM.zip

kimnamcham commented 6 years ago

I have the same issue, did you find any solution ? thank you

ravi7874 commented 6 years ago
       `recyclerView = (SuperRecyclerView) view.findViewById(R.id.recyclerView);`
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
        recyclerView.setLayoutManager(layoutManager);

        recyclerView.setRefreshListener(this);
        recyclerView.setupMoreListener(this, 1);
        recyclerView.setRefreshingColorResources(android.R.color.holo_orange_light, android.R.color.holo_blue_light, android.R.color.holo_green_light, android.R.color.holo_red_light);

While Adding more items in adapter Use below code :

if (response.body() != null) {
                    if (response.body().size() > 0) {
                        offset += response.body().size();
                        adapter.add(response.body());
                    } else {
                        recyclerView.removeMoreListener();
                        recyclerView.hideMoreProgress();
                    }
                }
kimnamcham commented 6 years ago

Thanks!! You saved my life :D