/** * Constructor. */ public RecyclerViewSwipeManager() { mInternalUseOnItemTouchListener = new RecyclerView.OnItemTouchListener() { @Override public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { return RecyclerViewSwipeManager.this.onInterceptTouchEvent(rv, e); } @Override public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { RecyclerViewSwipeManager.this.onTouchEvent(rv, e); } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { RecyclerViewSwipeManager.this.onRequestDisallowInterceptTouchEvent(disallowIntercept); } }; mVelocityTracker = VelocityTracker.obtain(); mLongPressTimeout = ViewConfiguration.getLongPressTimeout(); }
public ForwardingListener(View src) { mSrc = src; mScaledTouchSlop = ViewConfiguration.get(src.getContext()).getScaledTouchSlop(); mTapTimeout = ViewConfiguration.getTapTimeout(); // Use a medium-press timeout. Halfway between tap and long-press. mLongPressTimeout = (mTapTimeout + ViewConfiguration.getLongPressTimeout()) / 2; }
private void registerForLongClick(LongClickableSpan longClickableSpan, View view) { mLongClickRunnable = new LongClickRunnable(longClickableSpan, view); mLongClickHandler.postDelayed(mLongClickRunnable, ViewConfiguration.getLongPressTimeout()); }
mLongPressTimeout = ViewConfiguration.getLongPressTimeout();
sleeper.sleep(time); else sleeper.sleep((int)(ViewConfiguration.getLongPressTimeout() * 2.5f));
> ViewConfiguration.getLongPressTimeout()) { v.setPressed(false);
@Override public void run() { if (mTouchMode == TOUCH_MODE_DOWN) { mTouchMode = TOUCH_MODE_TAP; final View header = getHeaderAt(mMotionHeaderPosition); if (header != null && !mHeaderChildBeingPressed) { if (!mDataChanged) { header.setPressed(true); setPressed(true); refreshDrawableState(); final int longPressTimeout = ViewConfiguration.getLongPressTimeout(); final boolean longClickable = isLongClickable(); if (longClickable) { if (mPendingCheckForLongPress == null) { mPendingCheckForLongPress = new CheckForHeaderLongPress(); } mPendingCheckForLongPress.rememberWindowAttachCount(); postDelayed(mPendingCheckForLongPress, longPressTimeout); } else { mTouchMode = TOUCH_MODE_DONE_WAITING; } } else { mTouchMode = TOUCH_MODE_DONE_WAITING; } } } } }
setPressed(true); final int longPressTimeout = ViewConfiguration.getLongPressTimeout(); final boolean longClickable = isLongClickable();
assertEquals(12, ViewConfiguration.getFadingEdgeLength()); assertEquals(125, ViewConfiguration.getPressedStateDuration()); assertEquals(500, ViewConfiguration.getLongPressTimeout()); assertEquals(115, ViewConfiguration.getTapTimeout()); assertEquals(500, ViewConfiguration.getJumpTapTimeout());
private void sendCancelEvent() { if (!mHasSendCancelEvent) { LogUtils.d("sendCancelEvent"); setRefreshTime(); mHasSendCancelEvent = true; mHasSendDownEvent = false; MotionEvent last = mLastMoveEvent; MotionEvent e = MotionEvent.obtain( last.getDownTime(), last.getEventTime() + ViewConfiguration.getLongPressTimeout(), MotionEvent.ACTION_CANCEL, last.getX(), last.getY(), last.getMetaState()); dispatchTouchEventSupper(e); } }
@Override public void run() { if (mTouchMode == TOUCH_MODE_DOWN) { mTouchMode = TOUCH_MODE_TAP; final View header = getHeaderAt(mMotionHeaderPosition); if (header != null && !header.hasFocusable()) { if (!mDataChanged) { header.setPressed(true); setPressed(true); refreshDrawableState(); final int longPressTimeout = ViewConfiguration.getLongPressTimeout(); final boolean longClickable = isLongClickable(); if (longClickable) { if (mPendingCheckForLongPress == null) { mPendingCheckForLongPress = new CheckForHeaderLongPress(); } mPendingCheckForLongPress.rememberWindowAttachCount(); postDelayed(mPendingCheckForLongPress, longPressTimeout); } else { mTouchMode = TOUCH_MODE_DONE_WAITING; } } else { mTouchMode = TOUCH_MODE_DONE_WAITING; } } } } }
/** * Posts a command for changing the current value by one. * * @param increment Whether to increment or decrement the value. */ private void postChangeCurrentByOneFromLongPress(boolean increment) { postChangeCurrentByOneFromLongPress(increment, ViewConfiguration.getLongPressTimeout()); }
private void checkForLongClick(MyURLSpan[] spans, View widget) { mHasPerformedLongPress = false; mPendingCheckForLongPress = new CheckForLongPress(spans, widget); handler.postDelayed(mPendingCheckForLongPress, ViewConfiguration.getLongPressTimeout()); }
private void checkForLongClick(MyURLSpan[] spans, View widget) { mHasPerformedLongPress = false; mPendingCheckForLongPress = new CheckForLongPress(spans, widget); handler.postDelayed(mPendingCheckForLongPress, ViewConfiguration.getLongPressTimeout()); }
SwipeHelper(int swipeDirection, Callback callback, Context context) { mCallback = callback; mHandler = new Handler(); mSwipeDirection = swipeDirection; mVelocityTracker = VelocityTracker.obtain(); mDensityScale = context.getResources().getDisplayMetrics().density; mPagingTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop(); mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); // extra long-press! mFalsingThreshold = context.getResources().getDimensionPixelSize( R.dimen.swipe_helper_falsing_threshold); mFlingAnimationUtils = new FlingAnimationUtils(context, getMaxEscapeAnimDuration() / 1000f); }
private void postLongClickRunnable() { myLongClickPerformed = false; myPendingPress = false; if (myPendingLongClickRunnable == null) { myPendingLongClickRunnable = new LongClickRunnable(); } postDelayed(myPendingLongClickRunnable, 2 * ViewConfiguration.getLongPressTimeout()); }
private void checkForLongClick() { hasPerformedLongPress = false; if (null == checkForLongPress) checkForLongPress = new CheckForLongPress(); postDelayed(checkForLongPress, ViewConfiguration.getLongPressTimeout()); }
protected void startLongClickTransition(final View clickedChild) { if (clickedChild != null && mItemTransitionDrawable == null) { if (clickedChild.getBackground().getCurrent() instanceof TransitionDrawable) { mItemTransitionDrawable = (TransitionDrawable) clickedChild.getBackground().getCurrent(); mItemTransitionDrawable.startTransition(ViewConfiguration.getLongPressTimeout()); } } }
private void sendCancelEvent() { if (mLastMoveEvent == null) { return; } MotionEvent last = mLastMoveEvent; MotionEvent e = MotionEvent.obtain(last.getDownTime(), last.getEventTime() + ViewConfiguration.getLongPressTimeout(), MotionEvent.ACTION_CANCEL, last.getX(), last.getY(), last.getMetaState()); cp.dispatchTouchEventSuper(e); }
protected void sendCancelEvent() { // The ScrollJob will update position and lead to send cancel event when mLastMoveEvent is null. if (mLastMoveEvent == null) { return; } MotionEvent last = mLastMoveEvent; MotionEvent e = MotionEvent.obtain(last.getDownTime(), last.getEventTime() + ViewConfiguration.getLongPressTimeout(), MotionEvent.ACTION_CANCEL, last.getX(), last.getY(), last.getMetaState()); defaultDispatchTouchEvent(e); }