コード例 #1
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));
            }
        }
コード例 #2
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));
        }