use of com.example.jingbin.cloudreader.view.byview.NeteaseLoadMoreView in project CloudReader by youlookwhat.
the class CategoryArticleFragment method initRefreshView.
private void initRefreshView() {
mAdapter = new CategoryArticleAdapter(activity);
bindingView.recyclerView.setLayoutManager(new LinearLayoutManager(activity));
bindingView.recyclerView.setItemAnimator(null);
bindingView.recyclerView.addItemDecoration(new SpacesItemDecoration(activity).setHeaderNoShowDivider(isRefresh ? 1 : 0));
bindingView.recyclerView.setRefreshHeaderView(new NeteaseRefreshHeaderView(activity));
bindingView.recyclerView.setLoadingMoreView(new NeteaseLoadMoreView(activity));
bindingView.recyclerView.setAdapter(mAdapter);
bindingView.recyclerView.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
int page = viewModel.getPage();
viewModel.setPage(++page);
getHomeList();
}
});
if (isRefresh) {
bindingView.recyclerView.setOnRefreshListener(new ByRecyclerView.OnRefreshListener() {
@Override
public void onRefresh() {
viewModel.setPage(0);
getHomeList();
}
});
}
}
use of com.example.jingbin.cloudreader.view.byview.NeteaseLoadMoreView in project CloudReader by youlookwhat.
the class SearchActivity method initRefreshView.
private void initRefreshView() {
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
binding.recyclerView.setLoadingMoreView(new NeteaseLoadMoreView(this));
mAdapter = new CategoryArticleAdapter(this);
binding.recyclerView.setAdapter(mAdapter);
}
use of com.example.jingbin.cloudreader.view.byview.NeteaseLoadMoreView in project CloudReader by youlookwhat.
the class RefreshHelper method initStaggeredGrid.
public static void initStaggeredGrid(ByRecyclerView recyclerView, int spanCount, int spacing) {
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(spanCount, StaggeredGridLayoutManager.VERTICAL));
// 如果每个item高度一致设置后效率更高
recyclerView.setHasFixedSize(true);
// recyclerView.setItemAnimator(null);
recyclerView.addItemDecoration(new GridSpaceItemDecoration(spacing));
recyclerView.setRefreshHeaderView(new NeteaseRefreshHeaderView(recyclerView.getContext()));
recyclerView.setLoadingMoreView(new NeteaseLoadMoreView(recyclerView.getContext()));
}
use of com.example.jingbin.cloudreader.view.byview.NeteaseLoadMoreView in project CloudReader by youlookwhat.
the class RefreshHelper method initLinear.
public static ByRecyclerView initLinear(ByRecyclerView recyclerView, boolean isDivider, int headerNoShowSize) {
recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
// recyclerView.setItemAnimator(null);
if (isDivider) {
recyclerView.addItemDecoration(new SpacesItemDecoration(recyclerView.getContext(), SpacesItemDecoration.VERTICAL, headerNoShowSize).setDrawable(R.drawable.shape_line));
}
recyclerView.setRefreshHeaderView(new NeteaseRefreshHeaderView(recyclerView.getContext()));
recyclerView.setLoadingMoreView(new NeteaseLoadMoreView(recyclerView.getContext()));
return recyclerView;
}
Aggregations