示例#1
0
        protected override bool DrawChild(Canvas canvas, AView child, long drawingTime)
        {
            bool returnValue = base.DrawChild(canvas, child, drawingTime);

            if (_scrimPaint != null && ((LayoutParams)child.LayoutParameters).Gravity == (int)GravityFlags.NoGravity)
            {
                if (_previousHeight != Height || _previousWidth != Width)
                {
                    _scrimPaint.UpdateBackground(_scrimBrush, Height, Width);
                    _previousHeight = Height;
                    _previousWidth  = Width;
                }

                _scrimPaint.Alpha = _scrimOpacity;
                canvas.DrawRect(0, 0, Width, Height, _scrimPaint);
            }

            if (!_flyoutFirstDrawPassFinished && _flyoutContent != null)
            {
                if (child == _flyoutContent?.AndroidView)
                {
                    _flyoutFirstDrawPassFinished = true;
                }

                if (this.IsDrawerOpen(_flyoutContent.AndroidView) != _shellContext.Shell.FlyoutIsPresented)
                {
                    UpdateDrawerState();
                }
            }

            return(returnValue);
        }
示例#2
0
        void UpdateScrim(Brush backdrop)
        {
            _scrimBrush = backdrop;

            if (_behavior == FlyoutBehavior.Locked)
            {
                SetScrimColor(Colors.Transparent.ToPlatform());
                _scrimPaint = null;
            }
            else
            {
                if (backdrop is SolidColorBrush solidColor)
                {
                    _scrimPaint = null;
                    var backdropColor = solidColor.Color;
                    if (backdropColor == null)
                    {
                        unchecked
                        {
                            SetScrimColor((int)DefaultScrimColor);
                        }
                    }
                    else
                    {
                        SetScrimColor(backdropColor.ToPlatform());
                    }
                }
                else
                {
                    _scrimPaint = _scrimPaint ?? new Paint();
                    _scrimPaint.UpdateBackground(_scrimBrush, Height, Width);
                    SetScrimColor(Colors.Transparent.ToPlatform());
                }
            }
        }
示例#3
0
        protected override bool DrawChild(Canvas canvas, AView child, long drawingTime)
        {
            bool returnValue = base.DrawChild(canvas, child, drawingTime);

            if (_scrimPaint != null && ((LayoutParams)child.LayoutParameters).Gravity == (int)GravityFlags.NoGravity)
            {
                if (_previousHeight != Height || _previousWidth != Width)
                {
                    _scrimPaint.UpdateBackground(_scrimBrush, Height, Width);
                    _previousHeight = Height;
                    _previousWidth  = Width;
                }

                _scrimPaint.Alpha = _scrimOpacity;
                canvas.DrawRect(0, 0, Width, Height, _scrimPaint);
            }

            return(returnValue);
        }