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.dkstudio.icorrect.practice.speaking.ui.custom.MaterialProgressBar.java

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialProgressBar, defStyleAttr,
            0);//w ww  .jav a2s  . co m

    final float density = getContext().getResources().getDisplayMetrics().density;

    mBackGroundColor = a.getColor(R.styleable.MaterialProgressBar_background_color, DEFAULT_CIRCLE_BG_LIGHT);

    mProgressColor = a.getColor(R.styleable.MaterialProgressBar_progress_color, DEFAULT_CIRCLE_BG_LIGHT);

    mInnerRadius = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_inner_radius, -1);

    mProgressStokeWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_stoke_width,
            (int) (STROKE_WIDTH_LARGE * density));
    mArrowWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_width, -1);
    mArrowHeight = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_height, -1);
    mTextSize = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_text_size,
            (int) (DEFAULT_TEXT_SIZE * density));
    mTextColor = a.getColor(R.styleable.MaterialProgressBar_progress_text_color, Color.BLACK);

    mShowArrow = a.getBoolean(R.styleable.MaterialProgressBar_show_arrow, false);
    mCircleBackgroundEnabled = a.getBoolean(R.styleable.MaterialProgressBar_enable_circle_background, true);

    mProgress = a.getInt(R.styleable.MaterialProgressBar_progress, 0);
    mMax = a.getInt(R.styleable.MaterialProgressBar_max, 100);
    int textVisible = a.getInt(R.styleable.MaterialProgressBar_progress_text_visibility, 1);
    if (textVisible != 1) {
        mIfDrawText = true;
    }

    mTextPaint = new Paint();
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setAntiAlias(true);
    a.recycle();
    mProgressDrawable = new MaterialProgressDrawable(getContext(), this);
    super.setImageDrawable(mProgressDrawable);
}

From source file:com.canyinghao.canrefresh.CanRefreshLayout.java

public CanRefreshLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CanRefreshLayout, defStyleAttr, 0);

    try {/*from  w ww .  j a va 2s  . c om*/
        final int N = a.getIndexCount();
        for (int i = 0; i < N; i++) {
            int attr = a.getIndex(i);
            if (attr == R.styleable.CanRefreshLayout_can_enabled_up) {
                setRefreshEnabled(a.getBoolean(attr, true));

            } else if (attr == R.styleable.CanRefreshLayout_can_enabled_down) {
                setLoadMoreEnabled(a.getBoolean(attr, true));

            } else if (attr == R.styleable.CanRefreshLayout_can_style_up) {
                mHeadStyle = a.getInt(attr, CLASSIC);

            } else if (attr == R.styleable.CanRefreshLayout_can_style_down) {
                mFootStyle = a.getInt(attr, CLASSIC);

            } else if (attr == R.styleable.CanRefreshLayout_can_friction) {

                setFriction(a.getFloat(attr, DEFAULT_FRICTION));

            } else if (attr == R.styleable.CanRefreshLayout_can_duration) {

                mDuration = a.getInt(attr, DEFAULT_DURATION);

            } else if (attr == R.styleable.CanRefreshLayout_can_smooth_duration) {

                mSmoothDuration = a.getInt(attr, DEFAULT_SMOOTH_DURATION);

            } else if (attr == R.styleable.CanRefreshLayout_can_smooth_length) {

                mSmoothLength = a.getInt(attr, DEFAULT_SMOOTH_LENGTH);

            }
        }

    } finally {
        a.recycle();
    }

}

From source file:com.socialapp.utils.MaterialProgressBar.java

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialProgressBar, defStyleAttr,
            0);//from   w  w w.j ava2  s.  c om

    final float density = getContext().getResources().getDisplayMetrics().density;

    mBackGroundColor = a.getColor(R.styleable.MaterialProgressBar_background_color, DEFAULT_CIRCLE_BG_LIGHT);

    mProgressColor = a.getColor(R.styleable.MaterialProgressBar_progress_color, DEFAULT_CIRCLE_BG_LIGHT);//ToDO ????

    mInnerRadius = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_inner_radius, -1);

    mProgressStokeWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_stoke_width,
            (int) (STROKE_WIDTH_LARGE * density));
    mArrowWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_width, -1);
    mArrowHeight = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_height, -1);
    mTextSize = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_text_size,
            (int) (DEFAULT_TEXT_SIZE * density));
    mTextColor = a.getColor(R.styleable.MaterialProgressBar_progress_text_color, Color.BLACK);

    mShowArrow = a.getBoolean(R.styleable.MaterialProgressBar_show_arrow, false);
    mCircleBackgroundEnabled = a.getBoolean(R.styleable.MaterialProgressBar_enable_circle_background, true);

    mProgress = a.getInt(R.styleable.MaterialProgressBar_progress, 0);
    mMax = a.getInt(R.styleable.MaterialProgressBar_max, 100);
    int textVisible = a.getInt(R.styleable.MaterialProgressBar_progress_text_visibility, 1);
    if (textVisible != 1) {
        mIfDrawText = true;
    }

    mTextPaint = new Paint();
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setAntiAlias(true);
    a.recycle();
    mProgressDrawable = new MaterialProgressDrawable(getContext(), this);
    super.setImageDrawable(mProgressDrawable);
}

From source file:com.chn.halo.view.progressbar.MaterialProgressBar.java

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialProgressBar, defStyleAttr,
            0);//  w  ww. j  av a  2 s . c o  m

    final float density = getContext().getResources().getDisplayMetrics().density;

    mBackGroundColor = a.getColor(R.styleable.MaterialProgressBar_background_color, DEFAULT_CIRCLE_BG_LIGHT);

    mProgressColor = a.getColor(R.styleable.MaterialProgressBar_progress_color, DEFAULT_CIRCLE_BG_LIGHT);//ToDO 

    mInnerRadius = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_inner_radius, -1);

    mProgressStokeWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_stoke_width,
            (int) (STROKE_WIDTH_LARGE * density));
    mArrowWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_width, -1);
    mArrowHeight = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_height, -1);
    mTextSize = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_text_size,
            (int) (DEFAULT_TEXT_SIZE * density));
    mTextColor = a.getColor(R.styleable.MaterialProgressBar_progress_text_color, Color.BLACK);

    mShowArrow = a.getBoolean(R.styleable.MaterialProgressBar_show_arrow, false);
    mCircleBackgroundEnabled = a.getBoolean(R.styleable.MaterialProgressBar_enable_circle_background, true);

    mProgress = a.getInt(R.styleable.MaterialProgressBar_progress, 0);
    mMax = a.getInt(R.styleable.MaterialProgressBar_max, 100);
    int textVisible = a.getInt(R.styleable.MaterialProgressBar_progress_text_visibility, 1);
    if (textVisible != 1) {
        mIfDrawText = true;
    }

    mTextPaint = new Paint();
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setAntiAlias(true);
    a.recycle();
    mProgressDrawable = new MaterialProgressDrawable(getContext(), this);
    super.setImageDrawable(mProgressDrawable);
}

From source file:com.owen.tvrecyclerview.widget.TvRecyclerView.java

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

    init(context);/*  w w w .j a va 2s  . c o m*/

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TvRecyclerView, defStyle, 0);

    final String name = a.getString(R.styleable.TvRecyclerView_tv_layoutManager);
    if (!TextUtils.isEmpty(name)) {
        loadLayoutManagerFromName(context, attrs, name);
    }
    mSelectedItemCentered = a.getBoolean(R.styleable.TvRecyclerView_tv_selectedItemIsCentered, false);
    mIsInterceptKeyEvent = a.getBoolean(R.styleable.TvRecyclerView_tv_isInterceptKeyEvent, false);
    mIsMenu = a.getBoolean(R.styleable.TvRecyclerView_tv_isMenu, false);
    mIsSelectFirstVisiblePosition = a.getBoolean(R.styleable.TvRecyclerView_tv_isSelectFirstVisiblePosition,
            false);
    mLoadMoreBeforehandCount = a.getInt(R.styleable.TvRecyclerView_tv_loadMoreBeforehandCount,
            DEFAULT_LOAD_MORE_BEFOREHAND_COUNT);
    mSelectedItemOffsetStart = a.getDimensionPixelOffset(R.styleable.TvRecyclerView_tv_selectedItemOffsetStart,
            DEFAULT_SELECTED_ITEM_OFFSET);
    mSelectedItemOffsetEnd = a.getDimensionPixelOffset(R.styleable.TvRecyclerView_tv_selectedItemOffsetEnd,
            DEFAULT_SELECTED_ITEM_OFFSET);

    a.recycle();
}

From source file:com.actionbarsherlock.internal.widget.IcsProgressBar.java

/**
 * @hide/*w  ww  .  j  ava  2s  .  c  o m*/
 */
public IcsProgressBar(Context context, AttributeSet attrs, int defStyle, int styleRes) {
    super(context, attrs, defStyle);
    mUiThreadId = Thread.currentThread().getId();
    initProgressBar();

    TypedArray a = context.obtainStyledAttributes(attrs, /*R.styleable.*/ProgressBar, defStyle, styleRes);

    mNoInvalidate = true;

    Drawable drawable = a.getDrawable(/*R.styleable.*/ProgressBar_progressDrawable);
    if (drawable != null) {
        drawable = tileify(drawable, false);
        // Calling this method can set mMaxHeight, make sure the corresponding
        // XML attribute for mMaxHeight is read after calling this method
        setProgressDrawable(drawable);
    }

    mDuration = a.getInt(/*R.styleable.*/ProgressBar_indeterminateDuration, mDuration);

    mMinWidth = a.getDimensionPixelSize(/*R.styleable.*/ProgressBar_minWidth, mMinWidth);
    mMaxWidth = a.getDimensionPixelSize(/*R.styleable.*/ProgressBar_maxWidth, mMaxWidth);
    mMinHeight = a.getDimensionPixelSize(/*R.styleable.*/ProgressBar_minHeight, mMinHeight);
    mMaxHeight = a.getDimensionPixelSize(/*R.styleable.*/ProgressBar_maxHeight, mMaxHeight);

    mBehavior = a.getInt(/*R.styleable.*/ProgressBar_indeterminateBehavior, mBehavior);

    final int resID = a.getResourceId(/*com.android.internal.R.styleable.*/ProgressBar_interpolator,
            android.R.anim.linear_interpolator); // default to linear interpolator
    if (resID > 0) {
        setInterpolator(context, resID);
    }

    setMax(a.getInt(/*R.styleable.*/ProgressBar_max, mMax));

    setProgress(a.getInt(/*R.styleable.*/ProgressBar_progress, mProgress));

    setSecondaryProgress(a.getInt(/*R.styleable.*/ProgressBar_secondaryProgress, mSecondaryProgress));

    drawable = a.getDrawable(/*R.styleable.*/ProgressBar_indeterminateDrawable);
    if (drawable != null) {
        drawable = tileifyIndeterminate(drawable);
        setIndeterminateDrawable(drawable);
    }

    mOnlyIndeterminate = a.getBoolean(/*R.styleable.*/ProgressBar_indeterminateOnly, mOnlyIndeterminate);

    mNoInvalidate = false;

    setIndeterminate(
            mOnlyIndeterminate || a.getBoolean(/*R.styleable.*/ProgressBar_indeterminate, mIndeterminate));

    mAnimationResolution = a.getInteger(/*R.styleable.*/ProgressBar_animationResolution, ANIMATION_RESOLUTION);

    a.recycle();

    mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
}

From source file:android.support.v7.internal.widget.ActionBarView.java

public ActionBarView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mContext = context;/*  w w w  . ja va 2s .  c  o m*/

    // Background is always provided by the container.
    setBackgroundResource(0);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionBar, R.attr.actionBarStyle, 0);

    ApplicationInfo appInfo = context.getApplicationInfo();
    PackageManager pm = context.getPackageManager();
    mNavigationMode = a.getInt(R.styleable.ActionBar_navigationMode, ActionBar.NAVIGATION_MODE_STANDARD);
    mTitle = a.getText(R.styleable.ActionBar_title);
    mSubtitle = a.getText(R.styleable.ActionBar_subtitle);
    mLogo = a.getDrawable(R.styleable.ActionBar_logo);
    if (mLogo == null) {
        if (Build.VERSION.SDK_INT >= 9) {
            if (context instanceof Activity) {
                try {
                    mLogo = pm.getActivityLogo(((Activity) context).getComponentName());
                } catch (NameNotFoundException e) {
                    Log.e(TAG, "Activity component name not found!", e);
                }
            }
            if (mLogo == null) {
                mLogo = appInfo.loadLogo(pm);
            }
        }
    }

    // TODO(trevorjohns): Should these use the android namespace
    mIcon = a.getDrawable(R.styleable.ActionBar_icon);
    if (mIcon == null) {
        if (context instanceof Activity) {
            try {
                mIcon = pm.getActivityIcon(((Activity) context).getComponentName());
            } catch (NameNotFoundException e) {
                Log.e(TAG, "Activity component name not found!", e);
            }
        }
        if (mIcon == null) {
            mIcon = appInfo.loadIcon(pm);
        }
    }

    final LayoutInflater inflater = LayoutInflater.from(context);

    final int homeResId = a.getResourceId(R.styleable.ActionBar_homeLayout, R.layout.abc_action_bar_home);

    mHomeLayout = (HomeView) inflater.inflate(homeResId, this, false);

    mExpandedHomeLayout = (HomeView) inflater.inflate(homeResId, this, false);
    mExpandedHomeLayout.setUp(true);
    mExpandedHomeLayout.setOnClickListener(mExpandedActionViewUpListener);
    mExpandedHomeLayout.setContentDescription(getResources().getText(R.string.abc_action_bar_up_description));

    mTitleStyleRes = a.getResourceId(R.styleable.ActionBar_titleTextStyle, 0);
    mSubtitleStyleRes = a.getResourceId(R.styleable.ActionBar_subtitleTextStyle, 0);
    mProgressStyle = a.getResourceId(R.styleable.ActionBar_progressBarStyle, 0);
    mIndeterminateProgressStyle = a.getResourceId(R.styleable.ActionBar_indeterminateProgressStyle, 0);

    mProgressBarPadding = a.getDimensionPixelOffset(R.styleable.ActionBar_progressBarPadding, 0);
    mItemPadding = a.getDimensionPixelOffset(R.styleable.ActionBar_itemPadding, 0);

    setDisplayOptions(a.getInt(R.styleable.ActionBar_displayOptions, DISPLAY_DEFAULT));

    final int customNavId = a.getResourceId(R.styleable.ActionBar_customNavigationLayout, 0);
    if (customNavId != 0) {
        mCustomNavView = (View) inflater.inflate(customNavId, this, false);
        mNavigationMode = ActionBar.NAVIGATION_MODE_STANDARD;
        setDisplayOptions(mDisplayOptions | ActionBar.DISPLAY_SHOW_CUSTOM);
    }

    mContentHeight = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
    a.recycle();
    mLogoNavItem = new ActionMenuItem(context, 0, android.R.id.home, 0, 0, mTitle);
    mHomeLayout.setOnClickListener(mUpClickListener);
    mHomeLayout.setClickable(true);
    mHomeLayout.setFocusable(true);

}

From source file:com.lab47billion.appchooser.HorizontalPicker.java

public HorizontalPicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    _context = context;// ww w .j  ava  2 s.c  o m

    // create the selector wheel paint
    TextPaint paint = new TextPaint();
    paint.setAntiAlias(true);
    mTextPaint = paint;

    TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.HorizontalPicker, defStyle, 0);

    CharSequence[] values;
    int ellipsize = 3; // END default value
    int sideItems = mSideItems;

    try {
        mTextColor = a.getColorStateList(R.styleable.HorizontalPicker_android_textColor);
        if (mTextColor == null) {
            mTextColor = ColorStateList.valueOf(0xFF000000);
        }

        values = a.getTextArray(R.styleable.HorizontalPicker_values);
        ellipsize = a.getInt(R.styleable.HorizontalPicker_android_ellipsize, ellipsize);
        mDividerSize = a.getDimension(R.styleable.HorizontalPicker_dividerSize, mDividerSize);
        mNormalTextSize = a.getDimension(R.styleable.HorizontalPicker_normalTextSize, 20);
        mSelectedTextSize = a.getDimension(R.styleable.HorizontalPicker_selectedTextSize, -1);
        sideItems = a.getInt(R.styleable.HorizontalPicker_sideItems, sideItems);

        if (mNormalTextSize > -1) {
            setTextSize(mNormalTextSize);
        }
        if (mSelectedTextSize == -1) {
            mSelectedTextSize = mNormalTextSize;
        }

    } finally {
        a.recycle();
    }

    switch (ellipsize) {
    case 1:
        setEllipsize(TextUtils.TruncateAt.START);
        break;
    case 2:
        setEllipsize(TextUtils.TruncateAt.MIDDLE);
        break;
    case 3:
        setEllipsize(TextUtils.TruncateAt.END);
        break;
    case 4:
        setEllipsize(TextUtils.TruncateAt.MARQUEE);
        break;
    }

    Paint.FontMetricsInt fontMetricsInt = mTextPaint.getFontMetricsInt();
    mBoringMetrics = new BoringLayout.Metrics();
    mBoringMetrics.ascent = fontMetricsInt.ascent;
    mBoringMetrics.bottom = fontMetricsInt.bottom;
    mBoringMetrics.descent = fontMetricsInt.descent;
    mBoringMetrics.leading = fontMetricsInt.leading;
    mBoringMetrics.top = fontMetricsInt.top;
    mBoringMetrics.width = mItemWidth;

    setWillNotDraw(false);

    mFlingScrollerX = new OverScroller(context);
    mAdjustScrollerX = new OverScroller(context, new DecelerateInterpolator(2.5f));

    // initialize constants
    ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity()
            / SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;
    mOverscrollDistance = configuration.getScaledOverscrollDistance();

    mPreviousScrollerX = Integer.MIN_VALUE;

    setValues(values);
    setSideItems(sideItems);

    /*mTouchHelper = new PickerTouchHelper(this);
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);*/

}

From source file:com.itutorgroup.tutorchat.phone.ui.CircleProgressBar.java

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleProgressBar, defStyleAttr, 0);
    final float density = getContext().getResources().getDisplayMetrics().density;

    mBackGroundColor = a.getColor(R.styleable.CircleProgressBar_mlpb_background_color, DEFAULT_CIRCLE_BG_LIGHT);

    mProgressColor = a.getColor(R.styleable.CircleProgressBar_mlpb_progress_color, DEFAULT_CIRCLE_BG_LIGHT);//ToDO 

    mInnerRadius = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_inner_radius, -1);

    mProgressStokeWidth = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_progress_stoke_width,
            (int) (STROKE_WIDTH_LARGE * density));
    mArrowWidth = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_arrow_width, -1);
    mArrowHeight = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_arrow_height, -1);
    mTextSize = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_progress_text_size,
            (int) (DEFAULT_TEXT_SIZE * density));
    mTextColor = a.getColor(R.styleable.CircleProgressBar_mlpb_progress_text_color, Color.BLACK);

    mShowArrow = a.getBoolean(R.styleable.CircleProgressBar_mlpb_show_arrow, false);
    mCircleBackgroundEnabled = a.getBoolean(R.styleable.CircleProgressBar_mlpb_enable_circle_background, true);

    mProgress = a.getInt(R.styleable.CircleProgressBar_mlpb_progress, 0);
    mMax = a.getInt(R.styleable.CircleProgressBar_mlpb_max, 100);
    int textVisible = a.getInt(R.styleable.CircleProgressBar_mlpb_progress_text_visibility, 1);
    if (textVisible != 1) {
        mIfDrawText = true;//from w w w .ja v  a2 s  . com
    }

    mTextPaint = new Paint();
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setAntiAlias(true);
    a.recycle();
    mProgressDrawable = new MaterialProgressDrawable(getContext(), this);
    super.setImageDrawable(mProgressDrawable);
}

From source file:com.eventer.app.view.CircleProgressBar.java

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleProgressBar, defStyleAttr, 0);
    final float density = getContext().getResources().getDisplayMetrics().density;

    mBackGroundColor = a.getColor(R.styleable.CircleProgressBar_mlpb_background_color, DEFAULT_CIRCLE_BG_LIGHT);

    mProgressColor = a.getColor(R.styleable.CircleProgressBar_mlpb_progress_color, DEFAULT_CIRCLE_BG_LIGHT);
    mColors = new int[] { mProgressColor };

    mInnerRadius = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_inner_radius, -1);

    mProgressStokeWidth = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_progress_stoke_width,
            (int) (STROKE_WIDTH_LARGE * density));
    mArrowWidth = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_arrow_width, -1);
    mArrowHeight = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_arrow_height, -1);
    mTextSize = a.getDimensionPixelOffset(R.styleable.CircleProgressBar_mlpb_progress_text_size,
            (int) (DEFAULT_TEXT_SIZE * density));
    mTextColor = a.getColor(R.styleable.CircleProgressBar_mlpb_progress_text_color, Color.BLACK);

    mShowArrow = a.getBoolean(R.styleable.CircleProgressBar_mlpb_show_arrow, false);
    mCircleBackgroundEnabled = a.getBoolean(R.styleable.CircleProgressBar_mlpb_enable_circle_background, true);

    mProgress = a.getInt(R.styleable.CircleProgressBar_mlpb_progress, 0);
    mMax = a.getInt(R.styleable.CircleProgressBar_mlpb_max, 100);
    int textVisible = a.getInt(R.styleable.CircleProgressBar_mlpb_progress_text_visibility, 1);
    if (textVisible != 1) {
        mIfDrawText = true;/*from   w  w  w.  j  a v a  2 s.c  om*/
    }

    mTextPaint = new Paint();
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setAntiAlias(true);
    a.recycle();
    mProgressDrawable = new MaterialProgressDrawable(getContext(), this);
    super.setImageDrawable(mProgressDrawable);
}