FileDocCategorySizeDatePackage
CheckLongPressHelper.javaAPI DocAndroid 5.1 API2642Thu Mar 12 22:22:42 GMT 2015com.android.keyguard

CheckLongPressHelper

public class CheckLongPressHelper extends Object

Fields Summary
private android.view.View
mView
private boolean
mHasPerformedLongPress
private CheckForLongPress
mPendingCheckForLongPress
private float
mDownX
private float
mDownY
private int
mLongPressTimeout
private int
mScaledTouchSlop
Constructors Summary
public CheckLongPressHelper(android.view.View v)

        mScaledTouchSlop = ViewConfiguration.get(v.getContext()).getScaledTouchSlop();
        mLongPressTimeout = ViewConfiguration.getLongPressTimeout();
        mView = v;
    
Methods Summary
public voidcancelLongPress()

        mHasPerformedLongPress = false;
        if (mPendingCheckForLongPress != null) {
            mView.removeCallbacks(mPendingCheckForLongPress);
            mPendingCheckForLongPress = null;
        }
    
public booleanhasPerformedLongPress()

        return mHasPerformedLongPress;
    
public voidonMove(android.view.MotionEvent ev)

        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();
        }
    
public voidpostCheckForLongPress(android.view.MotionEvent ev)

        mDownX = ev.getX();
        mDownY = ev.getY();
        mHasPerformedLongPress = false;

        if (mPendingCheckForLongPress == null) {
            mPendingCheckForLongPress = new CheckForLongPress();
        }
        mView.postDelayed(mPendingCheckForLongPress, mLongPressTimeout);