title: Detect touch event when onInterceptTouchEvent() used
body: <p>I am asking this rather complex question hoping that i would get an idea from you. </p>
  
  <p>Here is the thing: I have created a custom list view class, the one above:</p>
  
  <pre><code>public class FolderListView extends ListView {
  
      private float xDistance, yDistance, lastX, lastY;
      private int folder_index;
      private FolderViewInterface openFolder;
  
      // private boolean swiping = false;
  
      // If built programmatically
      public FolderListView(Context context) {
          super(context);
      }
  
      // This example uses this method since being built from XML
      public FolderListView(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  
      // Build from XML layout
      public FolderListView(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
      }
  
      @Override
      public boolean onInterceptTouchEvent(MotionEvent ev) {
  
          switch (ev.getAction()) {
  
          case MotionEvent.ACTION_UP:
              // if (swiping == false) {
  
              //if (xDistance &gt; yDistance)
              //  return false;
          //  else {
                  folder_index = pointToPosition((int) lastX, (int) lastY);
              //  Toast.makeText(getContext(),
              //          "You pressed a folder with index: " + folder_index,
              //          Toast.LENGTH_SHORT).show();
          //  }
              HomeScreenFragment f = new HomeScreenFragment();
              openFolder = (FolderViewInterface) f;
              openFolder.onFolderOpened(folder_index);
              // }
              // swiping = false;
              break;
  
          case MotionEvent.ACTION_DOWN:
              // swiping = false;
              xDistance = yDistance = 0f;
              lastX = ev.getX();
              lastY = ev.getY();
              break;
          case MotionEvent.ACTION_MOVE:
              // swiping = true;
              final float curX = ev.getX();
              final float curY = ev.getY();
              xDistance += Math.abs(curX - lastX);
              yDistance += Math.abs(curY - lastY);
              lastX = curX;
              lastY = curY;
              if (xDistance &gt; yDistance)
                  return false;
          }
  
          return super.onInterceptTouchEvent(ev);
  
      }
  
  }
  </code></pre>
  
  <p>thing is here i am looking to properly detect the touch event.
  I want on touch to open the other fragment, but right now the fragment is opened both on touch and on swipe.</p>
  
  <p>I have used the onInterceptTouchEvent because the elements of my list are viewpagers and they were not behaving properly when scrolling.</p>
  
  <p>I need some kind of logic here to detect the swiping and not perform this part:</p>
  
  <pre><code>HomeScreenFragment f = new HomeScreenFragment();
              openFolder = (FolderViewInterface) f;
              openFolder.onFolderOpened(folder_index);
  </code></pre>
  
  <p>Only if the event is a touch event, not a swipe one.</p>
  
  <p>Any kind of suggestion/help is highly appreciated, please let me know if you need any more details.</p>
  
  <p>Thanks!</p>