class WXGesture extends GestureDetector.SimpleOnGestureListener implements OnTouchListener {

  @Override
  public boolean onTouch(View v, MotionEvent event) {
    if(requestDisallowInterceptTouchEvent){
      return false;
    }
    try {
      boolean result = mGestureDetector.onTouchEvent(event);
      switch (event.getActionMasked()) {
        case MotionEvent.ACTION_POINTER_DOWN:
        case MotionEvent.ACTION_DOWN:
          mIsTouchEventConsumed = false;
          /**
           * If component has same scroll orientation with it's parent and it's parent not scrollable
           * , we should disallow parent in DOWN.
           */
          if(hasSameOrientationWithParent() && !isParentScrollable()){
            ViewParent p;
            if ((p = component.getRealView().getParent()) != null) {
              p.requestDisallowInterceptTouchEvent(true);
            }
          }
          result |= handleMotionEvent(LowLevelGesture.ACTION_DOWN, event);
          break;
        case MotionEvent.ACTION_MOVE:
          result |= handleMotionEvent(LowLevelGesture.ACTION_MOVE, event);
          break;
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_POINTER_UP:
          finishDisallowInterceptTouchEvent(v);
          result |= handleMotionEvent(LowLevelGesture.ACTION_UP, event);
          result |= handlePanMotionEvent(event);
          break;
        case MotionEvent.ACTION_CANCEL:
          finishDisallowInterceptTouchEvent(v);
          result |= handleMotionEvent(LowLevelGesture.ACTION_CANCEL, event);
          result |= handlePanMotionEvent(event);
          break;
      }
      if(component.containsEvent(STOP_PROPAGATION)){
        ViewGroup parent = (ViewGroup) v.getParent();
        boolean requestDisallowInterceptTouchEvent = false;
        if(parent != null){
          if(!shouldBubbleTouchEvent(event)){
            requestDisallowInterceptTouchEvent = true;
          }
          parent.requestDisallowInterceptTouchEvent(requestDisallowInterceptTouchEvent);
        }
        if(component.getParent() != null){
          component.getParent().requestDisallowInterceptTouchEvent(requestDisallowInterceptTouchEvent);
        }
        if(mIsTouchEventConsumed && WXUtils.getBoolean(component.getDomObject().getAttrs().get("cancelTouchOnConsume"), false)){//when touch event consumed by one gesture, other component should not consumed
          event.setAction(MotionEvent.ACTION_CANCEL);
        }
      }
      return result;
    } catch (Exception e) {
      WXLogUtils.e("Gesture RunTime Error ", e);
      return false;
    }
  }

  public  WXGesture(WXComponent wxComponent, Context context);

}