List of usage examples for android.support.v4.widget ScrollerCompat create
public static ScrollerCompat create(Context context)
From source file:org.mariotaku.twidere.view.HeaderDrawerLayout.java
public HeaderDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HeaderDrawerLayout); final int headerLayoutId = a.getResourceId(R.styleable.HeaderDrawerLayout_hdl_headerLayout, 0); final int contentLayoutId = a.getResourceId(R.styleable.HeaderDrawerLayout_hdl_contentLayout, 0); addView(mContainer = new InternalContainer(this, context, headerLayoutId, contentLayoutId), LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); a.recycle();/*w w w. jav a 2 s . c om*/ mDragHelper = ViewDragHelper.create(this, mDragCallback = new DragCallback(this)); mGestureDetector = new GestureDetector(context, new GestureListener(this)); mScroller = ScrollerCompat.create(context); }
From source file:de.vanita5.twittnuker.view.HeaderDrawerLayout.java
public HeaderDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HeaderDrawerLayout); final int headerLayoutId = a.getResourceId(R.styleable.HeaderDrawerLayout_headerLayout, 0); final int contentLayoutId = a.getResourceId(R.styleable.HeaderDrawerLayout_contentLayout, 0); addView(mContainer = new InternalContainer(this, context, headerLayoutId, contentLayoutId), LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); a.recycle();/* ww w . j a v a 2 s. co m*/ mDragHelper = ViewDragHelper.create(this, mDragCallback = new DragCallback(this)); mGestureDetector = new GestureDetector(context, new GestureListener(this)); mScroller = ScrollerCompat.create(context); }
From source file:com.gu.swiperefresh.SwipeRefreshPlush.java
public SwipeRefreshPlush(Context context, AttributeSet attrs) { super(context, attrs); mLoadViewController = new LoadViewController(context, this); mRefreshController = new RefreshViewController(context, this); // mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mNestedScrollingChildHelper = new NestedScrollingChildHelper(this); mNestedScrollingParentHelper = new NestedScrollingParentHelper(this); mScroller = ScrollerCompat.create(getContext()); createProgressView();/* www . j av a 2 s .c o m*/ ViewCompat.setChildrenDrawingOrderEnabled(this, true); }
From source file:android.support.v7.internal.widget.ActionBarOverlayLayout.java
private void init(Context context) { TypedArray ta = getContext().getTheme().obtainStyledAttributes(ATTRS); mActionBarHeight = ta.getDimensionPixelSize(0, 0); mWindowContentOverlay = ta.getDrawable(1); setWillNotDraw(mWindowContentOverlay == null); ta.recycle();/*from w w w.j a v a 2 s . com*/ mIgnoreWindowContentOverlay = context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.KITKAT; mFlingEstimator = ScrollerCompat.create(context); }
From source file:android.support.design.widget.HeaderBehavior.java
final boolean fling(CoordinatorLayout coordinatorLayout, V layout, int minOffset, int maxOffset, float velocityY) { if (mFlingRunnable != null) { layout.removeCallbacks(mFlingRunnable); mFlingRunnable = null;//from w ww . j a v a2s.c om } if (mScroller == null) { mScroller = ScrollerCompat.create(layout.getContext()); } mScroller.fling(0, getTopAndBottomOffset(), // curr 0, Math.round(velocityY), // velocity. 0, 0, // x minOffset, maxOffset); // y if (mScroller.computeScrollOffset()) { mFlingRunnable = new FlingRunnable(coordinatorLayout, layout); ViewCompat.postOnAnimation(layout, mFlingRunnable); return true; } else { onFlingFinished(coordinatorLayout, layout); return false; } }
From source file:com.huyn.demogroup.bahavior.widget.HeaderBehavior.java
final boolean fling(CoordinatorLayout coordinatorLayout, V layout, int minOffset, int maxOffset, float velocityY) { if (mFlingRunnable != null) { layout.removeCallbacks(mFlingRunnable); mFlingRunnable = null;// w ww. ja va 2 s .com } if (mScroller == null) { mScroller = ScrollerCompat.create(layout.getContext()); } mScroller.fling(0, getTopAndBottomOffset(), // curr 0, Math.round(velocityY), // velocity. 0, 0, // x minOffset, maxOffset); // y if (mScroller.computeScrollOffset()) { mFlingRunnable = new HeaderBehavior.FlingRunnable(coordinatorLayout, layout); ViewCompat.postOnAnimation(layout, mFlingRunnable); return true; } else { onFlingFinished(coordinatorLayout, layout); return false; } }
From source file:ticwear.design.widget.HeaderBehavior.java
final boolean fling(CoordinatorLayout coordinatorLayout, V layout, int minOffset, int maxOffset, float velocityY) { if (mFlingRunnable != null) { layout.removeCallbacks(mFlingRunnable); mFlingRunnable = null;/*from ww w . java2s .c o m*/ } if (mScroller == null) { mScroller = ScrollerCompat.create(layout.getContext()); } mScroller.fling(0, getTopAndBottomOffset(), // curr 0, Math.round(velocityY), // velocity. 0, 0, // x minOffset, maxOffset); // y if (mScroller.computeScrollOffset()) { mFlingRunnable = new FlingRunnable(coordinatorLayout, layout); ViewCompat.postOnAnimation(layout, mFlingRunnable); return true; } return false; }
From source file:cn.ieclipse.af.view.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);/*from ww w . j a va2s .co m*/ setClipToPadding(false); }
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 av a2 s .c o m setClipToPadding(false); }
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 ava 2 s . c om*/ setClipToPadding(false); }