use of com.qyh.myblog_android.ui.adapter.BlogContentAdapter in project Qblog_Android by qiaoyhh.
the class MyBlogActivity method initView.
@Override
protected void initView() {
setToolBar(toolBar, "我的博客");
mAdapter = new BlogContentAdapter(R.layout.item_blogcontent_view, null);
mLayoutManger = new LinearLayoutManager(mContext);
viewMain.setLayoutManager(mLayoutManger);
viewMain.setHasFixedSize(true);
viewMain.addItemDecoration(new RecyclerViewDecoration(mContext, LinearLayoutManager.HORIZONTAL, R.drawable.divider_mileage));
viewMain.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
Intent intent = new Intent(mContext, BlogDetailActivity.class);
intent.putExtra(Constants.BLOGCONTENT_TYPE, mData.get(position));
startActivity(intent);
}
});
}
use of com.qyh.myblog_android.ui.adapter.BlogContentAdapter in project Qblog_Android by qiaoyhh.
the class BlogContentFragment method initView.
@Override
protected void initView() {
if (getArguments() != null) {
blogType = getArguments().getInt(Constants.BLOG_TYPE);
}
mAdapter = new BlogContentAdapter(R.layout.item_blogcontent_view, null);
mLayoutManger = new LinearLayoutManager(mContext);
viewMain.setLayoutManager(mLayoutManger);
viewMain.setHasFixedSize(true);
viewMain.addItemDecoration(new RecyclerViewDecoration(mContext, LinearLayoutManager.HORIZONTAL, R.drawable.divider_mileage));
viewMain.setAdapter(mAdapter);
refreshLayout.setColorSchemeColors(getResources().getColor(R.color.blue_light), getResources().getColor(R.color.green_light), getResources().getColor(R.color.orange_light), getResources().getColor(R.color.red_light));
refreshLayout.setOnRefreshListener(this);
mAdapter.setEnableLoadMore(false);
mAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
page++;
getBlogListData(page, Constants.TYPE_LOADMORE);
}
});
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
Intent intent = new Intent(mContext, BlogDetailActivity.class);
intent.putExtra(Constants.BLOGCONTENT_TYPE, mData.get(position));
startActivity(intent);
}
});
}
Aggregations