cymcsg / UltimateRecyclerView

A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.
Apache License 2.0
7.22k stars 1.43k forks source link

ItemClickListener #382

Open itdais opened 8 years ago

itdais commented 8 years ago

I can't find method to implements ReecyclerViewItemClickListener

jjhesk commented 8 years ago

yes, this will do the trick.


 private ItemTouchAdapter getTouchAdapter(UltimateRecyclerView view) {
        final ItemTouchAdapter m = new ItemTouchAdapter(
                view, new ItemTouchAdapter.RecyclerViewOnItemClickListener() {
            @Override
            public void onItemClick(RecyclerView parent, View clickedView, int position) {
                URLogs.d("onItemClick()" + position);
                triggerClickItemPosition(position);
            }

            @Override
            public void onItemLongClick(RecyclerView parent, View clickedView, int position) {
                URLogs.d("onItemLongClick()" + position);
            }
        });

        return m;
    }

You will need to add this to your list view.

  listview_layout.addOnItemTouchListener(getTouchAdapter(listview_layout));