Search in sources :

Example 1 with OnItemChildLongClickListener

use of com.chad.library.adapter.base.listener.OnItemChildLongClickListener 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;
        }
    });
}
Also used : OnItemClickListener(com.chad.library.adapter.base.listener.OnItemClickListener) OnItemChildLongClickListener(com.chad.library.adapter.base.listener.OnItemChildLongClickListener) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnItemChildClickListener(com.chad.library.adapter.base.listener.OnItemChildClickListener) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) OnItemLongClickListener(com.chad.library.adapter.base.listener.OnItemLongClickListener)

Aggregations

View (android.view.View)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 OnItemChildClickListener (com.chad.library.adapter.base.listener.OnItemChildClickListener)1 OnItemChildLongClickListener (com.chad.library.adapter.base.listener.OnItemChildLongClickListener)1 OnItemClickListener (com.chad.library.adapter.base.listener.OnItemClickListener)1 OnItemLongClickListener (com.chad.library.adapter.base.listener.OnItemLongClickListener)1