List of usage examples for android.view ViewConfiguration getScaledMinimumFlingVelocity
public int getScaledMinimumFlingVelocity()
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 a v a 2s. 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);/* www. j a va2 s .c om*/ setClipToPadding(false); }
From source file:bw.com.yunifangstore.view.LazyViewPager.java
void initViewPager() { setWillNotDraw(false);/*from w ww .j a va2 s . co m*/ setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setFocusable(true); final Context context = getContext(); mScroller = new Scroller(context, sInterpolator); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mLeftEdge = new EdgeEffectCompat(context); mRightEdge = new EdgeEffectCompat(context); float density = context.getResources().getDisplayMetrics().density; mBaseLineFlingVelocity = 2500.0f * density; mFlingVelocityInfluence = 0.4f; }
From source file:freeflow.core.FreeFlowContainer.java
@Override protected void init(Context context) { viewpool = new ViewPool(); frames = new LinkedHashMap<Object, FreeFlowItem>(); ViewConfiguration configuration = ViewConfiguration.get(context); maxFlingVelocity = configuration.getScaledMaximumFlingVelocity(); minFlingVelocity = configuration.getScaledMinimumFlingVelocity(); overflingDistance = configuration.getScaledOverflingDistance(); overscrollDistance = configuration.getScaledOverscrollDistance(); touchSlop = configuration.getScaledTouchSlop(); scroller = new OverScroller(context); setEdgeEffectsEnabled(true);/*w w w. j a v a2 s . c o m*/ }
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 w w. ja v a 2s. co 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: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);//from w w w. j a v a 2 s.c om setClipToPadding(false); }
From source file:com.hxqc.mall.core.views.CustomScrollView.java
private void initScrollView() { mScroller = ScrollerCompat.create(getContext(), null); setFocusable(true);// w ww . j ava 2s.co m setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setWillNotDraw(false); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:net.simonvt.staggeredgridview.StaggeredGridView.java
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StaggeredGridView, defStyle, 0); colCount = a.getInt(R.styleable.StaggeredGridView_android_numColumns, 1); verticalItemMargin = a.getDimensionPixelSize(R.styleable.StaggeredGridView_verticalItemMargin, 0); horizontalItemMargin = a.getDimensionPixelSize(R.styleable.StaggeredGridView_horizontalItemMargin, 0); selector = a.getDrawable(R.styleable.StaggeredGridView_android_listChoiceBackgroundIndicator); if (selector != null) { selector.setCallback(this); }/*ww w . ja v a 2s. c o m*/ a.recycle(); final ViewConfiguration vc = ViewConfiguration.get(context); touchSlop = vc.getScaledTouchSlop(); maximumVelocity = vc.getScaledMaximumFlingVelocity(); flingVelocity = vc.getScaledMinimumFlingVelocity(); scroller = new Scroller(context); topEdge = new EdgeEffect(context); bottomEdge = new EdgeEffect(context); setWillNotDraw(false); setClipToPadding(false); setVerticalScrollBarEnabled(true); }
From source file:com.marshalchen.common.uimodule.freeflow.core.FreeFlowContainer.java
@Override protected void init(Context context) { viewpool = new ViewPool(); frames = new LinkedHashMap<Object, FreeFlowItem>(); ViewConfiguration configuration = ViewConfiguration.get(context); maxFlingVelocity = configuration.getScaledMaximumFlingVelocity(); minFlingVelocity = configuration.getScaledMinimumFlingVelocity(); overflingDistance = configuration.getScaledOverflingDistance(); /*overscrollDistance = configuration.getScaledOverscrollDistance();*/ touchSlop = configuration.getScaledTouchSlop(); scroller = new OverScroller(context); setEdgeEffectsEnabled(true);/*w w w . ja v a 2s. co m*/ }
From source file:com.apptentive.android.sdk.view.ApptentiveNestedScrollView.java
private void initScrollView() { //mScroller = new ScrollerCompat(getContext(), null); mScroller = ScrollerCompat.create(getContext(), null); setFocusable(true);/* w ww. java 2 s . co m*/ setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setWillNotDraw(false); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }