UIFont FontForProgressType(RadialProgressViewStyle progressType) { switch (progressType) { case RadialProgressViewStyle.Big: return(UIFont.FromName("Helvetica-Bold", 76f)); case RadialProgressViewStyle.Small: return(UIFont.FromName("Helvetica-Bold", 12f)); default: return(UIFont.FromName("Helvetica-Bold", 76f)); } }
void Init(float minValue, float maxValue, float value, RadialProgressViewStyle progressType, Color progressColor) { this.progressType = progressType; this.minValue = minValue; this.maxValue = maxValue; currentValue = value; valueText = GetTextByValue(currentValue); this.progressColor = progressColor; cachedRectF = new RectF(); cachedTransformMatrix = new Matrix(); progressPath = new Path(); InitPaints(); }
/// <summary> /// </summary> /// <param name='progressType'> /// Progress type. /// </param> public RadialProgressView(Func <nfloat, string> labelText = null, RadialProgressViewStyle progressType = RadialProgressViewStyle.Big) { this.progressType = progressType; LabelTextDelegate = labelText; radialProgressLayer = GetRadialLayerByType(progressType); Bounds = radialProgressLayer.BackBounds; CenterPoint = new CGPoint(Bounds.GetMidX(), Bounds.GetMidY()); BackgroundColor = UIColor.Clear; UserInteractionEnabled = false; MinValue = DefaultMinValue; MaxValue = DefaultMaxValue; InitSubviews(); }
/// <summary> /// </summary> /// <param name='progressType'> /// Progress type. /// </param> public RadialProgressView(Func <nfloat, string> labelText = null, RadialProgressViewStyle progressType = RadialProgressViewStyle.Big, UIColor bgprogressColor1 = null, int width = 10) { this.progressType = progressType; LabelTextDelegate = labelText; radialProgressLayer = GetRadialLayerByType(progressType); Bounds = radialProgressLayer.BackBounds; bgprogressColor = bgprogressColor1; CenterPoint = new CGPoint(Bounds.GetMidX(), Bounds.GetMidY()); UserInteractionEnabled = false; Layerwidth = width; MinValue = DefaultMinValue; MaxValue = DefaultMaxValue; radialProgressLayer.Layerwidth = Layerwidth; InitSubviews(); }
RadialProgressLayer GetRadialLayerByType(RadialProgressViewStyle progressType) { switch (progressType) { case RadialProgressViewStyle.Big: return(new BigRadialProgressLayer()); case RadialProgressViewStyle.Small: return(new SmallRadialProgressLayer()); case RadialProgressViewStyle.Tiny: return(new TinyRadialProgressLayer()); default: return(new BigRadialProgressLayer()); } }
RadialProgressLayer GetRadialLayerByType(RadialProgressViewStyle progressType) { switch (progressType) { case RadialProgressViewStyle.Big: //BigRadialProgressLay int width = 90 - CType.width * 10; return(new BigRadialProgressLayer(width)); //case RadialProgressViewStyle.Small: // return new SmallRadialProgressLayer(); //case RadialProgressViewStyle.Tiny: //return new TinyRadialProgressLayer(); default: return(new BigRadialProgressLayer(CType.width)); } }
public AttributesParser(IAttributeSet attributes) { MinValue = ParseFloat(attributes, "min_value", 0); MaxValue = ParseFloat(attributes, "max_value", 1); Value = ParseFloat(attributes, "value", MinValue); LabelHidden = attributes.GetAttributeBooleanValue(null, "hide_label", false); var typeAttribute = attributes.GetAttributeValue(null, "progress_type"); var progressColorAttribute = attributes.GetAttributeValue(null, "progress_color"); if (typeAttribute == null || typeAttribute == "big") { ProgressType = RadialProgressViewStyle.Big; } else if (typeAttribute == "small") { ProgressType = RadialProgressViewStyle.Small; } else if (typeAttribute == "tiny") { ProgressType = RadialProgressViewStyle.Tiny; } else { throw new ArgumentException("Unrecognized RadialProgress type '" + typeAttribute + "'. Must be either 'big', 'small' or 'tiny'.", "progress_type"); } if (!string.IsNullOrEmpty(progressColorAttribute)) { try { ProgressColor = Color.ParseColor(progressColorAttribute); } catch (AndroidException) { throw new ArgumentException("Wrong color string '" + progressColorAttribute + "'. Must be either '#RRGGBB' or '#AARRGGBB'.", "progress_color"); } } }
public CleanRadialProgressView(Context context, float minValue, float maxValue, RadialProgressViewStyle progressType, Color progressColor, Func <float, string> labelTextFunc = null) : base(context) { this.LabelTextDelegate = labelTextFunc; Init(minValue, maxValue, 0, progressType, progressColor); }
public CleanRadialProgressView(Context context, float minValue = 0f, float maxValue = 1f, RadialProgressViewStyle progressType = RadialProgressViewStyle.Big, Func <float, string> labelTextFunc = null) : base(context) { this.LabelTextDelegate = labelTextFunc; Init(minValue, maxValue, 0, progressType, DefaultColor); }