List of usage examples for android.widget OverScroller OverScroller
public OverScroller(Context context, Interpolator interpolator)
From source file:am.widget.multifunctionalrecyclerview.layoutmanager.PagingOverScroller.java
PagingOverScroller(@NonNull Context context) {
mScroller = new OverScroller(context, PublicRecyclerView.getScrollerInterpolator());
}
From source file:ch.tutti.android.bottomsheet.ResolverDrawerLayout.java
public ResolverDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ResolverDrawerLayout, defStyleAttr, 0);/*from ww w . ja v a 2 s. c o m*/ mMaxWidth = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_android_maxWidth, -1); mMaxCollapsedHeight = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_maxCollapsedHeight, 0); mMaxCollapsedHeightSmall = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_maxCollapsedHeightSmall, mMaxCollapsedHeight); a.recycle(); mScroller = new OverScroller(context, AnimationUtils.loadInterpolator(context, android.R.interpolator.decelerate_quint)); mVelocityTracker = VelocityTracker.obtain(); final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); }
From source file:jackson.com.slidingmenulib.MyViewDragHelper.java
public void setInterpolator(ViewGroup forParent, Interpolator interpolator) { sInterpolator = interpolator; mScroller = new OverScroller(forParent.getContext(), sInterpolator); }
From source file:com.seek.ruler.SimpleRulerView.java
/** * set default/* w w w .j ava2s .c om*/ * * @param attrs */ private void init(AttributeSet attrs) { DisplayMetrics dm = getResources().getDisplayMetrics(); mIntervalDis = dm.density * 5; mRulerLineWidth = dm.density * 2; mTextSize = dm.scaledDensity * 14; TypedArray typedArray = attrs == null ? null : getContext().obtainStyledAttributes(attrs, R.styleable.simpleRulerView); if (typedArray != null) { mHighlightColor = typedArray.getColor(R.styleable.simpleRulerView_highlightColor, mHighlightColor); mTextColor = typedArray.getColor(R.styleable.simpleRulerView_textColor, mTextColor); mRulerColor = typedArray.getColor(R.styleable.simpleRulerView_rulerColor, mRulerColor); mIntervalValue = typedArray.getFloat(R.styleable.simpleRulerView_intervalValue, mIntervalValue); mMaxValue = typedArray.getFloat(R.styleable.simpleRulerView_maxValue, mMaxValue); mMinValue = typedArray.getFloat(R.styleable.simpleRulerView_minValue, mMinValue); mTextSize = typedArray.getDimension(R.styleable.simpleRulerView_textSize, mTextSize); mRulerLineWidth = typedArray.getDimension(R.styleable.simpleRulerView_rulerLineWidth, mRulerLineWidth); mIntervalDis = typedArray.getDimension(R.styleable.simpleRulerView_intervalDistance, mIntervalDis); retainLength = typedArray.getInteger(R.styleable.simpleRulerView_retainLength, 0); } calculateTotal(); mRulerPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mRulerPaint.setStrokeWidth(mRulerLineWidth); mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mTextPaint.setTextAlign(Paint.Align.CENTER); mTextPaint.setTextSize(mTextSize); mGestureDetectorCompat = new GestureDetectorCompat(getContext(), this); mScroller = new OverScroller(getContext(), new DecelerateInterpolator()); setSelectedIndex(0); }
From source file:jackson.com.slidingmenulib.MyViewDragHelper.java
/** * Apps should use ViewDragHelper.create() to get a new instance. * This will allow VDH to use internal compatibility implementations for different * platform versions./* ww w. java 2 s . com*/ * * @param context Context to initialize config-dependent params from * @param forParent Parent view to monitor */ private MyViewDragHelper(Context context, ViewGroup forParent, ViewDragHelper.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 OverScroller(context, sInterpolator); }