private void Init(Android.Content.Context context, IAttributeSet attrs, int p) { TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CircleProgressBar, p, 0); float density = context.Resources.DisplayMetrics.Density; mBackGroundColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_background_color, DEFAULT_CIRCLE_BG_LIGHT); mProgressColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_progress_color, DEFAULT_CIRCLE_BG_LIGHT); mInnerRadius = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_inner_radius, -1); mProgressStokeWidth = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_progress_stoke_width, (int)(STROKE_WIDTH_LARGE * density)); mArrowWidth = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_arrow_width, -1); mArrowHeight = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_arrow_height, -1); mTextSize = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_progress_text_size, (int)(DEFAULT_TEXT_SIZE * density)); mTextColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_progress_text_color, Color.Black); mShowArrow = a.GetBoolean(Resource.Styleable.CircleProgressBar_mlpb_show_arrow, false); mCircleBackgroundEnabled = a.GetBoolean(Resource.Styleable.CircleProgressBar_mlpb_enable_circle_background, true); mProgress = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_progress, 0); mMax = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_max, 100); int textVisible = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_progress_text_visibility, 1); if (textVisible != 1) { mIfDrawText = true; } mTextPaint = new Paint(); mTextPaint.SetStyle(Paint.Style.Fill); mTextPaint.Color = mTextColor; mTextPaint.TextSize = mTextSize; mTextPaint.AntiAlias = true; a.Recycle(); mProgressDrawable = new MaterialProgressDrawale(Context, this); base.SetImageDrawable(mProgressDrawable); }
private void Init(Android.Content.Context context, IAttributeSet attrs) { TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.LoadingView); loadText = typedArray.GetString(Resource.Styleable.LoadingView_loadingText); typedArray.Recycle(); }