public void SetColor(AColor?backgroundColor) { _backgroundColor = backgroundColor; SetShaderFactory(null); InvalidateSelf(); }
public void SetColor(Color color) { _dirty = true; _color = color == Color.Default ? null : (AColor?)color.ToAndroid(); InvalidateSelf(); }
public void SetBorderBrush(RadialGradientPaint radialGradientPaint) { _invalidatePath = true; _borderColor = null; _stroke = radialGradientPaint; InitializeBorderIfNeeded(); InvalidateSelf(); }
public void SetBackground(RadialGradientPaint radialGradientPaint) { _invalidatePath = true; _backgroundColor = null; _background = radialGradientPaint; InitializeBorderIfNeeded(); InvalidateSelf(); }
public void SetStroke(double strokeWidth, Color strokeColor) { _dirty = true; _strokeColor = strokeColor == Color.Default ? null : (AColor?)strokeColor.ToAndroid(); _strokeWidth = (float)(strokeWidth * _density * 2); EnsureStrokeAlloc(); InvalidateSelf(); }
public void SetBorderColor(AColor?borderColor) { if (_borderColor == borderColor) { return; } _borderColor = borderColor; InvalidateSelf(); }
public void SetBackgroundColor(AColor?backgroundColor) { if (_backgroundColor == backgroundColor) { return; } _backgroundColor = backgroundColor; InvalidateSelf(); }
public void SetBorderBrush(SolidPaint solidPaint) { _invalidatePath = true; _borderColor = null; var borderColor = solidPaint.Color == null ? (AColor?)null : solidPaint.Color.ToPlatform(); _stroke = null; SetBorderColor(borderColor); }
public void SetPaint(RadialGradientPaint radialGradientPaint) { var center = radialGradientPaint.Center; float centerX = (float)center.X; float centerY = (float)center.Y; float radius = (float)radialGradientPaint.Radius; var data = GetGradientPaintData(radialGradientPaint); var shader = new RadialGradientData(data.Colors, data.Offsets, centerX, centerY, radius); _backgroundColor = null; SetShaderFactory(new RadialGradientShaderFactory(shader)); }
public void SetBorderBrush(LinearGradientPaint linearGradientPaint) { if (_stroke == linearGradientPaint) { return; } _invalidatePath = true; _borderColor = null; _stroke = linearGradientPaint; InitializeBorderIfNeeded(); InvalidateSelf(); }
public void SetBackground(LinearGradientPaint linearGradientPaint) { if (_background == linearGradientPaint) { return; } _invalidatePath = true; _backgroundColor = null; _background = linearGradientPaint; InitializeBorderIfNeeded(); InvalidateSelf(); }
public void SetPaint(LinearGradientPaint linearGradientPaint) { var p1 = linearGradientPaint.StartPoint; var x1 = (float)p1.X; var y1 = (float)p1.Y; var p2 = linearGradientPaint.EndPoint; var x2 = (float)p2.X; var y2 = (float)p2.Y; var data = GetGradientPaintData(linearGradientPaint); var shader = new LinearGradientData(data.Colors, data.Offsets, x1, y1, x2, y2); _backgroundColor = null; SetShaderFactory(new LinearGradientShaderFactory(shader)); }
public void SetBackground(SolidPaint solidPaint) { _invalidatePath = true; _backgroundColor = null; _background = null; if (solidPaint.Color == null) { SetDefaultBackgroundColor(); } else { var backgroundColor = solidPaint.Color.ToPlatform(); SetBackgroundColor(backgroundColor); } }
// TODO: NET7 make public for net7.0 internal void SetEmptyBorderBrush() { _invalidatePath = true; if (_backgroundColor != null) { _borderColor = _backgroundColor.Value; _stroke = null; } else { _borderColor = null; if (_background != null) { SetBorderBrush(_background); } } InitializeBorderIfNeeded(); InvalidateSelf(); }
void SetDefaultBackgroundColor() { using (var background = new TypedValue()) { if (_context == null || _context.Theme == null || _context.Resources == null) { return; } if (_context.Theme.ResolveAttribute(global::Android.Resource.Attribute.WindowBackground, background, true)) { var resource = _context.Resources.GetResourceTypeName(background.ResourceId); var type = resource?.ToLower(); if (type == "color") { var color = new AColor(ContextCompat.GetColor(_context, background.ResourceId)); _backgroundColor = color; } } } }
protected RippleDrawable CreateRippleDrawable(AColor?color = null) { using var sel = new StateListDrawable(); sel.AddState(new[] { Android.Resource.Attribute.StateSelected }, SelectedColor ); sel.AddState(new[] { -Android.Resource.Attribute.StateSelected }, BackgroundColor ); sel.SetExitFadeDuration(250); sel.SetEnterFadeDuration(250); AColor rippleColor = color ?? CellParent?.SelectedColor.ToAndroid() ?? SVConstants.Cell.Ripple.ToAndroid(); return(DrawableUtility.CreateRipple(rippleColor, sel)); }
public void SetBorderColor(AColor?borderColor) { _borderColor = borderColor; InvalidateSelf(); }
public void SetColor(AColor backgroundColor) { _backgroundColor = backgroundColor; InvalidateSelf(); }