use of com.example.jingbin.cloudreader.adapter.GankAndroidAdapter in project CloudReader by youlookwhat.
the class CustomFragment method initRecyclerView.
private void initRecyclerView() {
adapter = new GankAndroidAdapter();
View mHeaderView = LayoutInflater.from(getContext()).inflate(R.layout.header_item_gank_custom, (ViewGroup) bindingView.xrvAndroid.getParent(), false);
bindingView.xrvAndroid.addHeaderView(mHeaderView);
initHeader(mHeaderView);
RefreshHelper.initLinear(bindingView.xrvAndroid, false);
bindingView.xrvAndroid.setAdapter(adapter);
bindingView.xrvAndroid.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
int page = viewModel.getPage();
page++;
viewModel.setPage(page);
loadCustomData();
}
});
}
use of com.example.jingbin.cloudreader.adapter.GankAndroidAdapter in project CloudReader by youlookwhat.
the class GankHomeFragment method initRecyclerView.
private void initRecyclerView() {
mAdapter = new GankAndroidAdapter();
mAdapter.setAllType(true);
mHeaderBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.header_item_everyday, null, false);
bindingView.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
bindingView.recyclerView.setLoadMoreEnabled(true);
bindingView.recyclerView.setHasFixedSize(false);
bindingView.recyclerView.addHeaderView(mHeaderBinding.getRoot());
// bindingView.recyclerView.setAdapter(mAdapter);
// 显示日期,去掉第一位的"0"
String day = getTodayTime().get(2);
mHeaderBinding.includeEveryday.tvDailyText.setText(day.indexOf("0") == 0 ? day.replace("0", "") : day);
mHeaderBinding.includeEveryday.ibXiandu.setOnClickListener(listener);
mHeaderBinding.includeEveryday.ibWanAndroid.setOnClickListener(listener);
mHeaderBinding.includeEveryday.ibMovieHot.setOnClickListener(listener);
mHeaderBinding.includeEveryday.flEveryday.setOnClickListener(listener);
DensityUtil.setWidthHeight(mHeaderBinding.banner, DensityUtil.getDisplayWidth(), 2.2f);
onObserveViewModel();
showItemSkeleton();
}
use of com.example.jingbin.cloudreader.adapter.GankAndroidAdapter in project CloudReader by youlookwhat.
the class AndroidFragment method initRecyclerView.
private void initRecyclerView() {
adapter = new GankAndroidAdapter();
// 加了分割线,滚动条才会置顶
SpacesItemDecoration itemDecoration = new SpacesItemDecoration(activity, SpacesItemDecoration.VERTICAL, 1);
itemDecoration.setDrawable(R.drawable.shape_transparent);
RefreshHelper.initLinear(bindingView.xrvAndroid, false).addItemDecoration(itemDecoration);
bindingView.xrvAndroid.setAdapter(adapter);
bindingView.xrvAndroid.setOnRefreshListener(new ByRecyclerView.OnRefreshListener() {
@Override
public void onRefresh() {
viewModel.setPage(1);
loadAndroidData();
}
});
bindingView.xrvAndroid.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
int page = viewModel.getPage();
page++;
viewModel.setPage(page);
loadAndroidData();
}
});
}
Aggregations