UI adjustment, add json proxy

This commit is contained in:
2020-05-11 19:51:14 +08:00
parent 134affddaa
commit 6b28ade15a
19 changed files with 220 additions and 186 deletions

View File

@ -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)