use of com.rideread.rideread.common.adapter.CollectAdapter in project ride-read-android by Ride-Read.
the class CollectActivity method initView.
@Override
public void initView() {
new TitleBuilder(this).setTitleText("ζηζΆθ").IsBack(true).setLeftOnClickListener(v -> finish()).build();
mCollectList = new ArrayList<>();
mSwipeRefreshLayout.setOnRefreshListener(() -> {
mPages = 0;
loadCollects();
});
mRecycleView.setHasFixedSize(true);
mAdapter = new CollectAdapter(this, mCollectList);
mRecycleView.setAdapter(mAdapter);
mLayoutManager = new LinearLayoutManager(this);
mRecycleView.setLayoutManager(mLayoutManager);
mRecycleView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
int totalItemCount = mLayoutManager.getItemCount();
if (lastVisibleItem >= totalItemCount - 1 && dy > 0) {
if (!isLoadingMore) {
loadCollects();
}
}
}
});
loadCollects();
}
Aggregations