mScaledTouchSlop = ViewConfiguration.get(v.getContext()).getScaledTouchSlop(); mLongPressTimeout = ViewConfiguration.getLongPressTimeout(); mView = v;
mHasPerformedLongPress = false; if (mPendingCheckForLongPress != null) { mView.removeCallbacks(mPendingCheckForLongPress); mPendingCheckForLongPress = null; }
return mHasPerformedLongPress;
float x = ev.getX(); float y = ev.getY(); boolean xMoved = Math.abs(mDownX - x) > mScaledTouchSlop; boolean yMoved = Math.abs(mDownY - y) > mScaledTouchSlop; if (xMoved || yMoved) { cancelLongPress(); }
mDownX = ev.getX(); mDownY = ev.getY(); mHasPerformedLongPress = false; if (mPendingCheckForLongPress == null) { mPendingCheckForLongPress = new CheckForLongPress(); } mView.postDelayed(mPendingCheckForLongPress, mLongPressTimeout);