public void onTouchEvent(MotionEvent event) {

    if (!this.running) return;

    boolean result = this.detector.onTouchEvent(event);

    if (this.mode == MODE_SOLID) event.setAction(MotionEvent.ACTION_CANCEL);
    else if (this.mode == MODE_DYNAMIC) {

      if (event.getAction() == ACTION_FAKE) event.setAction(MotionEvent.ACTION_UP);
      else if (result) event.setAction(MotionEvent.ACTION_CANCEL);
      else if (this.tapIndicator) {
        event.setAction(MotionEvent.ACTION_DOWN);
        this.tapIndicator = false;
      }
    }
    // else just do nothing, it's Transparent
  }
  @Override
  public boolean onSingleTapConfirmed(MotionEvent me) {
    if (this.mode == MODE_DYNAMIC) { // we owe an ACTION_UP, so we fake an
      me.setAction(ACTION_FAKE); // action which will be converted to an
      // ACTION_UP later.
      this.context.dispatchTouchEvent(me);
    }

    return false;
  }