Example usage for android.view ViewConfiguration getScaledMinimumFlingVelocity

List of usage examples for android.view ViewConfiguration getScaledMinimumFlingVelocity

Introduction

In this page you can find the example usage for android.view ViewConfiguration getScaledMinimumFlingVelocity.

Prototype

public int getScaledMinimumFlingVelocity() 

Source Link

Usage

From source file:com.GMS.lib.StaggeredGridView.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, 2);
    } else {//from   ww w .j a v  a  2s .  c o m
        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.example.jarida.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 {// w  ww . j  a  v  a  2s .  com
        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.gome.ecmall.custom.VerticalViewPager.java

void initViewPager() {
    setWillNotDraw(false);/*from w  ww .j a v  a  2s  . 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();
    mTopEdge = new EdgeEffectCompat(context);
    mBottomEdge = new EdgeEffectCompat(context);

    final float density = MobileDeviceUtil.getInstance(context.getApplicationContext()).getScreenDensity();
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}

From source file:com.origamilabs.library.views2.StaggeredGridView.java

public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (attrs != null) {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ohsujinStaggeredGridView);
        mColCount = a.getInteger(R.styleable.ohsujinStaggeredGridView_ohsujinNumColumns, 2);
        mDrawSelectorOnTop = a.getBoolean(R.styleable.ohsujinStaggeredGridView_ohsujinDrawSelectorOnTop, false);
        mItemMargin = (int) a.getDimension(R.styleable.ohsujinStaggeredGridView_ohsujinItemMargin, 0);
    } else {//from   w w w . j  av a  2s .  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.photowall.widget.staggedGridView.ScrollStaggeredGridView.java

public ScrollStaggeredGridView(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 {/*  w w  w .  j  a v  a 2 s .  c  o  m*/
        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.example.fengxiaozheng.mynews.widget.splash.ViewPager.java

void initViewPager() {
    setWillNotDraw(false);/*from   w  w  w  .j  ava  2s.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);

    if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}

From source file:com.brantapps.viewpagerindicator.vertical.VerticalViewPager.java

void initViewPager() {
    setWillNotDraw(false);/*from  w  w w.j a  v  a2  s  . 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();
    mTopEdge = new EdgeEffectCompat(context);
    mBottomEdge = 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);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    // TODO: Could restore these lines after ActionBarSherlock is upgraded to support library v9
    //        if (ViewCompat.getImportantForAccessibility(this)
    //                == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
    //            ViewCompat.setImportantForAccessibility(this,
    //                    ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    //        }
}

From source file:com.jackie.sample.custom_view.CustomViewPagerInternal.java

void initViewPager() {
    setWillNotDraw(false);/*  w w w. j a  v  a  2  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);

    final float density = context.getResources().getDisplayMetrics().density;
    // mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density) * 4;
    mFlingDistance = (int) (60 * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}

From source file:chan.android.app.bitwise.util.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 ww  w  . j  a v a2s . co  m*/
        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.app.afteryou.ui.staggered.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 = new Scroller(context);

    mTopEdge = new EdgeEffectCompat(context);
    mBottomEdge = new EdgeEffectCompat(context);
    setWillNotDraw(false);/*from w  ww  . j a  va 2s.c  o m*/
    setClipToPadding(false);

    if (attrs != null) {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CostomStaggeredGridView);
        mColCountSetting = a.getInteger(R.styleable.CostomStaggeredGridView_columnNumber, 2);
        mDrawSelectorOnTop = a.getBoolean(R.styleable.CostomStaggeredGridView_drawSelectorOnTop, false);
        if (mColCountSetting != -1) {
            mColCount = mColCountSetting;
        }
        mMinColWidth = a.getDimensionPixelSize(R.styleable.CostomStaggeredGridView_minColumnWidth, 0);
        a.recycle();
    }

    this.setFocusableInTouchMode(false);

    if (mSelector == null) {
        useDefaultSelector();
    }

}