Ejemplo n.º 1
0
        public void InvalidateClipToBounds()
        {
            if (_renderer.NativeView == null)
            {
                return;
            }
            if (_renderer.NativeView.Layer != null)
            {
                /*
                 * MDCInkView
                 * From https://github.com/material-components/material-components-ios-codelabs/blob/master/MDC-111/Swift/Starter/Pods/MaterialComponents/components/Ink/src/MDCInkView.m
                 * MDCInkView uses SuperView's ShadowPath in order to mask the ripple
                 * So we calculate the rounded corners path and we set it to the ShadowPath
                 * but with ShadowOpacity to 0 in order to not overlap the MDCShadowLayer
                 */

                _renderer.NativeView.Layer.ShadowPath?.Dispose();
                if (_backgroundElement.IsRippleEnabled)
                {
                    _renderer.NativeView.Layer.ShadowOpacity = 0;
                    _renderer.NativeView.Layer.ShadowPath    = BackgroundKit
                                                               .GetRoundCornersPath(_renderer.NativeView.Layer.Bounds, _backgroundElement.CornerRadius).CGPath;
                }
                else
                {
                    _renderer.NativeView.Layer.ShadowPath = null;
                }
            }

            InvalidateSubViewsMask();
        }
Ejemplo n.º 2
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();
            FormsMaterial.Init();
            BackgroundKit.Init();

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Ejemplo n.º 3
0
        public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            Popup.Init();
            Forms.Init();
            FormsMaterial.Init();
            BackgroundKit.Init();

            LoadApplication(new App());

            return(base.FinishedLaunching(uiApplication, launchOptions));
        }
Ejemplo n.º 4
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            BackgroundKit.Init();

            Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental");
            Forms.Init();

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ToolbarResource   = Resource.Layout.Toolbar;
            TabLayoutResource = Resource.Layout.Tabbar;

            base.OnCreate(savedInstanceState);

            Forms.Init(this, savedInstanceState);
            GlideX.Init(this);
            XEPlatform.Init(this, savedInstanceState);
            FormsMaterial.Init(this, savedInstanceState);
            BackgroundKit.Init();

            LoadApplication(new App());
        }
Ejemplo n.º 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            BackgroundKit.Init();
            XEPlatform.Init(this, savedInstanceState);

            Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental");
            Forms.Init(this, savedInstanceState);

            LoadApplication(new App());
        }
Ejemplo n.º 7
0
        private void InvalidateSubViewsMask()
        {
            if (_renderer.NativeView.Subviews == null)
            {
                return;
            }

            var transform = GetMaskTransform();

            CGRect bounds;
            CGPath maskPath;

            switch (_backgroundElement.BorderStyle)
            {
            case BorderStyle.Inner:
                bounds   = _renderer.NativeView.Bounds;
                maskPath = BackgroundKit.GetRoundCornersPath(
                    bounds, _backgroundElement.CornerRadius).CGPath;
                break;

            default:
                var borderWidth = (float)_backgroundElement.BorderWidth;
                bounds   = _renderer.NativeView.Bounds.Inset(borderWidth, borderWidth);
                maskPath = BackgroundKit.GetRoundCornersPath(
                    bounds, _backgroundElement.CornerRadius, borderWidth).CGPath;
                break;
            }

            foreach (var subView in _renderer.NativeView.Subviews)
            {
                if (subView?.Layer?.Sublayers?.FirstOrDefault(
                        l => l is GradientStrokeLayer) != null)
                {
                    continue;
                }

                subView.Layer.Mask?.Dispose();
                subView.Layer.Mask = new CAShapeLayer
                {
                    Frame = _renderer.NativeView.Bounds,
                    Path  = transform == null ? maskPath : new CGPath(maskPath, transform.Value)
                };

                subView.Layer.MasksToBounds = true;
            }
        }
Ejemplo n.º 8
0
 public UIBezierPath GetRoundCornersPath(CGRect bounds) =>
 BackgroundKit.GetRoundCornersPath(bounds, _cornerRadius);