Closed saiid2020 closed 3 years ago
As I said in the previous bug, there is Java implementation in the sample project. In this implementation when reaching loadMore, more items are added and the list does not return to the top. Check what is the difference between your implementation and mine.
my implementation : private class Pagation extends PagingModule {
public Pagation() {
config(builder -> {
builder.setLayoutResource(R.layout.item_progress);
builder.setVisibleThreshold(3);
return null;
});
onLoadMore((mo )-> {
viewModel.getcatgoryByIdPage(cat_id,String.valueOf(mo+1)).observe(owner, new Observer<Resource<List<Consumer>>>() {
@Override
public void onChanged(Resource<List<Consumer>> listResource) {
oneAdapter.add(listResource.data);
}
});
return null;
});
}
}
private class Productadaptermodel extends ItemModule
public Productadaptermodel() {
config(builder -> {
builder.setLayoutResource(R.layout.layout_category_list);
return null;
});
onBind((model, viewBinder, metadata) -> {
LayoutCategoryListBinding binding = (LayoutCategoryListBinding) viewBinder.getDataBinding();
binding.setProduct(model);
binding.parent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemClickListener.onItemClick(v, model, 1);
}
});
binding.executePendingBindings();
return null;
});
eventHooks.add(new ClickEventHook<Consumer>() {{
onClick((model, viewBinder, metadata) -> {
onItemClickListener.onItemClick(viewBinder.getRootView(), model, metadata.getPosition());
return null;
});
}});
}
}
recycler_product = findViewById(R.id.recycler_product);
recycler_product.setLayoutManager(new LinearLayoutManager(this));
oneAdapter = new OneAdapter(recycler_product)
.attachPagingModule(new Pagation())
.attachItemModule(new Productadaptermodel())
;
I don't know how your models look or implemented or what is returned from your ViewModel, but regarding everything else, I'm sorry I've tested this and your implementation works with no issues on my end. I've tested both Kotin & Java implementations, with DataBinding and without. Can you share a minimal project as possible with this issue so I can resolve it?
any updates?
In pagination, after adding new items, you return to the top of the list and new items are added to the bottom of the list.