ui adjustment

This commit is contained in:
2020-05-05 12:13:50 +08:00
parent 0ce7757ec4
commit fdf4c128af
18 changed files with 583 additions and 84 deletions

View File

@ -1,5 +1,8 @@
using Pixiview.iOS.Services;
using System.Diagnostics.CodeAnalysis;
using Pixiview.iOS.Services;
using Pixiview.Utils;
using UIKit;
using Xamarin.Essentials;
using Xamarin.Forms;
[assembly: Dependency(typeof(EnvironmentService))]
@ -7,6 +10,32 @@ namespace Pixiview.iOS.Services
{
public class EnvironmentService : IEnvironmentService
{
[SuppressMessage("Code Notifications", "XI0002:Notifies you from using newer Apple APIs when targeting an older OS version", Justification = "<Pending>")]
public Theme GetApplicationTheme()
{
if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0))
{
var currentController = Platform.GetCurrentUIViewController();
if (currentController == null)
{
return Theme.Light;
}
var style = currentController.TraitCollection.UserInterfaceStyle;
if (style == UIUserInterfaceStyle.Dark)
{
return Theme.Dark;
}
else
{
return Theme.Light;
}
}
else
{
return Theme.Light;
}
}
public EnvironmentParameter GetEnvironment()
{
return new EnvironmentParameter
@ -18,5 +47,10 @@ namespace Pixiview.iOS.Services
IconLeft = "\uf104" // for android, it's "\uf060"
};
}
public void SetStatusBarColor(Color color)
{
// nothing need to do
}
}
}