Пример #1
0
 @Override
 public boolean dispatchTouchEvent(MotionEvent event) {
   //// System.out.println("flipStarted" + flipStarted);
   if (flipStarted) return true;
   //        if (header.isSourceSelectMode()) {
   if (header.dispatchTouchEvent(event)) {
     return true;
   }
   //        if (pageIndexView.dispatchTouchEvent(event)) {
   //            return true;
   //        }
   //        }
   if (enlargedMode) {
     current.onTouchEvent(event);
   }
   switch (event.getAction()) {
     case MotionEvent.ACTION_UP:
       return current.dispatchTouchEvent(event);
     case MotionEvent.ACTION_MOVE:
       {
         if (!enlargedMode) onTouchEvent(event);
         else current.onTouchEvent(event);
       }
   }
   return super.dispatchTouchEvent(event);
 }
Пример #2
0
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    //// System.out.println("flipStarted" + flipStarted);
    if (flipStarted) {
      return false;
    }
    //        if (header.isSourceSelectMode()) {
    //            header.onTouchEvent(event);
    //        }
    if (enlargedMode) {
      current.onTouchEvent(event);
    }

    switch (event.getAction()) {
      case MotionEvent.ACTION_MOVE:
        if (event.getHistorySize() > 0 && !flipStarted) {
          if (GestureUtil.flipRight(event)) {
            lastFlipDirection = ACTION_HORIZONTAL;
            flipPage(false);
          } else if (GestureUtil.flipUp(event)) {
            lastFlipDirection = ACTION_VERTICAL;
            flipPage(false);
          } else if (GestureUtil.flipLeft(event)) {
            lastFlipDirection = ACTION_HORIZONTAL;
            flipPage(true);
          } else if (GestureUtil.flipDown(event)) {
            lastFlipDirection = ACTION_VERTICAL;
            flipPage(true);
          }

        } else {
          //                    if (header.isSourceSelectMode())
          header.onTouchEvent(event);
          //                    pageIndexView.onTouchEvent(event);
        }
        break;
      default:
        break;
    }

    return true;
  }