cymcsg / UltimateRecyclerView

A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.
Apache License 2.0
7.22k stars 1.43k forks source link

Load More Is not working with latest Patch #444

Open zelin opened 7 years ago

zelin commented 7 years ago

I have a simple RecyclerVie

<com.marshalchen.ultimaterecyclerview.UltimateRecyclerView
        android:scrollbars="none"
        android:animationCache="true"
        android:listSelector="@null"
        android:layout_marginBottom="60dp"
        android:layout_below="@+id/topBar"
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

However

listView = (UltimateRecyclerView) findViewById(R.id.listView);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setReverseLayout(true);
        listView.setLayoutManager(linearLayoutManager);

        listView.setEmptyView(R.layout.listview_bottom_progress, R.id.extraMainLayout);
        adapter = new ChatsAdapter(ChatActivity.this, pings);
        listView.setAdapter(adapter);

        listView.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener()
        {
            @Override
            public void loadMore(int itemsCount, int maxLastVisiblePosition)
            {
                if (shouldLoadMore && !isLoadingMore)
                    new LoadPingsFromDatabase().executeOnExecutor(ApiManager.getInstance().executor);
            }
        });

        View loadMoreLayout = LayoutInflater.from(this).inflate(R.layout.listview_bottom_progress, listView.mRecyclerView, false);
        loadMoreIndicator = (ProgressWheel) loadMoreLayout.findViewById(R.id.progressBar);
        loadMoreIndicator.setVisibility(View.VISIBLE);
        adapter.setCustomLoadMoreView(loadMoreLayout);
        adapter.enableLoadMore();

The load more doesn't seem to be called nor the view is being shown, Same code used to work with 0.3+ but now i have updated and it doesn't seem to work anymore,

  linearLayoutManager.setReverseLayout(true);
        listView.setEmptyView(R.layout.listview_bottom_progress, R.id.extraMainLayout);

I get crash if don't use emptyView

RiteshChandnani commented 7 years ago

Not working for me even after having empty view. Crashing! :/ Any other idea on how can I temporarily fix it?

icyfox-bupt commented 7 years ago

me too..

RiteshChandnani commented 7 years ago

Now it is working for me!

Please check that you have following methods in your Adapter implementation: newFooterHolder(View view) newHeaderHolder(View view)

Check sample implementation here in source code