Example usage for android.content.res TypedArray getInt

List of usage examples for android.content.res TypedArray getInt

Introduction

In this page you can find the example usage for android.content.res TypedArray getInt.

Prototype

public int getInt(@StyleableRes int index, int defValue) 

Source Link

Document

Retrieve the integer value for the attribute at index.

Usage

From source file:com.applite.common.PagerSlidingTabStrip.java

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

    setFillViewport(true);//www .java 2 s.  c  o m
    setWillNotDraw(false);

    DisplayMetrics dm = getResources().getDisplayMetrics();

    scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm);
    indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm);
    underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm);
    dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm);
    tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm);
    dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm);
    tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm);

    // get system attrs (android:textSize and android:textColor)

    TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);

    tabTextSize = a.getDimensionPixelSize(0, tabTextSize);
    tabTextColor = a.getColorStateList(1);
    tabTypefaceStyle = a.getInt(2, tabTypefaceStyle);
    LogUtils.d(TAG, "tabTextSize=" + tabTextSize + ",tabTextColor=" + tabTextColor + ",tabTypefaceStyle="
            + tabTypefaceStyle);
    a.recycle();

    // get custom attrs

    a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTab);
    indicatorColor = a.getColor(R.styleable.PagerSlidingTab_pstsIndicatorColor, indicatorColor);
    underlineColor = a.getColor(R.styleable.PagerSlidingTab_pstsUnderlineColor, underlineColor);
    dividerColor = a.getColor(R.styleable.PagerSlidingTab_pstsDividerColor, dividerColor);
    indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_pstsIndicatorHeight, indicatorHeight);
    underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_pstsUnderlineHeight, underlineHeight);
    dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_pstsDividerPadding, dividerPadding);
    tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_pstsTabPaddingLeftRight, tabPadding);
    tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTab_pstsTabBackground, tabBackgroundResId);
    shouldExpand = a.getBoolean(R.styleable.PagerSlidingTab_pstsShouldExpand, shouldExpand);
    scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_pstsScrollOffset, scrollOffset);
    textAllCaps = a.getBoolean(R.styleable.PagerSlidingTab_pstsTextAllCaps, textAllCaps);

    a.recycle();

    rectPaint = new Paint();
    rectPaint.setAntiAlias(true);
    rectPaint.setStyle(Style.FILL);

    dividerPaint = new Paint();
    dividerPaint.setAntiAlias(true);
    dividerPaint.setStrokeWidth(dividerWidth);

    defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.MATCH_PARENT);
    expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f);

    if (locale == null) {
        locale = getResources().getConfiguration().locale;
    }
}

From source file:com.dl7.commonlib.views.RippleView.java

/**
 * Method that initializes all fields and sets listeners
 *
 * @param context Context used to create this view
 * @param attrs Attribute used to initialize fields
 *//*  w ww .ja  va2  s  .  c o  m*/
private void init(final Context context, final AttributeSet attrs) {
    if (isInEditMode())
        return;

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
    rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color,
            ContextCompat.getColor(context, R.color.rippelColor));
    rippleType = typedArray.getInt(R.styleable.RippleView_rv_type, 0);
    hasToZoom = typedArray.getBoolean(R.styleable.RippleView_rv_zoom, false);
    isCentered = typedArray.getBoolean(R.styleable.RippleView_rv_centered, false);
    rippleDuration = typedArray.getInteger(R.styleable.RippleView_rv_rippleDuration, rippleDuration);
    frameRate = typedArray.getInteger(R.styleable.RippleView_rv_framerate, frameRate);
    rippleAlpha = typedArray.getInteger(R.styleable.RippleView_rv_alpha, rippleAlpha);
    ripplePadding = typedArray.getDimensionPixelSize(R.styleable.RippleView_rv_ripplePadding, 0);
    canvasHandler = new Handler();
    zoomScale = typedArray.getFloat(R.styleable.RippleView_rv_zoomScale, 1.03f);
    zoomDuration = typedArray.getInt(R.styleable.RippleView_rv_zoomDuration, 200);
    isListMode = typedArray.getBoolean(R.styleable.RippleView_rv_listMode, false);
    typedArray.recycle();
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(rippleColor);
    paint.setAlpha(rippleAlpha);
    this.setWillNotDraw(false);

    gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public void onLongPress(MotionEvent event) {
            super.onLongPress(event);
            animateRipple(event);
            sendClickEvent(true);
            lastLongPressX = (int) event.getX();
            lastLongPressY = (int) event.getY();
            rippleStatus = RIPPLE_LONG_PRESS;
        }

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            return true;
        }

        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            return true;
        }
    });

    this.setDrawingCacheEnabled(true);
    this.setClickable(true);
    this.touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
}

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

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

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

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

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);

    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
    mMargin = a.getInt(R.styleable.CirclePageIndicator_marginRate, 2);

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

    a.recycle();

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

From source file:com.rong.library.widget.mapsearchbar.MapSearchBar.java

private void init(AttributeSet attrs) {
    inflate(getContext(), R.layout.search_bar, this);

    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.MapSearchBar);
    hint = a.getString(R.styleable.MapSearchBar_ms_searchHint);
    emptyHistory = a.getString(R.styleable.MapSearchBar_ms_defaultHistoryEmptyString);
    elevation = a.getDimensionPixelSize(R.styleable.MapSearchBar_ms_elevation, -1);
    margin = a.getDimensionPixelSize(R.styleable.MapSearchBar_ms_margin, -1);
    navType = a.getInt(R.styleable.MapSearchBar_ms_mapType, -1);

    a.recycle();/*from www.j a va  2  s .  c  om*/

    // default settings
    if (hint == null)
        hint = getContext().getString(R.string.ms_default_edit_hint);
    if (emptyHistory == null)
        emptyHistory = "";
    if (elevation == -1)
        elevation = getResources().getDimensionPixelSize(R.dimen.ms_default_search_bar_elevation);
    if (margin == -1)
        margin = getResources().getDimensionPixelSize(R.dimen.ms_default_search_bar_margin);
    if (navType == -1)
        navType = NAV_MAP_AUTO_NAV;

    findViews();
    setupViews();

    DisplayMetrics displaymetrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    screenHeight = displaymetrics.heightPixels;
}

From source file:com.dirkgassen.wator.ui.view.RangeSlider.java

/**
 * Read out the attributes from the given attribute set and initialize whatever they represent.
 *
 * @param attributeArray typed array containing the attribute values from the XML file
 *//*  ww w. j av  a 2  s. c  om*/
private void setupAttributes(TypedArray attributeArray) {
    minValue = attributeArray.getInt(R.styleable.RangeSlider_minValue, 0);
    maxValue = attributeArray.getInt(R.styleable.RangeSlider_maxValue, 100);

    thumbPadding = attributeArray.getDimension(R.styleable.RangeSlider_thumbPadding,
            6 /* dp */ * displayDensity);

    thumbFormat = attributeArray.getString(R.styleable.RangeSlider_thumbFormat);
    if (thumbFormat == null) {
        thumbFormat = "%d";
    }

    String valueSetString = attributeArray.getString(R.styleable.RangeSlider_valueSet);
    if (valueSetString == null) {
        value = attributeArray.getInt(R.styleable.RangeSlider_android_value, minValue);
    } else {
        String[] values = valueSetString.split(",");
        valueSet = new int[values.length];
        for (int no = 0; no < values.length; no++) {
            valueSet[no] = Integer.valueOf(values[no]);
        }
        Arrays.sort(valueSet);
        value = attributeArray.getInt(R.styleable.RangeSlider_android_value, valueSet[0]);
    }

    thumbTextPaint.setTextSize(attributeArray.getDimension(R.styleable.RangeSlider_android_textSize, 12));
    thumbTextPaint.setColor(attributeArray.getColor(R.styleable.RangeSlider_android_textColor,
            ContextCompat.getColor(getContext(), android.R.color.white)));

    thumbBackgroundPaint.setStyle(Paint.Style.FILL);
    thumbBackgroundPaint.setColor(attributeArray.getColor(R.styleable.RangeSlider_android_color,
            ContextCompat.getColor(getContext(), android.R.color.black)));

    sliderPaint.setStrokeWidth(attributeArray.getDimension(R.styleable.RangeSlider_sliderThickness, 2));
    sliderPaint.setStrokeCap(Paint.Cap.ROUND);
    sliderPaint.setColor(thumbBackgroundPaint.getColor());

}

From source file:com.google.android.cameraview.CameraView.java

@SuppressWarnings("WrongConstant")
public CameraView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    if (isInEditMode()) {
        mCallbacks = null;//from   www .j  a  v  a  2  s.  co  m
        mDisplayOrientationDetector = null;
        return;
    }
    // Internal setup
    final PreviewImpl preview = createPreviewImpl(context);
    mCallbacks = new CallbackBridge(this);
    final Context appContext = context.getApplicationContext();
    if (Build.VERSION.SDK_INT < 21) {
        mImpl = new Camera1(mCallbacks, preview);
    } else if (Build.VERSION.SDK_INT < 23) {
        mImpl = new Camera2(mCallbacks, preview, appContext);
    } else {
        mImpl = new Camera2Api23(mCallbacks, preview, appContext);
    }
    // Attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CameraView, defStyleAttr,
            R.style.Widget_CameraView);
    mAdjustViewBounds = a.getBoolean(R.styleable.CameraView_android_adjustViewBounds, false);
    setFacing(a.getInt(R.styleable.CameraView_facing, FACING_BACK));
    String aspectRatio = a.getString(R.styleable.CameraView_aspectRatio);
    if (aspectRatio != null) {
        setAspectRatio(AspectRatio.parse(aspectRatio));
    } else {
        setAspectRatio(Constants.DEFAULT_ASPECT_RATIO);
    }
    setAutoFocus(a.getBoolean(R.styleable.CameraView_autoFocus, true));
    setFlash(a.getInt(R.styleable.CameraView_flash, Constants.FLASH_AUTO));
    a.recycle();
    // Display orientation detector
    mDisplayOrientationDetector = new DisplayOrientationDetector(context) {
        @Override
        public void onDisplayOrientationChanged(int displayOrientation) {
            mImpl.setDisplayOrientation(displayOrientation);
        }
    };
}

From source file:com.progekt.webtools.viewpagerindicator.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.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);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle,
            R.style.Widget_CirclePageIndicator);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke/*w  w  w .ja  va  2  s.  c  o m*/
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    a.recycle();

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

From source file:com.app.mue.themingo.views.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from ww w. j ava 2 s  .c o 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.viewpager_circleindicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

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

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

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

    a.recycle();

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

From source file:com.github.lakeshire.pageindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from   w w w .j a va2s .  com*/

    //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);
    final float defaultExtraSpacing = res.getDimension(R.dimen.default_circle_indicator_extra_spacing);

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

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
    mExtraSpacing = a.getDimension(R.styleable.CirclePageIndicator_extraSpacing, defaultExtraSpacing);
    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

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

From source file:com.hp.adapters.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.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);

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle,
            R.style.Widget_CirclePageIndicator);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation);
    mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke// w ww . j a va 2s .c o  m
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    a.recycle();

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