コード例 #1
0
  @Override
  public boolean onInterceptTouchEvent(MotionEvent ev) {
    final int action = ev.getAction();
    switch (action) {
      case MotionEvent.ACTION_DOWN:
        Log.i("VerticalScrollview", "onInterceptTouchEvent: DOWN super false");
        super.onTouchEvent(ev);
        break;

      case MotionEvent.ACTION_MOVE:
        return false; // redirect MotionEvents to ourself

      case MotionEvent.ACTION_CANCEL:
        Log.i("VerticalScrollview", "onInterceptTouchEvent: CANCEL super false");
        super.onTouchEvent(ev);
        break;

      case MotionEvent.ACTION_UP:
        Log.i("VerticalScrollview", "onInterceptTouchEvent: UP super false");
        return false;

      default:
        Log.i("VerticalScrollview", "onInterceptTouchEvent: " + action);
        break;
    }

    return false;
  }
コード例 #2
0
 @Override
 public boolean onTouchEvent(MotionEvent event) {
   boolean ret = false;
   // Log.i("MsgContentSlideView", "onTouchEvent");
   Xlog.d(MmsApp.TXN_TAG, "MsgContentSlideView.onTouchEvent");
   super.onTouchEvent(event);
   this.mDetector.onTouchEvent(event);
   return true;
 }
コード例 #3
0
 public boolean onTouchEvent(android.view.MotionEvent event) {
   if (callbackProcs != null && callbackProcs[CB_TOUCH_EVENT] != null) {
     super.onTouchEvent(event);
     return (Boolean)
         Script.callMethod(callbackProcs[CB_TOUCH_EVENT], "call", event, Boolean.class);
   } else {
     return super.onTouchEvent(event);
   }
 }
コード例 #4
0
ファイル: MyScrollView.java プロジェクト: asantoso/artsy
  @Override
  public boolean onTouchEvent(MotionEvent ev) {

    int actionId = ev.getAction();
    switch (actionId) {
      case MotionEvent.ACTION_DOWN:
        {
          lastDownX = (int) ev.getX();
          bypassEvent = false;
          break;
        }
      case MotionEvent.ACTION_MOVE:
        {
          int adx = Math.abs(lastDownX - (int) ev.getX());
          Logger.l(Logger.DEBUG, LOG_TAG, "onTouchEvent adx:" + adx);
          if (adx > 5) {
            bypassEvent = true;
          } else {
            bypassEvent = false;
          }
          break;
        }
      case MotionEvent.ACTION_UP:
        {
          bypassEvent = false;
          break;
        }
      case MotionEvent.ACTION_CANCEL:
        {
          bypassEvent = false;
          break;
        }
      case MotionEvent.ACTION_OUTSIDE:
        {
          bypassEvent = false;
          break;
        }
    }

    super.onTouchEvent(ev);

    return false;
    /*
    if(bypassEvent){
    	return false;
    }
    return false;
    */
  }
コード例 #5
0
  @Override
  public boolean onInterceptTouchEvent(MotionEvent ev) {
    int action = ev.getAction();
    switch (action) {
      case MotionEvent.ACTION_DOWN | MotionEvent.ACTION_CANCEL:
        super.onTouchEvent(ev);

        break;
      case MotionEvent.ACTION_MOVE:
        return false;
      case MotionEvent.ACTION_UP:
        return false;
      default:
        break;
    }

    return false;
  }
コード例 #6
0
 @Override
 public boolean onTouchEvent(MotionEvent ev) {
   super.onTouchEvent(ev);
   Log.i("VerticalScrollview", "onTouchEvent. action: " + ev.getAction());
   return true;
 }
コード例 #7
0
  @Override
  public boolean onTouchEvent(MotionEvent ev) {
    int action = ev.getAction();
    switch (action) {
      case MotionEvent.ACTION_DOWN:
        mDownY = ev.getY();
        super.onTouchEvent(ev);
        break;
      case MotionEvent.ACTION_MOVE:
        if (mCurrentOffset <= 0) {
          isNeedMove();
          if (!isTouchOne) {
            startY = ev.getY();
            isTouchOne = true;
          }
          distance = ev.getY() - startY;
          if (distance > 0) {
            isBig = true;
            setT((int) -distance / 4);
          }
        } else {
          final float preY = mDownY == 0 ? ev.getY() : mDownY;
          float currentY = ev.getY();
          int deltaY = (int) (preY - currentY);
          // 滚动
          mDownY = currentY;
          // 当滚动到最上或者最下时就不会再滚动,这时移动布局
          if (isNeedMove()) {
            if (normal.isEmpty()) {
              Log.e(
                  "normal",
                  mFirstChild.getLeft()
                      + "  "
                      + mFirstChild.getTop()
                      + " i "
                      + mFirstChild.getBottom()
                      + "  "
                      + mFirstChild.getRight()
                      + "   "
                      + mFirstChild.getHeight());
              // 保存正常的布局位置
              normal.set(
                  mFirstChild.getLeft(),
                  mFirstChild.getTop(),
                  mFirstChild.getRight(),
                  mFirstChild.getBottom());
            }
            // 移动布局(关键)
            mFirstChild.layout(
                mFirstChild.getLeft(),
                mFirstChild.getTop() - deltaY / 4,
                mFirstChild.getRight(),
                mFirstChild.getBottom() - deltaY / 4);
            //                        mFirstChild.scrollBy(0,deltaY);
          } else {
            super.onTouchEvent(ev);
          }
        }
        break;
      case MotionEvent.ACTION_UP:
        if (isBig) {
          reset();
          isBig = false;
        }
        isTouchOne = false;

        mDownY = 0;
        if (isNeedAnimation()) {
          animation();
        }
        super.onTouchEvent(ev);
        break;
    }
    return super.onTouchEvent(ev);
  }
コード例 #8
0
  @Override
  public boolean onTouchEvent(MotionEvent ev) {
    super.onTouchEvent(ev);

    return true;
  }