Example usage for android.support.v4.widget EdgeEffectCompat EdgeEffectCompat

List of usage examples for android.support.v4.widget EdgeEffectCompat EdgeEffectCompat

Introduction

In this page you can find the example usage for android.support.v4.widget EdgeEffectCompat EdgeEffectCompat.

Prototype

public EdgeEffectCompat(Context context) 

Source Link

Document

Construct a new EdgeEffect themed using the given context.

Usage

From source file:de.andacaydin.bidirectionalviewpagerlibrary.BiDirectionalViewPager.java

void initViewPager() {
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);// w w w  .j a v  a2s.  c o m
    final Context context = getContext();
    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);
    ViewCompat.setAccessibilityDelegate(this, getAccessibilityDelegateCompat());
    if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
    setWillNotDraw(false);
    mScroller = new Scroller(getContext());
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}

From source file:com.gome.ecmall.custom.VerticalViewPager.java

void initViewPager() {
    setWillNotDraw(false);//from   w w w .  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:beichen.douban.ui.view.LazyViewPager.java

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

From source file:javalibrary.android.ui.VerticalViewPager.java

void initViewPager() {
    setWillNotDraw(false);//from  w w  w.jav  a2  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);
    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 {/*from 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 = 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.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 {/*from www .  jav a  2s. 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.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 {//from w w  w  .  j  a  v a2s . 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.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 www . j av  a  2  s .  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: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 ww w .  j  a  va  2 s . 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.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 {//ww  w  . j av  a  2 s .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();
    }
}