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:com.sj.android.appusage.ui.widgets.listview.SwipeListView.java

/**
 * Init ListView//w w  w  .  j a  va 2  s.c  om
 *
 * @param attrs AttributeSet
 */
private void init(AttributeSet attrs) {

    swipeFrontView = R.id.parentLayout;
    swipeBackView = R.id.frameForAnimLayout;
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    touchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    touchListener = new SwipeListViewTouchListener(this, swipeFrontView, swipeBackView);
    setOnTouchListener(touchListener);
}

From source file:com.lynx.lib.widget.pageindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (isInEditMode())
        return;/*from   www.java  2 s  .com*/

    final Resources res = getResources();
    final int defaultPageColor = 0x00000000;
    final int defaultFillColor = 0xFFFFFFFF;
    final int defaultOrientation = 0;
    final int defaultStrokeColor = 0xFFDDDDDD;
    final float defaultStrokeWidth = 1;
    final float defaultRadius = 3;
    final boolean defaultCentered = true;
    final boolean defaultSnap = false;

    mCentered = defaultCentered;
    mOrientation = defaultOrientation;
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(defaultStrokeColor);
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(defaultStrokeColor);
    mPaintStroke.setStrokeWidth(defaultStrokeWidth);
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(defaultFillColor);
    mRadius = defaultRadius;
    mSnap = defaultSnap;

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

From source file:com.wabao.android.app.widget.CirclePageIndicator.java

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

    final Resources res = getResources();
    mGapWidth = dpToPx(res, GAP_WIDTH);
    setStrokeWidth(dpToPx(res, STROKE_WIDTH));
    mPaintUnselected.setColor(UN_SELECTED_COLOR);
    mPaintSelected.setColor(SELECTED_COLOR);

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

From source file:com.lee.sdk.widget.viewpager.DrawablePageIndicator.java

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

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

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

    mShadowLeft = a.getDimension(R.styleable.DrawablePageIndicator_shadow_left, 0.0f);
    mShadowRight = a.getDimension(R.styleable.DrawablePageIndicator_shadow_right, 0.0f);

    mDrawable = a.getDrawable(R.styleable.DrawablePageIndicator_android_src);
    if (mDrawable == null) {
        mDrawable = new ColorDrawable(Color.WHITE);
    }

    a.recycle();

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

From source file:com.halloon.android.util.UnderLinePageIndicator.java

public UnderLinePageIndicator(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 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);

    setFades(defaultFades);
    setSelectedColor(defaultSelectedColor);
    setFadeDelay(defaultFadeDelay);
    setFadeLength(defaultFadeLength);

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

From source file:com.zzq.viewpagerindicator.TitlePageIndicator.java

public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*  ww  w.j  ava  2s.co  m*/
    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);
    mSelectedColor = a.getColor(R.styleable.TitlePageIndicator_indicator_selected_color, -1);
    mLineColor = a.getColor(R.styleable.TitlePageIndicator_indicator_line_color, -1);
    mTextSize = (int) a.getDimension(R.styleable.TitlePageIndicator_indicator_text_size, 80f);
    mPaintText.setTextSize(mTextSize);

    mTextToTop = (int) a.getDimension(R.styleable.TitlePageIndicator_indicator_text_to_top, 0);
    mIndicatorToText = (int) a.getDimension(R.styleable.TitlePageIndicator_indicator_to_text, 10);
    mIndicatorLineHeight = (int) a.getDimension(R.styleable.TitlePageIndicator_indicator_line_height, 15);
    mBaseIndicatorLineHeight = (int) a
            .getDimension(R.styleable.TitlePageIndicator_indicator_base_indicator_line_height, 5);
    mHorizontalSpace = (int) a.getDimension(R.styleable.TitlePageIndicator_indicator_horizontal_space, 50);

    a.recycle();

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

From source file:com.zhongsou.souyue.ui.indicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*  w  w  w .  j  av  a2  s .  c  o  m*/

    //Load defaults from resources
    final Resources res = getResources();
    mPaintPageFill.setColor(res.getColor(R.color.default_circle_indicator_page_color));
    mPaintPageFill.setStyle(Style.FILL);
    mPaintFill.setColor(res.getColor(R.color.default_circle_indicator_fill_color));
    mPaintFill.setStyle(Style.FILL);
    mOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    mPaintStroke.setColor(res.getColor(R.color.default_circle_indicator_stroke_color));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setStrokeWidth(res.getDimension(R.dimen.default_circle_indicator_stroke_width));
    mRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    mCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    mSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

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

From source file:com.shafiq.mytwittle.widget.viewpagerindicator.UnderlinePageIndicator.java

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

    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));

    a.recycle();

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

From source file:com.lingganhezi.ui.widget.LinePageIndicator.java

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

    final Resources res = getResources();
    mLineWidth = dpToPx(res, LINE_WIDTH);
    mGapWidth = dpToPx(res, GAP_WIDTH);
    setStrokeWidth(dpToPx(res, STROKE_WIDTH));
    mPaintUnselected.setColor(UN_SELECTED_COLOR);
    mPaintSelected.setColor(SELECTED_COLOR);

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

From source file:com.valohyd.nextseries.models.CirclePageIndicator.java

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

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.blue_lightDark);
    final int defaultFillColor = res.getColor(android.R.color.white);
    final int defaultOrientation = 0;
    final int defaultStrokeColor = res.getColor(R.color.bg_dk_grey);
    final float defaultStrokeWidth = 2;
    final float defaultRadius = 7;
    final boolean defaultCentered = true;
    final boolean defaultSnap = true;

    mCentered = defaultCentered;//from  w w  w .j  a  v  a 2s  .  c  o  m
    mOrientation = defaultOrientation;
    mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(defaultPageColor);
    mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(defaultStrokeColor);
    mPaintStroke.setStrokeWidth(defaultStrokeWidth);
    mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(defaultFillColor);
    mRadius = defaultRadius;
    mSnap = defaultSnap;

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