use of com.xxx.ency.view.eyepetizer.adapter.Eyepetizer2Adapter in project Ency by xiarunhao123.
the class EyepetizerFragment method initialize.
@Override
protected void initialize() {
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
swipeRefreshLayout.setRefreshing(true);
swipeRefreshLayout.setOnRefreshListener(this);
mPresenter.getVideoData(page, Constants.EYEPETIZER_UDID, "weekly", "256", "XXX");
mPresenter.getPTP();
View headerView = getActivity().getLayoutInflater().inflate(R.layout.header_eyepetizer, null);
recyclerViewTop = headerView.findViewById(R.id.recyclerview_eyepetizer_top);
tvHot = headerView.findViewById(R.id.txt_hot);
tvLike = headerView.findViewById(R.id.txt_like);
llMore = headerView.findViewById(R.id.layout_more);
llMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext, EyepetizerHotActivity.class);
intent.putExtra("data", hotVideoBean);
mContext.startActivity(intent);
}
});
hotAdapter = new Eyepetizer2Adapter();
hotAdapter.setOnItemClickListener(this);
recyclerViewTop.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
recyclerViewTop.setAdapter(hotAdapter);
recyclerViewTop.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
switch(newState) {
case RecyclerView.SCROLL_STATE_DRAGGING:
swipeRefreshLayout.setEnabled(false);
break;
case RecyclerView.SCROLL_STATE_IDLE:
swipeRefreshLayout.setEnabled(true);
break;
}
}
});
new PagerSnapHelper().attachToRecyclerView(recyclerViewTop);
dailyAdapter = new EyepetizerAdapter();
dailyAdapter.setOnItemClickListener(this);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
recyclerView.setAdapter(dailyAdapter);
dailyAdapter.addHeaderView(headerView);
dailyAdapter.setOnLoadMoreListener(this, recyclerView);
}
Aggregations