* Pixiview/UI/CircleUIs.cs:

* Pixiview.iOS/Pixiview.iOS.csproj:
* Pixiview.iOS/Renderers/RoundLabelRenderer.cs:
* Pixiview.iOS/Renderers/CircleImageRenderer.cs: custom round corner
  controls

* Pixiview/App.xaml:
* Pixiview/Utils/Converters.cs:
* Pixiview/GlobalSuppressions.cs:
* Pixiview/UI/StyleDefinition.cs:

* Pixiview/UI/AdaptedPage.cs:
* Pixiview.iOS/Renderers/AdaptedPageRenderer.cs: observe orientation

* Pixiview/MainPage.xaml:
* Pixiview/Utils/Stores.cs:
* Pixiview/MainPage.xaml.cs:
* Pixiview/Utils/IllustData.cs: data and UI adjust
This commit is contained in:
2020-05-05 01:53:33 +08:00
parent e7fbee8d41
commit 66f0c1ba1b
14 changed files with 536 additions and 30 deletions

View File

@@ -1,13 +1,86 @@
using Xamarin.Forms;
using System;
using Xamarin.Essentials;
using Xamarin.Forms;
namespace Pixiview.UI
{
public static class StyleDefinition
{
public static readonly double FontSizeTitle = 18.0;
public static readonly double FontSizeTitleIcon = 24.0;
public const double FontSizeTitle = 18.0;
public const double FontSizeTitleIcon = 24.0;
public static readonly Thickness HorizonLeft10 = new Thickness(10, 0, 0, 0);
public static readonly Thickness HorizonRight10 = new Thickness(0, 0, 10, 0);
public static readonly Thickness LeftBottom10 = new Thickness(10, 0, 0, 10);
public const string IconLayer = "\uf302";
private static bool? _isFullscreenDevice;
public static bool IsFullscreenDevice
{
get
{
if (_isFullscreenDevice != null)
{
return _isFullscreenDevice.Value;
}
if (Device.RuntimePlatform == Device.iOS)
{
try
{
var model = DeviceInfo.Model;
if (model == "iPhone10,3")
{
// iPhone X
_isFullscreenDevice = true;
}
else if (model.StartsWith("iPhone"))
{
var vs = model.Substring(6).Split(',');
if (vs.Length == 2 && int.TryParse(vs[0], out int main) && int.TryParse(vs[1], out int sub))
{
// iPhone X/XS/XR or iPhone 11
_isFullscreenDevice = (main == 10 && sub >= 6) || (main > 10);
}
else
{
_isFullscreenDevice = false;
}
}
else if (model.StartsWith("iPad8,"))
{
// iPad 11-inch or 12.9-inch (3rd+)
_isFullscreenDevice = true;
}
#if DEBUG
else
{
// iPad or Simulator
var name = DeviceInfo.Name;
_isFullscreenDevice = name.StartsWith("iPhone X")
|| name.StartsWith("iPhone 11")
|| name.StartsWith("iPad Pro (11-inch)")
|| name.StartsWith("iPad Pro (12.9-inch) (3rd generation)")
|| name.StartsWith("iPad Pro (12.9-inch) (4th generation)");
}
#endif
}
catch (Exception ex)
{
App.DebugError("device.get", $"failed to get the device model. {ex.Message}");
}
}
else
{
// TODO:
_isFullscreenDevice = false;
}
if (_isFullscreenDevice == null)
{
_isFullscreenDevice = false;
}
return _isFullscreenDevice.Value;
}
}
}
}