Example usage for android.support.v4.view ViewConfigurationCompat getScaledPagingTouchSlop

List of usage examples for android.support.v4.view ViewConfigurationCompat getScaledPagingTouchSlop

Introduction

In this page you can find the example usage for android.support.v4.view ViewConfigurationCompat getScaledPagingTouchSlop.

Prototype

public static int getScaledPagingTouchSlop(ViewConfiguration config) 

Source Link

Document

Call ViewConfiguration#getScaledPagingTouchSlop() .

Usage

From source file:pl.ipebk.tabi.presentation.ui.custom.indicator.UnderlinePageIndicator.java

public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) {
        return;/*from  w  w  w  .j  av  a2  s . c  om*/
    }

    final Resources res = getResources();

    //Load defaults from resources
    final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades);
    final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay);
    final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length);
    final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0);

    setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades));
    setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor));
    setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay));
    setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength));

    Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mBounds = new RectF();
}

From source file:com.velocityviewpagerindicator.VelocityLinePageIndicator.java

public VelocityLinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from w ww  . j  av a 2  s.c  om*/

    final Resources res = getResources();

    //Load defaults from resources
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.VelocityLinePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.VelocityLinePageIndicator_centered, defaultCentered);
    mLineWidth = a.getDimension(R.styleable.VelocityLinePageIndicator_lineWidth, defaultLineWidth);
    mGapWidth = a.getDimension(R.styleable.VelocityLinePageIndicator_gapWidth, defaultGapWidth);
    setStrokeWidth(a.getDimension(R.styleable.VelocityLinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected.setColor(
            a.getColor(R.styleable.VelocityLinePageIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected
            .setColor(a.getColor(R.styleable.VelocityLinePageIndicator_selectedColor, defaultSelectedColor));

    Drawable background = a.getDrawable(R.styleable.VelocityLinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.velocityviewpagerindicator.VelocityUnderlinePageIndicator.java

public VelocityUnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from   w ww .  j  a  v  a2s . com

    final Resources res = getResources();

    //Load defaults from resources
    final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades);
    final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay);
    final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length);
    final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.VelocityUnderlinePageIndicator, defStyle,
            0);

    setFades(a.getBoolean(R.styleable.VelocityUnderlinePageIndicator_fades, defaultFades));
    setSelectedColor(
            a.getColor(R.styleable.VelocityUnderlinePageIndicator_selectedColor, defaultSelectedColor));
    setFadeDelay(a.getInteger(R.styleable.VelocityUnderlinePageIndicator_fadeDelay, defaultFadeDelay));
    setFadeLength(a.getInteger(R.styleable.VelocityUnderlinePageIndicator_fadeLength, defaultFadeLength));

    Drawable background = a.getDrawable(R.styleable.VelocityUnderlinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.viewpagerindicator.as.library.indicator.RecyclerLinePageIndicator.java

public RecyclerLinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//  w  ww  .j  a va 2s . co  m

    final Resources res = getResources();

    //Load defaults from resources
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, defaultCentered);
    mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);
    mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, defaultGapWidth);
    setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected
            .setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));

    Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.mozhuowen.widget.autoscrollviewpager.indicator.LinePageIndicator.java

public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from   w  w w . java2  s.com*/

    final Resources res = getResources();

    //Load defaults from resources
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);

    //        mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, defaultCentered);
    //        mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);
    //        mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, defaultGapWidth);
    mCentered = defaultCentered;
    mLineWidth = defaultLineWidth;
    mGapWidth = defaultGapWidth;
    setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected
            .setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));

    Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.aksalj.viewpagerslideshow.LinePageIndicator.java

public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from ww w.  j  a  v a2 s.  c  o m*/

    final Resources res = getResources();

    //Load defaults from resources
    final int defaultLineStyle = res.getInteger(R.integer.default_line_style);
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0);

    mBoxStyle = a.getInt(R.styleable.LinePageIndicator_lineStyle, defaultLineStyle) == 1;
    mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, mBoxStyle ? false : defaultCentered);
    mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth);
    mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, mBoxStyle ? 0.0f : defaultGapWidth);
    setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected
            .setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor));

    Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.zxly.o2o.viewpagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (isInEditMode())
        return;/*from w  w  w. j a v a 2  s .  c o  m*/
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleIndicator);
    mCentered = a.getBoolean(R.styleable.CircleIndicator_mCentered, true);
    mOrientation = a.getInt(R.styleable.CircleIndicator_android_orientation, 0);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CircleIndicator_mPageColor, 0xa0000000));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CircleIndicator_mStrokeColor, 0xFFDDDDDD));
    mPaintStroke.setStrokeWidth(0); // 1dip
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CircleIndicator_mFillColor, 0xFFff5f19)); // 0xFFFFFFFF
    mRadius = a.getDimension(R.styleable.CircleIndicator_mRadius, 20); //3dip
    mSnap = a.getBoolean(R.styleable.CircleIndicator_mSnap, true);
    mRepeatedRoll = a.getBoolean(R.styleable.CircleIndicator_mRepeated_roll, false);
    mItemMargin = a.getDimension(R.styleable.CircleIndicator_mItemMargin, 0);
    Drawable background = a.getDrawable(R.styleable.CircleIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);

}

From source file:dk.dr.radio.diverse.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (isInEditMode())
        return;/*ww w  . ja  v  a 2 s.  co  m*/

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    mCentered = defaultCentered;
    mOrientation = defaultOrientation;
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(defaultPageColor);
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(defaultStrokeColor);
    mPaintStroke.setStrokeWidth(defaultStrokeWidth);
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(defaultFillColor);
    mRadius = defaultRadius;
    mSnap = defaultSnap;
    /*
            Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
            if (background != null) {
              setBackgroundDrawable(background);
            }
    */
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.e.common.widget.viewpager.UnderlinePageIndicator.java

public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from   w  w w .java2s . com*/

    final Resources res = getResources();

    // Load defaults from resources
    final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades);
    final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay);
    final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length);
    final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color);

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0);

    setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades));
    setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor));
    setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay));
    setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength));

    isRound = a.getBoolean(R.styleable.UnderlinePageIndicator_round, false);

    Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);

    if (isRound) {
        mPaint.setStrokeJoin(Paint.Join.ROUND); // 
        mPaint.setStrokeCap(Paint.Cap.ROUND);
        mPaint.setStyle(Paint.Style.FILL);
    }
}

From source file:com.futureinst.viewpagerindicator.UnderlinePageIndicator.java

public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from  w  ww  . j a  v  a  2s  .c  o  m*/

    final Resources res = getResources();

    //Load defaults from resources
    final boolean defaultFades = res.getBoolean(com.futureinst.R.bool.default_underline_indicator_fades);
    final int defaultFadeDelay = res
            .getInteger(com.futureinst.R.integer.default_underline_indicator_fade_delay);
    final int defaultFadeLength = res
            .getInteger(com.futureinst.R.integer.default_underline_indicator_fade_length);
    final int defaultSelectedColor = res
            .getColor(com.futureinst.R.color.default_underline_indicator_selected_color);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, com.futureinst.R.styleable.UnderlinePageIndicator,
            defStyle, 0);

    setFades(a.getBoolean(com.futureinst.R.styleable.UnderlinePageIndicator_fades, defaultFades));
    setSelectedColor(
            a.getColor(com.futureinst.R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor));
    setFadeDelay(a.getInteger(com.futureinst.R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay));
    setFadeLength(
            a.getInteger(com.futureinst.R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength));

    Drawable background = a.getDrawable(com.futureinst.R.styleable.UnderlinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}