Java Code Examples for android.view.ViewConfiguration#getScaledDoubleTapSlop()

The following examples show how to use android.view.ViewConfiguration#getScaledDoubleTapSlop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GestureDetectorCompat.java    From letv with Apache License 2.0 6 votes vote down vote up
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    } else if (this.mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    } else {
        this.mIsLongpressEnabled = true;
        ViewConfiguration configuration = ViewConfiguration.get(context);
        int touchSlop = configuration.getScaledTouchSlop();
        int doubleTapSlop = configuration.getScaledDoubleTapSlop();
        this.mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
        this.mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
        this.mTouchSlopSquare = touchSlop * touchSlop;
        this.mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
    }
}
 
Example 2
Source File: GestureDetectorCompat.java    From Android-3DTouch-PeekView with MIT License 6 votes vote down vote up
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    }
    if (mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final int touchSlop = configuration.getScaledTouchSlop();
    final int doubleTapSlop = configuration.getScaledDoubleTapSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();

    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 3
Source File: GestureDetector.java    From AirFree-Client with GNU General Public License v3.0 6 votes vote down vote up
private void init(Context context, boolean ignoreMultitouch) {
    if (mListener == null) {
        throw new NullPointerException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;
    mIgnoreMultitouch = ignoreMultitouch;

    // Fallback to support pre-donuts releases
    int touchSlop, largeTouchSlop, doubleTapSlop;
    if (context == null) {
        //noinspection deprecation
        touchSlop = ViewConfiguration.getTouchSlop();
        largeTouchSlop = touchSlop + 2;
        doubleTapSlop = DOUBLE_TAP_SLOP;
    } else {
        final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
        final float density = metrics.density;
        final ViewConfiguration configuration = ViewConfiguration.get(context);
        touchSlop = configuration.getScaledTouchSlop();
        largeTouchSlop = (int) (density * LARGE_TOUCH_SLOP + 0.5f);
        doubleTapSlop = configuration.getScaledDoubleTapSlop();
    }
    mTouchSlopSquare = touchSlop * touchSlop;
    mLargeTouchSlopSquare = largeTouchSlop * largeTouchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 4
Source File: GestureDetectorCompat.java    From Slide with GNU General Public License v3.0 6 votes vote down vote up
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    }
    if (mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final int touchSlop = configuration.getScaledTouchSlop();
    final int doubleTapSlop = configuration.getScaledDoubleTapSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();

    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 5
Source File: GestureDetectorCompat.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    }
    if (mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final int touchSlop = configuration.getScaledTouchSlop();
    final int doubleTapSlop = configuration.getScaledDoubleTapSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();

    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 6
Source File: GestureDetectorCompat.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    }
    if (mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final int touchSlop = configuration.getScaledTouchSlop();
    final int doubleTapSlop = configuration.getScaledDoubleTapSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();

    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 7
Source File: GestureDetectorCompat.java    From android-recipes-app with Apache License 2.0 6 votes vote down vote up
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    }
    if (mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final int touchSlop = configuration.getScaledTouchSlop();
    final int doubleTapSlop = configuration.getScaledDoubleTapSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();

    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 8
Source File: GestureDetectorCompat.java    From V.FlyoutTest with MIT License 6 votes vote down vote up
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    }
    if (mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final int touchSlop = configuration.getScaledTouchSlop();
    final int doubleTapSlop = configuration.getScaledDoubleTapSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();

    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 9
Source File: GestureDetector2.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void init(Context context) {
    if (mListener == null) {
        throw new NullPointerException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    int touchSlop, doubleTapSlop, doubleTapTouchSlop;
    if (context == null) {
        touchSlop = ViewConfiguration.getTouchSlop();
        doubleTapTouchSlop = touchSlop;
        doubleTapSlop = 100;
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
    } else {
        final ViewConfiguration configuration = ViewConfiguration.get(context);
        touchSlop = configuration.getScaledTouchSlop();
        doubleTapTouchSlop = configuration.getScaledTouchSlop();
        doubleTapSlop = configuration.getScaledDoubleTapSlop();
        mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    }
    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 10
Source File: GestureDetectorCompat.java    From guideshow with MIT License 6 votes vote down vote up
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    }
    if (mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final int touchSlop = configuration.getScaledTouchSlop();
    final int doubleTapSlop = configuration.getScaledDoubleTapSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();

    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 11
Source File: GestureDetector2.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void init(Context context) {
    if (mListener == null) {
        throw new NullPointerException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    int touchSlop, doubleTapSlop, doubleTapTouchSlop;
    if (context == null) {
        touchSlop = ViewConfiguration.getTouchSlop();
        doubleTapTouchSlop = touchSlop;
        doubleTapSlop = 100;
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
    } else {
        final ViewConfiguration configuration = ViewConfiguration.get(context);
        touchSlop = configuration.getScaledTouchSlop();
        doubleTapTouchSlop = configuration.getScaledTouchSlop();
        doubleTapSlop = configuration.getScaledDoubleTapSlop();
        mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    }
    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
Example 12
Source File: GestureDetector.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void init(Context context) {
        if (mListener == null) {
            throw new NullPointerException("OnGestureListener must not be null");
        }
        mIsLongpressEnabled = true;

        // Fallback to support pre-donuts releases
        int touchSlop, doubleTapSlop, doubleTapTouchSlop;
/*  Commented out in Chromium for NDK compliance
        if (context == null) {
            //noinspection deprecation
            touchSlop = ViewConfiguration.getTouchSlop();
            doubleTapTouchSlop = touchSlop; // Hack rather than adding a hiden method for this
            doubleTapSlop = ViewConfiguration.getDoubleTapSlop();
            //noinspection deprecation
            mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
            mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
        } else */ {
            final ViewConfiguration configuration = ViewConfiguration.get(context);
            touchSlop = configuration.getScaledTouchSlop();
/*  Commented out in Chromium for NDK compliance and replaced with the following line.  Note that
 *  ViewConfiguration.TOUCH_SLOP has the same value as DOUBLE_TAP_TOUCH_SLOP in current Android, so
 *  this doesn't introduce a behavior difference in Android versions <= 4.2.
            doubleTapTouchSlop = configuration.getScaledDoubleTapTouchSlop();
*/
            doubleTapTouchSlop = touchSlop;
            doubleTapSlop = configuration.getScaledDoubleTapSlop();
            mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
            mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
        }
        mTouchSlopSquare = touchSlop * touchSlop;
        mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;
        mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
    }
 
Example 13
Source File: GestureDetector.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void init(Context context) {
        if (mListener == null) {
            throw new NullPointerException("OnGestureListener must not be null");
        }
        mIsLongpressEnabled = true;

        // Fallback to support pre-donuts releases
        int touchSlop, doubleTapSlop, doubleTapTouchSlop;
/*  Commented out in Chromium for NDK compliance
        if (context == null) {
            //noinspection deprecation
            touchSlop = ViewConfiguration.getTouchSlop();
            doubleTapTouchSlop = touchSlop; // Hack rather than adding a hiden method for this
            doubleTapSlop = ViewConfiguration.getDoubleTapSlop();
            //noinspection deprecation
            mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
            mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
        } else */ {
            final ViewConfiguration configuration = ViewConfiguration.get(context);
            touchSlop = configuration.getScaledTouchSlop();
/*  Commented out in Chromium for NDK compliance and replaced with the following line.  Note that
 *  ViewConfiguration.TOUCH_SLOP has the same value as DOUBLE_TAP_TOUCH_SLOP in current Android, so
 *  this doesn't introduce a behavior difference in Android versions <= 4.2.
            doubleTapTouchSlop = configuration.getScaledDoubleTapTouchSlop();
*/
            doubleTapTouchSlop = touchSlop;
            doubleTapSlop = configuration.getScaledDoubleTapSlop();
            mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
            mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
        }
        mTouchSlopSquare = touchSlop * touchSlop;
        mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;
        mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
    }