use of com.chad.library.adapter.base.listener.OnItemLongClickListener 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;
}
});
}
Aggregations