Java 类android.view.MotionEvent 实例源码

项目:CustomAndroidOneSheeld    文件:MutitouchKeysContainer.java   
private synchronized void move(MotionEvent event) {
    for (PinData item : pressedRects) {
        boolean pressed = false;
        for (int i = 0; i < (event.getPointerCount() > maxPointers ? maxPointers
                : event.getPointerCount()); i++) {
            if (item.rect
                    .contains((int) event.getX(i), (int) event.getY(i)))
                pressed = true;
        }
        if (!pressed) {
            if (item.key != null && item.key.eventListener != null)
                item.key.eventListener.onReleased(item.key);
            pressedRects.remove(item);
        }
    }
    for (int i = 0; i < (event.getPointerCount() > maxPointers ? maxPointers
            : event.getPointerCount()); i++) {
        down((int) event.getX(i), (int) event.getY(i));
    }
}
项目:mupdf-android-viewer-old    文件:MuPDFReaderView.java   
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
        float distanceY) {
    MuPDFView pageView = (MuPDFView)getDisplayedView();
    switch (mMode) {
    case Viewing:
        if (!tapDisabled)
            onDocMotion();

        return super.onScroll(e1, e2, distanceX, distanceY);
    case Selecting:
        if (pageView != null)
            pageView.selectText(e1.getX(), e1.getY(), e2.getX(), e2.getY());
        return true;
    default:
        return true;
    }
}
项目:android-project-gallery    文件:ViewPagerCompat.java   
/**
 * Start a fake drag of the pager.
 *
 * <p>A fake drag can be useful if you want to synchronize the motion of the ViewPager
 * with the touch scrolling of another view, while still letting the ViewPager
 * control the snapping motion and fling behavior. (e.g. parallax-scrolling tabs.)
 * Call {@link #fakeDragBy(float)} to simulate the actual drag motion. Call
 * {@link #endFakeDrag()} to complete the fake drag and fling as necessary.
 *
 * <p>During a fake drag the ViewPager will ignore all touch events. If a real drag
 * is already in progress, this method will return false.
 *
 * @return true if the fake drag began successfully, false if it could not be started.
 *
 * @see #fakeDragBy(float)
 * @see #endFakeDrag()
 */
public boolean beginFakeDrag() {
    if (mIsBeingDragged) {
        return false;
    }
    mFakeDragging = true;
    setScrollState(SCROLL_STATE_DRAGGING);
    mInitialMotionX = mLastMotionX = 0;
    if (mVelocityTracker == null) {
        mVelocityTracker = VelocityTracker.obtain();
    } else {
        mVelocityTracker.clear();
    }
    final long time = SystemClock.uptimeMillis();
    final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0);
    mVelocityTracker.addMovement(ev);
    ev.recycle();
    mFakeDragBeginTime = time;
    return true;
}
项目:TriangularCustomView    文件:IndicatorView.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    int eventAction = event.getAction();
    int x = (int)event.getX();
    int y = (int)event.getY();
    switch (eventAction) {
        case MotionEvent.ACTION_DOWN:
            midpt.x = ((x*noOfTabs)/getWidth())*((getWidth()/noOfTabs)) + ((getWidth()/noOfTabs)/2);
            triangle.reset();
            break;
        case MotionEvent.ACTION_UP:
            break;
        case MotionEvent.ACTION_MOVE:
            break;
    }
    invalidate();
    return true;
}
项目:WeiXinRecordedDemo    文件:TuyaView.java   
@Override
public boolean onTouchEvent(MotionEvent event) {

    if(isDrawMode) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                touchMode = true;
                touchDown(event);
                if(onTouchListener != null) onTouchListener.onDown();
                break;
            case MotionEvent.ACTION_MOVE:
                touchMove(event);
                break;
            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_UP:
                touchMode = false;
                savePathList.add(new Path(mPath));
                paintList.add(new Paint(mPaint));
                if(onTouchListener != null) onTouchListener.onUp();
                if(onLineChangeListener != null) onLineChangeListener.onDrawLine(savePathList.size());
                break;
        }
        invalidate();
    }
    return isDrawMode;
}
项目:DailyStudy    文件:DefaultOnDoubleTapListener.java   
@Override
public boolean onDoubleTap(MotionEvent ev) {
    if (photoViewAttacher == null)
        return false;

    try {
        float scale = photoViewAttacher.getScale();
        float x = ev.getX();
        float y = ev.getY();

        if (scale < photoViewAttacher.getMediumScale()) {
            photoViewAttacher.setScale(photoViewAttacher.getMediumScale(), x, y, true);
        } else if (scale >= photoViewAttacher.getMediumScale() && scale < photoViewAttacher.getMaximumScale()) {
            photoViewAttacher.setScale(photoViewAttacher.getMaximumScale(), x, y, true);
        } else {
            photoViewAttacher.setScale(photoViewAttacher.getMinimumScale(), x, y, true);
        }
    } catch (ArrayIndexOutOfBoundsException e) {
        // Can sometimes happen when getX() and getY() is called
    }

    return true;
}
项目:GitHub    文件:BaseViewPager.java   
/**
 * Start a fake drag of the pager.
 * <p/>
 * <p>A fake drag can be useful if you want to synchronize the motion of the ViewPager
 * with the touch scrolling of another view, while still letting the ViewPager
 * control the snapping motion and fling behavior. (e.g. parallax-scrolling tabs.)
 * Call {@link #fakeDragBy(float)} to simulate the actual drag motion. Call
 * {@link #endFakeDrag()} to complete the fake drag and fling as necessary.
 * <p/>
 * <p>During a fake drag the ViewPager will ignore all touch events. If a real drag
 * is already in progress, this method will return false.
 *
 * @return true if the fake drag began successfully, false if it could not be started.
 * @see #fakeDragBy(float)
 * @see #endFakeDrag()
 */
public boolean beginFakeDrag() {
    if (mIsBeingDragged) {
        return false;
    }
    mFakeDragging = true;
    setScrollState(SCROLL_STATE_DRAGGING);
    if (isHorizontalDirection()) {
        mInitialMotionX = mLastMotionX = 0;
    } else if (isVerticalDirection()) {
        mInitialMotionY = mLastMotionY = 0;
    }
    if (mVelocityTracker == null) {
        mVelocityTracker = VelocityTracker.obtain();
    } else {
        mVelocityTracker.clear();
    }
    final long time = SystemClock.uptimeMillis();
    final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0);
    mVelocityTracker.addMovement(ev);
    ev.recycle();
    mFakeDragBeginTime = time;
    return true;
}
项目:weex-uikit    文件:WXGestureTest.java   
@Test
public void testOnTouch() throws Exception {
  MotionEvent event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_DOWN,0,0,0);
  mGesture.onTouch(component.getHostView(),event);

  event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_MOVE,0,0,0);
  mGesture.onTouch(component.getHostView(),event);

  event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_UP,0,0,0);
  mGesture.onTouch(component.getHostView(),event);

  event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_POINTER_UP,0,0,0);
  mGesture.onTouch(component.getHostView(),event);

  event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_CANCEL,0,0,0);
  mGesture.onTouch(component.getHostView(),event);
}
项目:bannerview    文件:BannerView.java   
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    int action = ev.getAction();
    switch (action) {
    case MotionEvent.ACTION_DOWN:
        mIsResumed = false;
        update();
        break;
    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL:
        mIsResumed = true;
        update();
        break;
    }
    return super.dispatchTouchEvent(ev);
}
项目:LiuAGeAndroid    文件:CustomViewAbove.java   
private boolean isInIgnoredView(MotionEvent ev) {
    Rect rect = new Rect();
    for (View v : mIgnoredViews) {
        v.getHitRect(rect);
        if (rect.contains((int)ev.getX(), (int)ev.getY())) return true;
    }
    return false;
}
项目:sealtalk-android-master    文件:HorizontalListView.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    // Detect when the user lifts their finger off the screen after a touch
    if (event.getAction() == MotionEvent.ACTION_UP) {
        // If not flinging then we are idle now. The user just finished a finger scroll.
        if (mFlingTracker == null || mFlingTracker.isFinished()) {
            setCurrentScrollState(OnScrollStateChangedListener.ScrollState.SCROLL_STATE_IDLE);
        }

        // Allow the user to interact with parent views
        requestParentListViewToNotInterceptTouchEvents(false);

        releaseEdgeGlow();
    } else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
        unpressTouchedChild();
        releaseEdgeGlow();

        // Allow the user to interact with parent views
        requestParentListViewToNotInterceptTouchEvents(false);
    }

    return super.onTouchEvent(event);
}
项目:Mp3Player    文件:VerticalSeekBar.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (!isEnabled()) {
        return false;
    }

    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            Log.d("Action down","Progress ="+progress);
        case MotionEvent.ACTION_MOVE:
            Log.d("Action move","Progress ="+progress);
        case MotionEvent.ACTION_UP:
            if(event.getY()<=getHeight() && event.getY()>=0) {
                progress = getMax() - (int) (getMax() * event.getY() / getHeight());
                Log.d("Action up", "Progress =" + progress);
                Log.d("GetMax Return", " " + getMax() + " getHeight " + getHeight() + " getY " + event.getY());
                this.setProgress(getMax() - (int) (getMax() * event.getY() / getHeight()));
            }
            onSizeChanged(getWidth(), getHeight(), 0, 0);
            break;

        case MotionEvent.ACTION_CANCEL:
            break;
    }
    return true;
}
项目:LaunchEnr    文件:Workspace.java   
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    switch (ev.getAction() & MotionEvent.ACTION_MASK) {
    case MotionEvent.ACTION_DOWN:
        mXDown = ev.getX();
        mYDown = ev.getY();
        mTouchDownTime = System.currentTimeMillis();
        break;
    case MotionEvent.ACTION_POINTER_UP:
    case MotionEvent.ACTION_UP:
        if (mTouchState == TOUCH_STATE_REST) {
            final CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
            if (currentPage != null) {
                onWallpaperTap(ev);
            }
        }
    }
    return super.onInterceptTouchEvent(ev);
}
项目:PlusGram    文件:HsvColorValueView.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN)
    {
        down = true;
        return true;
    }
    if(event.getAction() == MotionEvent.ACTION_UP)
    {
        down = false;
        setSelectorPosition((int)event.getX() - getBackgroundOffset(), (int)event.getY() - getBackgroundOffset(), true);
        return true;
    }
    if(event.getAction() == MotionEvent.ACTION_MOVE && down)
    {
        setSelectorPosition((int)event.getX() - getBackgroundOffset(), (int)event.getY() - getBackgroundOffset(), false);
        return true;
    }
    return super.onTouchEvent(event);
}
项目:Auto.js    文件:PaintView.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    float x = event.getY();
    float y = event.getY();
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            onTouchDown(x, y);
            return true;
        case MotionEvent.ACTION_MOVE:
            onTouchMove(x, y);
            return true;
        case MotionEvent.ACTION_UP:
            onTouchUp(x, y);
            return true;
    }
    return super.onTouchEvent(event);
}
项目:SmartRecyclerView    文件:RecyclerItemClickListener.java   
public RecyclerItemClickListener(Context context, OnItemClickListener listener) {
    mListener = listener;
    mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            return true;
        }
    });
}
项目:ucar-weex-core    文件:WXFrameLayout.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
  boolean result = super.onTouchEvent(event);
  if (wxGesture != null) {
    result |= wxGesture.onTouch(this, event);
  }
  return result;
}
项目:GitHub    文件:VersionedGestureDetector.java   
@Override
float getActiveX(MotionEvent ev) {
    try {
        return ev.getX(mActivePointerIndex);
    } catch (Exception e) {
        return ev.getX();
    }
}
项目:Tribe    文件:PhotoViewAttacher.java   
public final boolean onSingleTapConfirmed(MotionEvent e) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (null != mPhotoTapListener) {
            final RectF displayRect = getDisplayRect();

            if (null != displayRect) {
                final float x = e.getX(), y = e.getY();

                // Check to see if the user tapped on the photo
                if (displayRect.contains(x, y)) {

                    float xResult = (x - displayRect.left) / displayRect.width();
                    float yResult = (y - displayRect.top) / displayRect.height();

                    mPhotoTapListener.onPhotoTap(imageView, xResult, yResult);
                    return true;
                }
            }
        }
        if (null != mViewTapListener) {
            mViewTapListener.onViewTap(imageView, e.getX(), e.getY());
        }
    }

    return false;
}
项目:airgram    文件:NumberPicker.java   
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
    final int action = event.getActionMasked();
    switch (action) {
        case MotionEvent.ACTION_CANCEL:
        case MotionEvent.ACTION_UP:
            removeAllCallbacks();
            break;
    }
    return super.dispatchTouchEvent(event);
}
项目:GitHub    文件:Banner.java   
@Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
//        Log.i(tag, ev.getAction() + "--" + isAutoPlay);
        if (isAutoPlay) {
            int action = ev.getAction();
            if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL
                    || action == MotionEvent.ACTION_OUTSIDE) {
                startAutoPlay();
            } else if (action == MotionEvent.ACTION_DOWN) {
                stopAutoPlay();
            }
        }
        return super.dispatchTouchEvent(ev);
    }
项目:TableView    文件:CellRecyclerViewItemClickListener.java   
@Override
protected boolean clickAction(RecyclerView view, MotionEvent e) {
    // Get interacted view from x,y coordinate.
    View childView = view.findChildViewUnder(e.getX(), e.getY());

    if (childView != null && m_jGestureDetector.onTouchEvent(e)) {
        // Find the view holder
        AbstractViewHolder holder = (AbstractViewHolder) m_jRecyclerView.getChildViewHolder
                (childView);

        // Get y position from adapter
        CellRowRecyclerViewAdapter adapter = (CellRowRecyclerViewAdapter) m_jRecyclerView
                .getAdapter();

        int nXPosition = holder.getAdapterPosition();
        int nYPosition = adapter.getYPosition();

        // Control to ignore selection color
        if (!m_iTableView.isIgnoreSelectionColors()) {
            m_iSelectionHandler.setSelectedCellPositions(holder, nXPosition, nYPosition);
        }

        if (getTableViewListener() != null) {
            // Call ITableView listener for item click
            getTableViewListener().onCellClicked(holder, nXPosition, nYPosition);
        }

        return true;
    }
    return false;
}
项目:android-study    文件:XfermodeView.java   
@Override public boolean onTouchEvent(MotionEvent event) {
  switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
      mPath.reset();
      mPath.moveTo(event.getX(), event.getY());
      break;
    case MotionEvent.ACTION_MOVE:
      mPath.lineTo(event.getX(), event.getY());
      break;
  }
  mCanvas.drawPath(mPath, mPaint);
  invalidate();
  return true;
}
项目:Android-Code-Demos    文件:OnRecyclerItemClickListener.java   
@Override
public boolean onSingleTapUp(MotionEvent e) {
    View child = mRecyclerView.findChildViewUnder(e.getX(), e.getY());
    if (null != child) {
        RecyclerView.ViewHolder vh = mRecyclerView.getChildViewHolder(child);
        onItemClick(vh);
    }
    return true;
}
项目:CXJPadProject    文件:OrcVinActivity.java   
public boolean onTouchEvent(MotionEvent event) {
    // int Action = event.getAction();
    //  float X = event.getX();
    //   float Y = event.getY();
    remind.setVisibility(View.INVISIBLE);
    vin_result.setVisibility(View.INVISIBLE);
    showbitmap.setVisibility(View.INVISIBLE);
    return true;
}
项目:GitHub    文件:ZoomableDraweeView.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
  int a = event.getActionMasked();
  FLog.v(getLogTag(), "onTouchEvent: %d, view %x, received", a, this.hashCode());
  if (mTapGestureDetector.onTouchEvent(event)) {
    FLog.v(
        getLogTag(),
        "onTouchEvent: %d, view %x, handled by tap gesture detector",
        a,
        this.hashCode());
    return true;
  }

  if (mZoomableController.onTouchEvent(event)) {
    FLog.v(
        getLogTag(),
        "onTouchEvent: %d, view %x, handled by zoomable controller",
        a,
        this.hashCode());
    if (!mAllowTouchInterceptionWhileZoomed && !mZoomableController.isIdentity()) {
      getParent().requestDisallowInterceptTouchEvent(true);
    }
    return true;
  }
  if (super.onTouchEvent(event)) {
    FLog.v(getLogTag(), "onTouchEvent: %d, view %x, handled by the super", a, this.hashCode());
    return true;
  }
  // None of our components reported that they handled the touch event. Upon returning false
  // from this method, our parent won't send us any more events for this gesture. Unfortunately,
  // some components may have started a delayed action, such as a long-press timer, and since we
  // won't receive an ACTION_UP that would cancel that timer, a false event may be triggered.
  // To prevent that we explicitly send one last cancel event when returning false.
  MotionEvent cancelEvent = MotionEvent.obtain(event);
  cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
  mTapGestureDetector.onTouchEvent(cancelEvent);
  mZoomableController.onTouchEvent(cancelEvent);
  cancelEvent.recycle();
  return false;
}
项目:android-open-source-project-analysis    文件:WindowActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_window);

    findViewById(R.id.btn_add_view).setOnClickListener(this);
    findViewById(R.id.btn_remove_view).setOnClickListener(this);

    windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    layoutParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT
            , WindowManager.LayoutParams.WRAP_CONTENT, 0, 0, PixelFormat.TRANSLUCENT);
    layoutParams.x = 100;
    layoutParams.y = 100;
    layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
    layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION;

    button = new Button(this);
    button.setText("Button");

    button.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
                case MotionEvent.ACTION_MOVE:
                    if (windowManager != null) {
                        layoutParams.x = (int) event.getRawX();
                        layoutParams.y = (int) event.getRawY();
                        windowManager.updateViewLayout(button, layoutParams);
                    }
                    break;
            }

            return false;
        }
    });
}
项目:CameraButton    文件:CameraButton.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    final int action = event.getActionMasked();
    switch (action) {
        case MotionEvent.ACTION_DOWN: {
            if (isEnabled() && isTouched(event)) {
                postExpandingMessageIfNeeded();
                makePaintColorsHovered(true);
                invalidate();
                dispatchStateChange(PRESSED);
                return true;
            }
        }

        case MotionEvent.ACTION_UP: {
            if (mCurrentState == START_EXPANDING || mCurrentState == EXPANDED) {
                if (mExpandAnimator != null) {
                    mExpandAnimator.cancel();
                }
                mCollapseAnimator = createCollapsingAnimator();
                mCollapseAnimator.start();

                makePaintColorsHovered(false);
                invalidate();
                return true;
            } else if (mCurrentState == PRESSED) {
                removeCallbacks(mExpandMessage);
                dispatchStateChange(DEFAULT);

                makePaintColorsHovered(false);
                invalidate();
                return true;
            }
        }
    }
    return false;
}
项目:social-app-android    文件:TouchImageView.java   
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    if (fling != null) {
        //
        // If a previous fling is still active, it should be cancelled so that two flings
        // are not run simultaenously.
        //
        fling.cancelFling();
    }
    fling = new Fling((int) velocityX, (int) velocityY);
    compatPostOnAnimation(fling);
    return super.onFling(e1, e2, velocityX, velocityY);
}
项目:boohee_v5.6    文件:ListPopupWindow.java   
private boolean onTouchObserved(MotionEvent srcEvent) {
    View src = this.mSrc;
    if (!src.isEnabled()) {
        return false;
    }
    switch (MotionEventCompat.getActionMasked(srcEvent)) {
        case 0:
            this.mActivePointerId = srcEvent.getPointerId(0);
            this.mWasLongPress = false;
            if (this.mDisallowIntercept == null) {
                this.mDisallowIntercept = new DisallowIntercept();
            }
            src.postDelayed(this.mDisallowIntercept, (long) this.mTapTimeout);
            if (this.mTriggerLongPress == null) {
                this.mTriggerLongPress = new TriggerLongPress();
            }
            src.postDelayed(this.mTriggerLongPress, (long) this.mLongPressTimeout);
            return false;
        case 1:
        case 3:
            clearCallbacks();
            return false;
        case 2:
            int activePointerIndex = srcEvent.findPointerIndex(this.mActivePointerId);
            if (activePointerIndex < 0 || pointInView(src, srcEvent.getX(activePointerIndex), srcEvent.getY(activePointerIndex), this.mScaledTouchSlop)) {
                return false;
            }
            clearCallbacks();
            src.getParent().requestDisallowInterceptTouchEvent(true);
            return true;
        default:
            return false;
    }
}
项目:HexagonRecyclerView    文件:PolygonItemView.java   
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        if (!isEventInPath(event)) {
            return false;
        }
    }
    return super.dispatchTouchEvent(event);
}
项目:boohee_v5.6    文件:DrawerLayout.java   
public boolean onInterceptTouchEvent(MotionEvent ev) {
    boolean interceptForDrag = this.mLeftDragger.shouldInterceptTouchEvent(ev) | this.mRightDragger.shouldInterceptTouchEvent(ev);
    boolean interceptForTap = false;
    switch (MotionEventCompat.getActionMasked(ev)) {
        case 0:
            float x = ev.getX();
            float y = ev.getY();
            this.mInitialMotionX = x;
            this.mInitialMotionY = y;
            if (this.mScrimOpacity > 0.0f) {
                View child = this.mLeftDragger.findTopChildUnder((int) x, (int) y);
                if (child != null && isContentView(child)) {
                    interceptForTap = true;
                }
            }
            this.mDisallowInterceptRequested = false;
            this.mChildrenCanceledTouch = false;
            break;
        case 1:
        case 3:
            closeDrawers(true);
            this.mDisallowInterceptRequested = false;
            this.mChildrenCanceledTouch = false;
            break;
        case 2:
            if (this.mLeftDragger.checkTouchSlop(3)) {
                this.mLeftCallback.removeCallbacks();
                this.mRightCallback.removeCallbacks();
                break;
            }
            break;
    }
    if (interceptForDrag || interceptForTap || hasPeekingDrawer() || this.mChildrenCanceledTouch) {
        return true;
    }
    return false;
}
项目:Mybilibili    文件:ConvenientBanner.java   
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {

    if (ev.getAction() == MotionEvent.ACTION_UP) {
        // 开始翻页
        if (canTurn)startTurning(autoTurningTime);
    } else if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        // 停止翻页
        if (canTurn)stopTurning();
    }
    return super.dispatchTouchEvent(ev);
}
项目:RLibrary    文件:StickLayout2.java   
private void onTouchDown(MotionEvent ev) {
    onTouchUp();

    downY = ev.getY() + 0.5f;
    lastX = downX = ev.getX() + 0.5f;
    mStartScrollY = getScrollY();

    mOverScroller.abortAnimation();

    isFling = false;

    if (isFloat()) {
        if (mFloatView.getMeasuredHeight() + floatTopOffset > downY) {
            inTopTouch = true;
        } else {
            inTopTouch = false;
        }
    } else {
        if (topHeight - mStartScrollY > downY) {
            inTopTouch = true;
        } else {
            inTopTouch = false;
        }
    }
    isFirst = true;

    initScrollTarget();
}
项目:boohee_v5.6    文件:TopicFragment.java   
public boolean isViewBeingDragged(MotionEvent event) {
    if (this.mPullRefreshListView == null) {
        return false;
    }
    return this.mAbsListViewDelegate.isViewBeingDragged(event, (AbsListView) this
            .mPullRefreshListView.getRefreshableView());
}
项目:ButterflyButton    文件:ButterdomButton.java   
/**
 * To click an option.
 *
 * @param event
 * @return
 */
@Override
public boolean onTouchEvent(MotionEvent event) {
    ButterflyOption selectedOption = model.getSelectedOption();

    switch (event.getAction() & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_DOWN:
            for (ButterflyOption option : model.getOptions()) {
                if (option != null) {
                    if (event.getX() >= option.getOffsetX() && event.getX() <= option.getPostsetX()
                            && event.getY() >= option.getOffsetY() && event.getY() <= option.getPostsetY()) {
                        isOnClick = true;
                        model.setSelectedOption(option);
                    }
                }
            }
            break;
        case MotionEvent.ACTION_CANCEL:
        case MotionEvent.ACTION_UP:
            if (isOnClick && selectedOption != null) {
                isOnClick = false;
                if (listener != null) listener.onOptionSelected(selectedOption.getPosition(), selectedOption.getIcon());
                if (model.isCloseOnSelect()) closeBubble();
                else invalidate();
            }
            break;
        case MotionEvent.ACTION_MOVE:
            if (isOnClick && (Math.abs(selectedOption.getX() - event.getX()) > CLICK_ACTION_THRESHHOLD)
                    || Math.abs(selectedOption.getY() - event.getY()) > CLICK_ACTION_THRESHHOLD) {
                isOnClick = false;
                model.setSelectedOption(null);
            }
            break;
    }
    return true;
}
项目:rongyunDemo    文件:ReadReceiptViewPager.java   
@Override
public boolean onInterceptTouchEvent(MotionEvent arg0) {
    if (unscrollable)
        return false;
    else
        return super.onInterceptTouchEvent(arg0);
}
项目:NeiHanDuanZiTV    文件:CustomGestureDetector.java   
public boolean onTouchEvent(MotionEvent ev) {
    try {
        mDetector.onTouchEvent(ev);
        return processTouchEvent(ev);
    } catch (IllegalArgumentException e) {
        // Fix for support lib bug, happening when onDestroy is called
        return true;
    }
}
项目:CCDownload    文件:ADMediaPlayActivity.java   
@Override
public boolean onDoubleTap(MotionEvent e) {
    if (lockView.isSelected()) {
        return true;
    }
    if (!isDisplay) {
        setLayoutVisibility(View.VISIBLE, true);
    }
    changePlayStatus();
    return super.onDoubleTap(e);
}
项目:AndroidOpen    文件:SwipeToRefreshLayout.java   
@Override
public boolean onTouchEvent(MotionEvent ev) {
    final int action = MotionEventCompat.getActionMasked(ev);
    if (isBackToStart && action == MotionEvent.ACTION_DOWN) isBackToStart = false;
    switch (mType) {
        case BOTTOM:
            if (!isEnabled() || isBackToStart || canChildScrollDown() || isRefreshing) {
                return false;
            }
            break;
        case TOP:
        default:
            if (!isEnabled() || isBackToStart || canChildScrollUp() || isRefreshing) {
                return false;
            }
            break;
    }
    switch (action) {
        case MotionEvent.ACTION_DOWN:
            mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
            isReady = false;
            break;
        case MotionEvent.ACTION_MOVE:
            if (TouchActionMove(ev)) return false;
            break;
        case MotionEventCompat.ACTION_POINTER_DOWN:
            final int index = MotionEventCompat.getActionIndex(ev);
            mActivePointerId = MotionEventCompat.getPointerId(ev, index);
            break;
        case MotionEventCompat.ACTION_POINTER_UP:
            onSecondaryPointerUp(ev);
            break;
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_CANCEL: {
            return TouchActionCancel(ev);
        }
    }
    return true;
}