Example usage for android.view ViewConfiguration getScaledMinimumFlingVelocity

List of usage examples for android.view ViewConfiguration getScaledMinimumFlingVelocity

Introduction

In this page you can find the example usage for android.view ViewConfiguration getScaledMinimumFlingVelocity.

Prototype

public int getScaledMinimumFlingVelocity() 

Source Link

Usage

From source file:com.gather.android.widget.swipeback.ViewDragHelper.java

/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.// w w w .ja  v a  2 s  .  c o  m
 * 
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    //        mScroller = ScrollerCompat.create(context, sInterpolator);
    mScroller = new Scroller(context, sInterpolator);
}

From source file:com.klinker.android.sliding.MultiShrinkScroller.java

/**
 * Create a new instance of MultiShrinkScroller.
 * @param context/*from w  w  w.ja  v a  2 s.c o m*/
 * @param attrs
 * @param defStyleAttr
 */
public MultiShrinkScroller(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    setFocusable(false);
    setWillNotDraw(false);

    edgeGlowBottom = new EdgeEffect(context);
    edgeGlowTop = new EdgeEffect(context);
    scroller = new Scroller(context, INTERPOLATOR);
    touchSlop = configuration.getScaledTouchSlop();
    minimumVelocity = configuration.getScaledMinimumFlingVelocity();
    maximumVelocity = configuration.getScaledMaximumFlingVelocity();
    transparentStartHeight = (int) getResources().getDimension(R.dimen.sliding_starting_empty_height);
    toolbarElevation = getResources().getDimension(R.dimen.sliding_toolbar_elevation);
    isTwoPanel = getResources().getBoolean(R.bool.sliding_two_panel);
    maximumTitleMargin = (int) getResources().getDimension(R.dimen.sliding_title_initial_margin);

    dismissDistanceOnScroll = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_scroll);
    dismissDistanceOnRelease = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_release);
    snapToTopSlopHeight = (int) getResources().getDimension(R.dimen.sliding_snap_to_top_slop_height);

    final TypedValue photoRatio = new TypedValue();
    getResources().getValue(R.dimen.sliding_landscape_photo_ratio, photoRatio, true);
    landscapePhotoRatio = photoRatio.getFloat();

    final TypedArray attributeArray = context
            .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize });
    actionBarSize = attributeArray.getDimensionPixelSize(0, 0);
    minimumHeaderHeight = actionBarSize;
    attributeArray.recycle();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textSizePathInterpolator = new PathInterpolator(X1, Y1, X2, Y2);
    } else {
        textSizePathInterpolator = null;
    }
}

From source file:cn.xm.xmvideoplayer.widget.swipebacklayout.ViewDragHelper.java

/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.//w  ww . j a  v  a 2s. c om
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}

From source file:com.microhealthllc.Slide.MultiShrinkScroller.java

/**
 * Create a new instance of MultiShrinkScroller.
 *
 * @param context//from   w  w w  .  j a v a  2s  .c  o m
 * @param attrs
 * @param defStyleAttr
 */
public MultiShrinkScroller(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    setFocusable(false);
    setWillNotDraw(false);

    edgeGlowBottom = new EdgeEffect(context);
    edgeGlowTop = new EdgeEffect(context);
    scroller = new Scroller(context, INTERPOLATOR);
    touchSlop = configuration.getScaledTouchSlop();
    minimumVelocity = configuration.getScaledMinimumFlingVelocity();
    maximumVelocity = configuration.getScaledMaximumFlingVelocity();
    transparentStartHeight = (int) getResources().getDimension(R.dimen.sliding_starting_empty_height);
    toolbarElevation = getResources().getDimension(R.dimen.sliding_toolbar_elevation);
    isTwoPanel = getResources().getBoolean(R.bool.sliding_two_panel);
    paddedLayout = getResources().getBoolean(R.bool.padded_layout);
    maximumTitleMargin = (int) getResources().getDimension(R.dimen.sliding_title_initial_margin);

    dismissDistanceOnScroll = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_scroll);
    dismissDistanceOnRelease = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_release);
    snapToTopSlopHeight = (int) getResources().getDimension(R.dimen.sliding_snap_to_top_slop_height);

    final TypedValue photoRatio = new TypedValue();
    getResources().getValue(R.dimen.sliding_landscape_photo_ratio, photoRatio, true);
    landscapePhotoRatio = photoRatio.getFloat();

    final TypedArray attributeArray = context
            .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize });
    actionBarSize = attributeArray.getDimensionPixelSize(0, 0);
    minimumHeaderHeight = actionBarSize;
    attributeArray.recycle();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textSizePathInterpolator = new PathInterpolator(X1, Y1, X2, Y2);
    } else {
        textSizePathInterpolator = null;
    }
}

From source file:com.ysy.classpower_utils.swipe_back.OwnViewDragHelper.java

/**
 * Apps should use OwnViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.//from   w  w w.  ja  v  a 2s. c  om
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private OwnViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}

From source file:com.gbq.library.widget.swipeback.SwipeViewDragHelper.java

/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.//  w w  w  . ja v a  2  s  . co  m
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private SwipeViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}

From source file:me.imid.swipebacklayout.lib.ViewDragHelper2.java

/**
 * Apps should use ViewDragHelper2.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.//from ww w  . j a  v  a  2  s . co  m
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper2(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}

From source file:cn.zmdx.kaka.locker.widget.ViewDragHelper.java

/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions./*from w  ww  . ja  va2 s  .  c om*/
 * 
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb, Interpolator interpolator) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    if (interpolator != null) {
        mInterpolator = interpolator;
    }
    mScroller = ScrollerCompat.create(context, mInterpolator);
}

From source file:com.example.administrator.demo.activity.sbackapp.SwipeBackViewDragHelper.java

/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.//  w w  w .  j ava2  s.  c  o m
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private SwipeBackViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}

From source file:com.android.dialer.widget.ViewDragHelper.java

/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions./*w ww  . jav  a 2s  .  c  om*/
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = new Scroller(context);
}