use of com.codeest.geeknews.ui.zhihu.adapter.HotAdapter in project GeekNews by codeestX.
the class HotFragment method initEventAndData.
@Override
protected void initEventAndData() {
mList = new ArrayList<>();
ivProgress.start();
mAdapter = new HotAdapter(mContext, mList);
rvHotContent.setVisibility(View.INVISIBLE);
rvHotContent.setLayoutManager(new LinearLayoutManager(mContext));
rvHotContent.setAdapter(mAdapter);
mPresenter.getHotData();
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mPresenter.getHotData();
}
});
mAdapter.setOnItemClickListener(new HotAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position, View shareView) {
mPresenter.insertReadToDB(mList.get(position).getNews_id());
mAdapter.setReadState(position, true);
mAdapter.notifyItemChanged(position);
Intent intent = new Intent();
intent.setClass(mContext, ZhihuDetailActivity.class);
intent.putExtra("id", mList.get(position).getNews_id());
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, shareView, "shareView");
mContext.startActivity(intent, options.toBundle());
}
});
}
Aggregations