当前位置: 首页>>代码示例>>Java>>正文


Java MotionEvent.INVALID_POINTER_ID属性代码示例

本文整理汇总了Java中android.view.MotionEvent.INVALID_POINTER_ID属性的典型用法代码示例。如果您正苦于以下问题:Java MotionEvent.INVALID_POINTER_ID属性的具体用法?Java MotionEvent.INVALID_POINTER_ID怎么用?Java MotionEvent.INVALID_POINTER_ID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.MotionEvent的用法示例。


在下文中一共展示了MotionEvent.INVALID_POINTER_ID属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resetView

/**
 * Reset the view to the top-left corner of the virtual workspace (with a small margin), and
 * reset zoom to unit scale.
 * <p/>
 * This is called when the "reset view" button is clicked, or when
 * {@link #mResetViewPending} is set.
 */
public void resetView() {
    // Reset scrolling state.
    mPanningPointerId = MotionEvent.INVALID_POINTER_ID;
    mPanningStart.set(0,0);
    mOriginalScrollX = 0;
    mOriginalScrollY = 0;

    updateScaleStep(INIT_ZOOM_SCALES_INDEX);

    final Rect blocksBoundingBox = getViewScaledBlockBounds();
    final boolean useRtl = mWorkspaceView.getWorkspaceHelper().useRtl();
    if (mScrollable) {
        final int margin = mGridRenderer.getGridSpacing() / 2;
        final int scrollToY = blocksBoundingBox.top - margin;
        if (useRtl) {
            scrollTo(blocksBoundingBox.right - getMeasuredWidth() + margin, scrollToY);
        } else {
            scrollTo(blocksBoundingBox.left - margin, scrollToY);
        }
    } else {
        // Reset top leading corner to 0,0 when
        scrollTo(useRtl ? -getMeasuredWidth() : 0, 0);
    }
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:31,代码来源:VirtualWorkspaceView.java

示例2: reset

/**
 * Resets the component to the initial state.
 */
public void reset() {
  mGestureInProgress = false;
  mPointerCount = 0;
  for (int i = 0; i < MAX_POINTERS; i++) {
    mId[i] = MotionEvent.INVALID_POINTER_ID;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:MultiPointerGestureDetector.java

示例3: updatePointersOnTap

private void updatePointersOnTap(MotionEvent event) {
  mPointerCount = 0;
  for (int i = 0; i < MAX_POINTERS; i++) {
    int index = getPressedPointerIndex(event, i);
    if (index == -1) {
      mId[i] = MotionEvent.INVALID_POINTER_ID;
    } else {
      mId[i] = event.getPointerId(index);
      mCurrentX[i] = mStartX[i] = event.getX(index);
      mCurrentY[i] = mStartY[i] = event.getY(index);
      mPointerCount++;
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:MultiPointerGestureDetector.java

示例4: resetTouch

private void resetTouch() {
    mActivePointerId = MotionEvent.INVALID_POINTER_ID;
    mIsDragging = false;
    mOpenOnClick = false;
    mInitialTouchX = mInitialTouchY = mLastTouchY = 0;
    mVelocityTracker.clear();
}
 
开发者ID:RikkaW,项目名称:Bridge,代码行数:7,代码来源:ResolverDrawerLayout.java

示例5: reset

/**
 * Resets the component to the initial state.
 */
public void reset() {
    mGestureInProgress = false;
    mPointerCount = 0;
    for (int i = 0; i < MAX_POINTERS; i++) {
        mId[i] = MotionEvent.INVALID_POINTER_ID;
    }
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:10,代码来源:MultiPointerGestureDetector.java

示例6: updatePointersOnTap

private void updatePointersOnTap(MotionEvent event) {
    mPointerCount = 0;
    for (int i = 0; i < MAX_POINTERS; i++) {
        int index = getPressedPointerIndex(event, i);
        if (index == -1) {
            mId[i] = MotionEvent.INVALID_POINTER_ID;
        } else {
            mId[i] = event.getPointerId(index);
            mCurrentX[i] = mStartX[i] = event.getX(index);
            mCurrentY[i] = mStartY[i] = event.getY(index);
            mPointerCount++;
        }
    }
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:14,代码来源:MultiPointerGestureDetector.java

示例7: reset

/**
 * Resets the component to the initial state.
 */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void reset() {
  mGestureInProgress = false;
  mCount = 0;
  for (int i = 0; i < MAX_POINTERS; i++) {
    mId[i] = Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH ?
            -1 : MotionEvent.INVALID_POINTER_ID;
  }
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:12,代码来源:MultiPointerGestureDetector.java

示例8: reset

/**
 * Resets the component to the initial state.
 */
public void reset() {
  mGestureInProgress = false;
  mCount = 0;
  for (int i = 0; i < MAX_POINTERS; i++) {
    mId[i] = MotionEvent.INVALID_POINTER_ID;
  }
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:10,代码来源:MultiPointerGestureDetector.java

示例9: findIndex

private int findIndex(int pointerId) {
    for (int i = 0; i < mDownPointers; i++) {
        if (mDownPointerId[i] == pointerId) {
            return i;
        }
    }
    if (mDownPointers == MAX_TRACKED_POINTERS || pointerId == MotionEvent.INVALID_POINTER_ID) {
        return UNTRACKED_POINTER;
    }
    mDownPointerId[mDownPointers++] = pointerId;
    return mDownPointers - 1;
}
 
开发者ID:EggUncle,项目名称:XposedNavigationBar,代码行数:12,代码来源:GesturesListener.java

示例10: handlerInterceptTouchEvent

private boolean handlerInterceptTouchEvent(MotionEvent ev, boolean isHead) {
    final int action = ev.getActionMasked();
    boolean mIsBeingDragged = false;
    switch (action) {
        case MotionEvent.ACTION_DOWN:
            mActivePointerId = ev.getPointerId(0);
            mIsBeingDragged = false;
            final float initialMotionY = ev.getY(mActivePointerId);
            if (initialMotionY == -1) {
                return false;
            }
            mInitialMotionX = ev.getX(mActivePointerId);
            mInitialMotionY = initialMotionY;
            break;
        case MotionEvent.ACTION_MOVE:
            if (mActivePointerId == MotionEvent.INVALID_POINTER_ID) {
                return false;
            }
            final int index = ev.findPointerIndex(mActivePointerId);
            if (index < 0) {
                return false;
            }
            final float y = ev.getY(mActivePointerId);
            final float x = ev.getX(mActivePointerId);

            if (y == -1) {
                return false;
            }
            float yDiff = y - mInitialMotionY;
            float xDiff = x - mInitialMotionX;
            if (!isHead)
                yDiff = -yDiff;
            if (yDiff > touchSlop && Math.abs(yDiff) > Math.abs(xDiff)) {
                mInitialMotionY = y;//触发拖曳 刷新下Y值
                mIsBeingDragged = true;
            }
            break;
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_CANCEL:
            mIsBeingDragged = false;
            mActivePointerId = MotionEvent.INVALID_POINTER_ID;
            break;
        case MotionEvent.ACTION_POINTER_UP://兼容多个手指
            final int pointerIndex = ev.getActionIndex();
            final int pointerId = ev.getPointerId(pointerIndex);
            if (pointerId == mActivePointerId) {
                final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
                mActivePointerId = ev.getPointerId(newPointerIndex);
            }
            break;
    }
    return mIsBeingDragged;
}
 
开发者ID:tohodog,项目名称:QSRefreshLayout,代码行数:53,代码来源:QSBaseRefreshLayout.java


注:本文中的android.view.MotionEvent.INVALID_POINTER_ID属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。