@@ -0,0 +1,2005 @@
+package com.example.todocloud.listener;%0A%0Aimport android.content.Context;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.view.GestureDetector;%0Aimport android.view.MotionEvent;%0Aimport android.view.View;%0A%0Apublic class RecyclerViewOnItemTouchListener implements RecyclerView.OnItemTouchListener %7B%0A%0A  private ClickListener clickListener;%0A  private GestureDetector gestureDetector;%0A%0A  public RecyclerViewOnItemTouchListener(%0A      Context context,%0A      final RecyclerView recyclerView,%0A      final ClickListener clickListener%0A  ) %7B%0A    this.clickListener = clickListener;%0A    gestureDetector = new GestureDetector(%0A        context,%0A        new GestureDetector.SimpleOnGestureListener() %7B%0A%0A          @Override%0A          public boolean onSingleTapUp(MotionEvent e) %7B%0A            return true;%0A          %7D%0A%0A          @Override%0A          public void onLongPress(MotionEvent e) %7B%0A            View childView = recyclerView.findChildViewUnder(e.getX(), e.getY());%0A            int childViewAdapterPosition = recyclerView.getChildAdapterPosition(childView);%0A            if (childView != null && clickListener != null) %7B%0A              clickListener.onLongClick(childView, childViewAdapterPosition);%0A            %7D%0A          %7D%0A%0A        %7D%0A    );%0A  %7D%0A%0A  @Override%0A  public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) %7B%0A    View childView = rv.findChildViewUnder(e.getX(), e.getY());%0A    int childViewAdapterPosition = rv.getChildAdapterPosition(childView);%0A    if (childView != null && clickListener != null && gestureDetector.onTouchEvent(e)) %7B%0A      clickListener.onClick(childView, childViewAdapterPosition);%0A    %7D%0A    return false;%0A  %7D%0A%0A  @Override%0A  public void onTouchEvent(RecyclerView rv, MotionEvent e) %7B%0A%0A  %7D%0A%0A  @Override%0A  public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) %7B%0A%0A  %7D%0A%0A  public interface ClickListener %7B%0A    void onClick(View childView, int childViewAdapterPosition);%0A    void onLongClick(View childView, int childViewAdapterPosition);%0A  %7D%0A%0A%7D%0A

Implement RecyclerView touch event handling