List of usage examples for android.view ViewConfiguration getScaledMinimumFlingVelocity
public int getScaledMinimumFlingVelocity()
From source file:refresh.renyi.io.supperrefreshview.customview.VerticalViewPager.java
void initViewPager() { setWillNotDraw(false);/*from w w w.j av a2 s . c om*/ 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); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); this.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (getChildCount() > 0) { // System.out.println("renyi ---" +getChildCount()); } } }); final float density = context.getResources().getDisplayMetrics().density; mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); }
From source file:com.rajul.staggeredgridview.StaggeredGridView.java
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO/*from ww w .jav a 2 s . c o m*/ mDrawSelectorOnTop = true; final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = ScrollerCompat.from(context); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false); setClipToPadding(false); this.setFocusableInTouchMode(false); if (mSelector == null) { useDefaultSelector(); } }
From source file:interactive.view.pagereader.VerticalViewPager.java
/** * ?iew Pager/* ww w. j a v a 2 s .co m*/ */ void initViewPager() { setWillNotDraw(false); 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(); // XXX mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); final float density = context.getResources().getDisplayMetrics().density; mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); }
From source file:com.example.view.VerticalViewPager.java
/** * //from w ww.j a va 2 s .c o m */ void initViewPager() { setWillNotDraw(false); 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(); // mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); final float density = context.getResources().getDisplayMetrics().density; mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); }
From source file:org.gdg.frisbee.android.view.MasonryView.java
public MasonryView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.MasonryView); mColCount = a.getInteger(R.styleable.MasonryView_numColumns, 2); mDrawSelectorOnTop = a.getBoolean(R.styleable.MasonryView_drawSelectorOnTop, false); } else {/*w w w .ja va 2s .c o m*/ mColCount = 2; mDrawSelectorOnTop = false; } final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = new OverScroller(getContext()); this.setOverScrollMode(OVER_SCROLL_ALWAYS); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false); setClipToPadding(false); this.setFocusableInTouchMode(false); if (mSelector == null) { useDefaultSelector(); } }
From source file:com.lovebridge.library.view.staggeredGridView.ExtendableListView.java
public ExtendableListView(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); // setting up to be a scrollable view group setWillNotDraw(false);// w w w. j a va 2s . c o m setClipToPadding(false); setFocusableInTouchMode(false); final ViewConfiguration viewConfiguration = ViewConfiguration.get(context); mTouchSlop = viewConfiguration.getScaledTouchSlop(); mMaximumVelocity = viewConfiguration.getScaledMaximumFlingVelocity(); mFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity(); mRecycleBin = new RecycleBin(); mObserver = new AdapterDataSetObserver(); mHeaderViewInfos = new ArrayList<FixedViewInfo>(); mFooterViewInfos = new ArrayList<FixedViewInfo>(); // start our layout mode drawing from the top mLayoutMode = LAYOUT_NORMAL; }
From source file:com.mcxiaoke.minicat.ui.widget.StaggeredGridView.java
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StaggeredGridView); mColCount = a.getInteger(R.styleable.StaggeredGridView_numColumns, 2); mDrawSelectorOnTop = a.getBoolean(R.styleable.StaggeredGridView_drawSelectorOnTop, false); } else {/*from w w w . j av a 2s . co m*/ mColCount = 2; mDrawSelectorOnTop = false; } final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = new Scroller(context); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false); setClipToPadding(false); this.setFocusableInTouchMode(false); if (mSelector == null) { useDefaultSelector(); } }
From source file:org.bangbang.support.v4.widget.VerticalViewPager.java
void initViewPager() { setWillNotDraw(false);//w w w .j a v a2s . c o 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); final float density = context.getResources().getDisplayMetrics().density; mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); mCloseEnough = (int) (CLOSE_ENOUGH * density); mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density); android.support.v4.view.ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate()); if (android.support.v4.view.ViewCompat.getImportantForAccessibility( this) == android.support.v4.view.ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { android.support.v4.view.ViewCompat.setImportantForAccessibility(this, android.support.v4.view.ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } }
From source file:cn.iterlog.myapplication.widget.overscroll.StaggeredGridView.java
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StaggeredGridView); mColCount = a.getInteger(R.styleable.StaggeredGridView_numColumns, 2); mDrawSelectorOnTop = a.getBoolean(R.styleable.StaggeredGridView_drawSelectorOnTop, false); mItemMargin = (int) a.getDimension(R.styleable.StaggeredGridView_itemMargin, 0); } else {/*from w w w .j a va2 s.c om*/ mColCount = 2; mDrawSelectorOnTop = false; } final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = ScrollerCompat.from(context); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false); setClipToPadding(false); this.setFocusableInTouchMode(false); if (mSelector == null) { useDefaultSelector(); } }
From source file:com.bar.origamilabs.StaggeredGridView.java
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StaggeredGridView); mColCount = a.getInteger(R.styleable.StaggeredGridView_numColumns_1, 2); mDrawSelectorOnTop = a.getBoolean(R.styleable.StaggeredGridView_drawSelectorOnTop_1, false); mItemMargin = (int) a.getDimension(R.styleable.StaggeredGridView_itemMargin, 0); } else {// w w w . j a va2s. c om mColCount = 2; mDrawSelectorOnTop = false; } final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = ScrollerCompat.from(context); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false); setClipToPadding(false); this.setFocusableInTouchMode(false); if (mSelector == null) { useDefaultSelector(); } }