use of com.chad.library.adapter.base.BaseQuickAdapter in project BaseRecyclerViewAdapterHelper by CymChad.
the class ItemClickActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_universal_recycler);
setBackBtn();
setTitle("ItemClickActivity Activity");
mRecyclerView = findViewById(R.id.rv);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
initAdapter();
adapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
Tips.show("onItemClick " + position);
}
});
adapter.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
Tips.show("onItemLongClick " + position);
return true;
}
});
adapter.setOnItemChildClickListener(new OnItemChildClickListener() {
@Override
public void onItemChildClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
Tips.show("onItemChildClick " + position);
}
});
adapter.setOnItemChildLongClickListener(new OnItemChildLongClickListener() {
@Override
public boolean onItemChildLongClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
Tips.show("onItemChildLongClick " + position);
return true;
}
});
}
use of com.chad.library.adapter.base.BaseQuickAdapter in project VerticalCalendar by mzyq.
the class CalendarView method initRecyclerView.
/**
* 初始化RecyclerView
*/
private void initRecyclerView() {
recyclerView.setLayoutManager(new MLinearLayoutManager(getContext()));
calendarAdapter = new CalendarAdapter(getContext(), R.layout.item_month, monthList);
recyclerView.setAdapter(calendarAdapter);
recyclerView.addOnItemTouchListener(new OnItemChildClickListener() {
@Override
public void onSimpleItemChildClick(BaseQuickAdapter adapter, View view, int position) {
if (view.getId() == R.id.rvMonth) {
rvPosition = position;
}
}
});
calendarAdapter.setListener(new CalendarAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
if (rvPosition > -1) {
handleClick(rvPosition, position);
// 刷新adapter
calendarAdapter.notifyDataSetChanged();
rvPosition = -1;
}
}
});
}
use of com.chad.library.adapter.base.BaseQuickAdapter 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