Git Product home page Git Product logo

nopaginate's Issues

OnLoadMore called two times for lesser data

Firstly thanks for the great library i was able to remove a lot of boilerplate from my code.👍

My api call is supposed to load 10 items per page but since the data coming from first call is only 4 items this results in onLoadMore being called one more time.

forget to calculate loadmore item count

when I add code in your MianActivitylike :

 @Override
    protected void onPostCreate(@Nullable Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);

        new Handler().postDelayed(() -> mainActivityPresenter.addItems(), 500);
    }

notice,it‘s a async action,now recyclerview only have one child(loadmore item), so it will cause load more twice,becase your code didn't calculcate loadmore item count(1)

Support AndroidX?

Do you have plan to support androidX? There are the problem about RecyclerView.

Support for SwipeRefreshLayout or reloading whole list

I tried to implement swiperefresh with your library via this code

if (!isRefresh) {
    showProgressBar();
} else if (noPaginate != null) {
    noPaginate.unbind();
}
noPaginate = NoPaginate.with(listNews)
    .setOnLoadMoreListener(new OnLoadMoreListener() {
        @Override
        public void onLoadMore() {
           //network code
        }
    })
    .setLoadingTriggerThreshold(5)
    .build();

but it is not working, paginate is not going into the load more method

First call for data

I noticed the load more calls without scroll, I initially had a first call to Retrofit to load data before scroll to load more.

So is there away to load initial data where I can have my loading view of choice?
Then when user scrolls, more are loaded??

NotifyDataSetChanged with payload not working

Hello,

First of all thanks for this library.

One thing noticed when I called notifyItemChanged(position, payload) it will call
onBindViewHolder(holder, position) not onBindViewHolder(holder, position, payload) .
Please handle this scenario.

Similarly other methods like onViewRecycled(), onViewAttachedToWindow(), onViewDetachedFromWindow() related methods are also not fired.

Thanks

Cannot call this method in a scroll callback

I received an exception while scrolling horizontally. I modified ErrorItem and LoadingItem for Horizontal and Vertical scrolls.

public interface LoadingItem extends BaseLinearLayoutManagerItem {

    LoadingItem VERTICAL = new LoadingItem() {

        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

            View view = LayoutInflater.from(parent.getContext()).inflate(
                    R.layout.pagination_item_loading, parent, false
            );

            return new RecyclerView.ViewHolder(view) {};
        }

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {}
    };

    LoadingItem HORIZONTAL = new LoadingItem() {

        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

            View view = LayoutInflater.from(parent.getContext()).inflate(
                    R.layout.pagination_item_loading_horizontal_scroll, parent, false
            );

            return new RecyclerView.ViewHolder(view) {};
        }

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {}
    };
}

And, then, I setOrientation() using PaginateBuilder:



    public PaginateBuilder setOrientation (PaginateOrientation orientation) {

        if (orientation == PaginateOrientation.HORIZONTAL) {
            setCustomErrorItem(ErrorItem.HORIZONTAL);
            setCustomLoadingItem(LoadingItem.HORIZONTAL);
        }
        else {
            setCustomErrorItem(ErrorItem.VERTICAL);
            setCustomLoadingItem(LoadingItem.VERTICAL);
        }

        return this;
    }

This is the exception I get:

03-24 10:06:48.274 W/RecyclerView: Cannot call this method in a scroll callback. Scroll callbacks mightbe run during a measure & layout pass where you cannot change theRecyclerView data. Any method call that might change the structureof the RecyclerView or the adapter contents should be postponed tothe next frame.
                                   java.lang.IllegalStateException:  android.support.v7.widget.RecyclerView{a136c97 VFED..... ......ID 0,0-450,273}, adapter:com.xxxxx.xxxx.utils.pagination.paginate.WrapperAdapter@9256e84, layout:android.support.v7.widget.LinearLayoutManager@ab4766d, context:com.xxxxx.xxxxx.view.modules.ecommerce.ShopActivity@5d48e36
                                       at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:2673)
                                       at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onChanged(RecyclerView.java:5055)
                                       at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:11540)
                                       at android.support.v7.widget.RecyclerView$Adapter.notifyDataSetChanged(RecyclerView.java:6762)
                                       at com.xxxxx.xxxxx.utils.pagination.paginate.WrapperAdapterObserver.onChanged(WrapperAdapterObserver.java:50)
                                       at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:11540)
                                       at android.support.v7.widget.RecyclerView$Adapter.notifyDataSetChanged(RecyclerView.java:6762)
                                       at com.xxxxx.xxxxx.view.base.base_adapters.recycler_view_adapters.BaseListAdapter.informDataSetChanged(BaseListAdapter.java:902)
                                       at com.xxxxx.xxxxx.view.base.base_adapters.recycler_view_adapters.BaseListAdapter.setItems(BaseListAdapter.java:701)
                                       at com.xxxxxx.xxxxx.view.modules.ecommerce.features.product_similar.SimilarProductFragment.fetchSimilarProducts(SimilarProductFragment.java:97)
                                       at com.xxxxx.xxxx.view.modules.ecommerce.features.product_similar.SimilarProductFragment.onLoadMore(SimilarProductFragment.java:274)
                                       at com.xxxxx.xxxx.utils.pagination.paginate.Paginate.checkAdapterState(Paginate.java:76)
                                       at com.xxxxx.xxxxxx.utils.pagination.paginate.Paginate.checkScroll(Paginate.java:101)
                                       at com.xxxxx.xxxxx.utils.pagination.paginate.Paginate.access$000(Paginate.java:15)
                                       at com.xxxxx.xxxxx.utils.pagination.paginate.Paginate$1.onScrolled(Paginate.java:68)
                                       at android.support.v7.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:4722)
                                       at android.support.v7.widget.RecyclerView.scrollByInternal(RecyclerView.java:1787)
                                       at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:2970)
                                       at android.view.View.dispatchTouchEvent(View.java:9303)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2242)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2256)
                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
                                   	at android.vi

Proposed solution is to wrap these calls in a Handler.post() maybe.

Add an item to show that Adapter is empty

Can you add an Item in adapter to show that Adapter is empty? View can notify Paginate that the item-count has changed. If user enables this Empty Item and item-count reaches 0, you can show this item.

I use a layout to show Empty Adapter, but it is shown on top of RecyclerView in FrameLayout. I want to have it in Adapter, and be able to turn it on/off manually.

Thanks. Your library works amazingly even without this feature.

layout-2018-03-16-174829

RecyclerView inside NestedScrollView weird behavior

Hi @NoNews ,

I am using noPaginate lib ti handle a list of accounts movements, if I use the recyclerView [alone] the onLoadMore listener works fine when a reach the last item of the list, but when a Try to use NestedScrollView with RecyclerView the onLoadMore is called before I scroll down.

I hope you can Help me about this issue.

Cheers.

PD: I need to use NestedScrollView in order to use CollapsinToolbarLayout.

Custom view when there is not more items to show

Hi @NoNews its me again.. lol.

Just one question,:

is it possible to show a custom view when there is not more items to show.?..I mean something like "There is not more items to show for the moment"

PD: something like the custom error view.

Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.