List of usage examples for android.view ViewConfiguration getScaledTouchSlop
public int getScaledTouchSlop()
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.// www . java 2 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./*from w ww . j a v a2 s . com*/ * * @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.//from ww w .j a v a 2 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) { 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); }
From source file:com.idrv.coach.utils.helper.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 ww w . j ava 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); }
From source file:com.njkj.yulian.ui.gui.picsel.StaggeredGridView.java
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = ScrollerCompat.create(context); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false);// w w w .j a v a2 s. co m setClipToPadding(false); }
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. co 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:com.microhealthllc.Slide.MultiShrinkScroller.java
/** * Create a new instance of MultiShrinkScroller. * * @param context//w w w .j ava 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); 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.ecom.consumer.customviews.HorizontalListView.java
private void initScroll() { final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); }
From source file:pl.skyman.android.view.SuperStaggeredGridView.java
public SuperStaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = ScrollerCompat.create(context); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false);/* ww w .j av a2s .c o m*/ setClipToPadding(false); }
From source file:android.improving.utils.views.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 ww.j a v a 2 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) { 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); }