use of nucleus.example.util.RxPager in project nucleus by konmik.
the class MainFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
check1.setText(MainPresenter.NAME_1);
check2.setText(MainPresenter.NAME_2);
pager = new RxPager(10, page -> {
adapter.showProgress();
getPresenter().requestNext(page);
});
adapter = new SimpleListAdapter<>(R.layout.recycler_view_progress, new ClassViewHolderType<>(ServerAPI.Item.class, R.layout.item, v -> new SimpleViewHolder<>(v, this::onItemClick)));
recyclerView.setAdapter(adapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.addOnScrollListener(new OnScrollPaging(layoutManager, adapter, pager::next));
}
Aggregations