Closed billytb closed 8 years ago
tell me the steps to reproduce this
My layout :
<com.marshalchen.ultimaterecyclerview.UltimateRecyclerView
android:id="@+id/ultimate_recycler_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
app:recyclerviewEmptyView="@layout/empty_view"
app:recyclerviewScrollbars="vertical" />
My Adapter :
public class GridVideoAdapter extends UltimateGridLayoutAdapter<VideoModel, GridVideoAdapter.HolderGirdCell> { .... public void clear() { removeAll(); } .... }
My Code :
GridVideoAdapter mAdapter = null;
....
....
public void onInitView() {
mAdapter = new GridVideoAdapter(new ArrayList<VideoModel>());
mAdapter.setAdapterActionListener(this);
mGridLayoutManager = new BasicGridLayoutManager(getContext(), columns, mAdapter);
ultimateRecyclerView.setLayoutManager(mGridLayoutManager);
ultimateRecyclerView.setHasFixedSize(true);
ultimateRecyclerView.setDefaultOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
pageNumber = 1;
requestGetData();
}
});
// setting load more Recycler View
ultimateRecyclerView.reenableLoadmore();
ultimateRecyclerView.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() {
@Override
public void loadMore(int itemsCount, int maxLastVisiblePosition) {
requestGetData();
}
});
ultimateRecyclerView.setAdapter(mAdapter);
requestGetData();
}
void requestGetData() {
// check page number
if (pageNumber < 1)
pageNumber = 1;
RPC.requestGetVideoAtHome(type, pageNumber, new APIResponseListener() {
@Override
public void onError(String message) {
stopAnimLoading();
DialogUtil.showMessageBox(mContext, message);
}
@Override
public void onSuccess(Object results) {
stopAnimLoading();
if (ultimateRecyclerView == null)
return;
ultimateRecyclerView.setRefreshing(false);
// parse data
List<VideoJSON> listData = (List<VideoJSON>) results;
// check end data
if (listData == null || listData.isEmpty())
return;
// check first get data
if (pageNumber == 1)
mAdapter.clear();
// update data to view
pageNumber++;
updateData(listData);
}
});
}
.....
i think u have put ultimateRecyclerView.reenableLoadmore();
at the beginning and this is not advised.
sorry, error copy paste, code edited
I still get the same error If i remove "ultimateRecyclerView.reenableLoadmore();", load more dismissed
Hi There. Please help me fix error
My Adapter code ( GridAdapter extend UltimateGridLayoutAdapter ):
public void clear() { removeAll(); }