UI adjustment, add json proxy
This commit is contained in:
		@@ -85,6 +85,7 @@ namespace Pixiview.iOS.Renderers
 | 
			
		||||
                }
 | 
			
		||||
                if (Element is AdaptedPage page)
 | 
			
		||||
                {
 | 
			
		||||
                    AppShell.Current?.SetStatusBarHeight(UIApplication.SharedApplication.StatusBarFrame.Height);
 | 
			
		||||
                    page.OnOrientationChanged((Orientation)lastOrientation);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -16,28 +16,10 @@ namespace Pixiview.iOS.Renderers
 | 
			
		||||
 | 
			
		||||
        protected override IShellSectionRenderer CreateShellSectionRenderer(ShellSection shellSection)
 | 
			
		||||
        {
 | 
			
		||||
            var renderer = new AppShellSectionRenderer(this);
 | 
			
		||||
            var renderer = base.CreateShellSectionRenderer(shellSection);   // new AppShellSectionRenderer(this);
 | 
			
		||||
            if (renderer is ShellSectionRenderer sr && Element is AppShell shell)
 | 
			
		||||
            {
 | 
			
		||||
                shell.SetNavigationBarHeight(
 | 
			
		||||
                    sr.NavigationBar.Frame.Height,
 | 
			
		||||
                    UIApplication.SharedApplication.StatusBarFrame.Height);
 | 
			
		||||
            }
 | 
			
		||||
            return renderer;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [SuppressMessage("Code Notifications", "XI0002:Notifies you from using newer Apple APIs when targeting an older OS version", Justification = "<Pending>")]
 | 
			
		||||
        protected override IShellItemRenderer CreateShellItemRenderer(ShellItem item)
 | 
			
		||||
        {
 | 
			
		||||
            var renderer = base.CreateShellItemRenderer(item);
 | 
			
		||||
            if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
 | 
			
		||||
            {
 | 
			
		||||
                if (renderer.ViewController is UITabBarController controller)
 | 
			
		||||
                {
 | 
			
		||||
                    var tabBar = controller.TabBar;
 | 
			
		||||
                    tabBar.TintColor = UIColor.LabelColor;
 | 
			
		||||
                    tabBar.UnselectedItemTintColor = UIColor.SecondaryLabelColor;
 | 
			
		||||
                }
 | 
			
		||||
                shell.SetNavigationBarHeight(sr.NavigationBar.Frame.Height);
 | 
			
		||||
            }
 | 
			
		||||
            return renderer;
 | 
			
		||||
        }
 | 
			
		||||
@@ -52,6 +34,11 @@ namespace Pixiview.iOS.Renderers
 | 
			
		||||
            return new AppShellTabBarAppearanceTracker();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override IShellNavBarAppearanceTracker CreateNavBarAppearanceTracker()
 | 
			
		||||
        {
 | 
			
		||||
            return new AppShellNavBarAppearanceTracker();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override void UpdateBackgroundColor()
 | 
			
		||||
        {
 | 
			
		||||
            NativeView.BackgroundColor = Color.Transparent.ToUIColor();
 | 
			
		||||
@@ -76,73 +63,6 @@ namespace Pixiview.iOS.Renderers
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class AppShellTabBarAppearanceTracker : IShellTabBarAppearanceTracker
 | 
			
		||||
    {
 | 
			
		||||
        UIColor _defaultBarTint;
 | 
			
		||||
        UIColor _defaultTint;
 | 
			
		||||
        UIColor _defaultUnselectedTint;
 | 
			
		||||
 | 
			
		||||
        public void Dispose()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void ResetAppearance(UITabBarController controller)
 | 
			
		||||
        {
 | 
			
		||||
            if (_defaultTint == null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            var tabBar = controller.TabBar;
 | 
			
		||||
            tabBar.BarTintColor = _defaultBarTint;
 | 
			
		||||
            tabBar.TintColor = _defaultTint;
 | 
			
		||||
            tabBar.UnselectedItemTintColor = _defaultUnselectedTint;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [SuppressMessage("Code Notifications", "XI0002:Notifies you from using newer Apple APIs when targeting an older OS version", Justification = "<Pending>")]
 | 
			
		||||
        public void SetAppearance(UITabBarController controller, ShellAppearance appearance)
 | 
			
		||||
        {
 | 
			
		||||
            IShellAppearanceElement appearanceElement = appearance;
 | 
			
		||||
            //var backgroundColor = appearanceElement.EffectiveTabBarBackgroundColor;
 | 
			
		||||
            var unselectedColor = appearanceElement.EffectiveTabBarUnselectedColor;
 | 
			
		||||
            var tintColor = appearanceElement.EffectiveTabBarForegroundColor; // appearanceElement.EffectiveTabBarTitleColor;
 | 
			
		||||
 | 
			
		||||
            var tabBar = controller.TabBar;
 | 
			
		||||
            //bool operatingSystemSupportsUnselectedTint = Forms.IsiOS10OrNewer;
 | 
			
		||||
 | 
			
		||||
            if (_defaultTint == null)
 | 
			
		||||
            {
 | 
			
		||||
                _defaultBarTint = tabBar.BarTintColor;
 | 
			
		||||
                _defaultTint = tabBar.TintColor;
 | 
			
		||||
 | 
			
		||||
                //if (operatingSystemSupportsUnselectedTint)
 | 
			
		||||
                {
 | 
			
		||||
                    _defaultUnselectedTint = tabBar.UnselectedItemTintColor;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //if (!backgroundColor.IsDefault)
 | 
			
		||||
            //    tabBar.BarTintColor = backgroundColor.ToUIColor();
 | 
			
		||||
 | 
			
		||||
            if (!tintColor.IsDefault)
 | 
			
		||||
                tabBar.TintColor = tintColor.ToUIColor();
 | 
			
		||||
            //if (operatingSystemSupportsUnselectedTint)
 | 
			
		||||
            {
 | 
			
		||||
                if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
 | 
			
		||||
                {
 | 
			
		||||
                    //tabBar.UnselectedItemTintColor = UIColor.TertiaryLabelColor;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    if (!unselectedColor.IsDefault)
 | 
			
		||||
                        tabBar.UnselectedItemTintColor = unselectedColor.ToUIColor();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void UpdateLayout(UITabBarController controller)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class AppShellSectionRenderer : ShellSectionRenderer
 | 
			
		||||
    {
 | 
			
		||||
        public AppShellSectionRenderer(IShellContext context) : base(context)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										86
									
								
								Pixiview.iOS/Renderers/BlurryPanelRenderer.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								Pixiview.iOS/Renderers/BlurryPanelRenderer.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,86 @@
 | 
			
		||||
using CoreAnimation;
 | 
			
		||||
using Pixiview.iOS.Renderers;
 | 
			
		||||
using Pixiview.UI;
 | 
			
		||||
using UIKit;
 | 
			
		||||
using Xamarin.Forms;
 | 
			
		||||
using Xamarin.Forms.Platform.iOS;
 | 
			
		||||
 | 
			
		||||
[assembly: ExportRenderer(typeof(BlurryPanel), typeof(BlurryPanelRenderer))]
 | 
			
		||||
namespace Pixiview.iOS.Renderers
 | 
			
		||||
{
 | 
			
		||||
    public class BlurryPanelRenderer : ViewRenderer<BlurryPanel, UIVisualEffectView>
 | 
			
		||||
    {
 | 
			
		||||
        private UIVisualEffectView nativeControl;
 | 
			
		||||
        private CALayer bottom;
 | 
			
		||||
 | 
			
		||||
        protected override void OnElementChanged(ElementChangedEventArgs<BlurryPanel> e)
 | 
			
		||||
        {
 | 
			
		||||
            base.OnElementChanged(e);
 | 
			
		||||
 | 
			
		||||
            if (e.OldElement != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (bottom != null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (bottom.SuperLayer != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        bottom.RemoveFromSuperLayer();
 | 
			
		||||
                    }
 | 
			
		||||
                    bottom.Dispose();
 | 
			
		||||
                    bottom = null;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (e.NewElement != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (Control == null)
 | 
			
		||||
                {
 | 
			
		||||
                    var blur = UIBlurEffect.FromStyle(UIBlurEffectStyle.SystemMaterial);
 | 
			
		||||
                    nativeControl = new UIVisualEffectView(blur)
 | 
			
		||||
                    {
 | 
			
		||||
                        Frame = Frame
 | 
			
		||||
                    };
 | 
			
		||||
                    SetNativeControl(nativeControl);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public override void LayoutSubviews()
 | 
			
		||||
        {
 | 
			
		||||
            base.LayoutSubviews();
 | 
			
		||||
 | 
			
		||||
            if (nativeControl != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (bottom == null)
 | 
			
		||||
                {
 | 
			
		||||
                    bottom = new CALayer
 | 
			
		||||
                    {
 | 
			
		||||
                        BackgroundColor = UIColor.White.CGColor,
 | 
			
		||||
                        ShadowColor = UIColor.Black.CGColor,
 | 
			
		||||
                        ShadowOpacity = 1.0f
 | 
			
		||||
                    };
 | 
			
		||||
                }
 | 
			
		||||
                if (bottom.SuperLayer == null)
 | 
			
		||||
                {
 | 
			
		||||
                    nativeControl.Layer.InsertSublayer(bottom, 0);
 | 
			
		||||
                }
 | 
			
		||||
                bottom.Frame = new CoreGraphics.CGRect(0, Frame.Height - 5, Frame.Width, 5);
 | 
			
		||||
                nativeControl.Frame = Frame;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override void Dispose(bool disposing)
 | 
			
		||||
        {
 | 
			
		||||
            if (bottom != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (bottom.SuperLayer != null)
 | 
			
		||||
                {
 | 
			
		||||
                    bottom.RemoveFromSuperLayer();
 | 
			
		||||
                }
 | 
			
		||||
                bottom.Dispose();
 | 
			
		||||
                bottom = null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            base.Dispose(disposing);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Pixiview.iOS.Renderers;
 | 
			
		||||
using Pixiview.iOS.Renderers;
 | 
			
		||||
using Pixiview.UI;
 | 
			
		||||
using Xamarin.Forms;
 | 
			
		||||
using Xamarin.Forms.Platform.iOS;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user