use of com.example.jingbin.cloudreader.adapter.OneAdapter in project CloudReader by youlookwhat.
the class OneFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
showContentView();
aCache = ACache.get(getActivity());
oneAdapter = new OneAdapter(activity);
mHotMovieBean = (HotMovieBean) aCache.getAsObject(Constants.ONE_HOT_MOVIE);
isPrepared = true;
DebugUtil.error("---OneFragment --onActivityCreated");
}
use of com.example.jingbin.cloudreader.adapter.OneAdapter in project CloudReader by youlookwhat.
the class OneFragment method initRecyclerView.
private void initRecyclerView() {
oneBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.header_item_one, null, false);
oneBinding.setView(this);
bindingView.listOne.setLayoutManager(new LinearLayoutManager(activity));
bindingView.listOne.setItemAnimator(null);
bindingView.listOne.addHeaderView(oneBinding.getRoot());
oneAdapter = new OneAdapter(activity);
bindingView.listOne.setAdapter(oneAdapter);
bindingView.listOne.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
if (oneBinding.tlMovie.getSelectedTabPosition() == 1) {
viewModel.handleNextStart();
loadComingSoonMovie();
} else {
bindingView.listOne.loadMoreEnd();
}
}
});
oneBinding.tlMovie.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
int tabPosition = oneBinding.tlMovie.getSelectedTabPosition();
if (tabPosition == 0) {
viewModel.setStart(0);
bindingView.listOne.setRefreshing(false);
loadHotMovie();
} else {
viewModel.setStart(0);
bindingView.listOne.setRefreshing(false);
loadComingSoonMovie();
}
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
Aggregations