Пример #1
0
 protected void UpdateSelectedColor()
 {
     if (CellParent != null &&
         CellParent.SelectedColor != Color.Default)
     {
         SelectedColor.Color = CellParent.SelectedColor.MultiplyAlpha(0.5).ToAndroid();
         Ripple.SetColor(DrawableUtility.GetPressedColorSelector(CellParent.SelectedColor.ToAndroid()));
     }
     else
     {
         SelectedColor.Color = AColor.Argb(125, 180, 180, 180);
         Ripple.SetColor(DrawableUtility.GetPressedColorSelector(AColor.Rgb(180, 180, 180)));
     }
 }
Пример #2
0
        protected virtual void UpdateTouchFeedbackColor()
        {
            if (ViewHolder.IsHeader || CellParent.TouchFeedbackColor.IsDefault)
            {
                return;
            }
            var feedbackColor = CellParent.TouchFeedbackColor.MultiplyAlpha(0.5).ToAndroid();

            if (Foreground == null)
            {
                Foreground = DrawableUtility.CreateRipple(feedbackColor);
            }
            else
            {
                var ripple = Foreground as RippleDrawable;
                ripple.SetColor(DrawableUtility.GetPressedColorSelector(feedbackColor));
            }
        }
Пример #3
0
        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));
        }