diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5fdf181..07fc6db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: [push] env: xcodeVersion: 26.0.1 - dotnetVersion: 10.0.100-rc.1.25451.107 + dotnetVersion: 10.0.100-rc.2.25502.107 jobs: build: diff --git a/BTProgressHUD/ProgressHUD.cs b/BTProgressHUD/ProgressHUD.cs index 3389f23..b614151 100644 --- a/BTProgressHUD/ProgressHUD.cs +++ b/BTProgressHUD/ProgressHUD.cs @@ -256,20 +256,23 @@ UIView HudView return _hudView; UIView hudView; - if (ProgressHUDAppearance.HudBackgroundColor.Equals(UIColor.Clear)) + if (ProgressHUDAppearance.HudBackgroundVisualEffect != null) { hudView = new UIView { - BackgroundColor = ProgressHUDAppearance.HudBackgroundColor + BackgroundColor = UIColor.Clear, }; + + hudView.AddSubview(new UIVisualEffectView(ProgressHUDAppearance.HudBackgroundVisualEffect) + { + AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight + }); } else { - hudView = new UIToolbar + hudView = new UIView { - Translucent = true, - BarTintColor = ProgressHUDAppearance.HudBackgroundColor, - BackgroundColor = ProgressHUDAppearance.HudBackgroundColor + BackgroundColor = ProgressHUDAppearance.HudBackgroundColor, }; } @@ -277,6 +280,16 @@ UIView HudView UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleLeftMargin; + if (ProgressHUDAppearance.HudBorderThickness > 0) + { + hudView.Layer.BorderWidth = ProgressHUDAppearance.HudBorderThickness; + } + + if (ProgressHUDAppearance.HudBorderColor != null) + { + hudView.Layer.BorderColor = ProgressHUDAppearance.HudBorderColor.CGColor; + } + hudView.Layer.CornerRadius = ProgressHUDAppearance.HudCornerRadius; hudView.Layer.MasksToBounds = true; diff --git a/BTProgressHUD/ProgressHUDAppearance.cs b/BTProgressHUD/ProgressHUDAppearance.cs index c94c519..cba9c68 100644 --- a/BTProgressHUD/ProgressHUDAppearance.cs +++ b/BTProgressHUD/ProgressHUDAppearance.cs @@ -14,6 +14,11 @@ public static class ProgressHUDAppearance OperatingSystem.IsIOSVersionAtLeast(13, 0) || OperatingSystem.IsMacCatalystVersionAtLeast(13) ? UIColor.Label.ColorWithAlpha(0.8f) : UIColor.FromWhiteAlpha(0.0f, 0.8f); + + public static UIVisualEffect DefaultBackgroundVisualEffect { get; } = + OperatingSystem.IsIOSVersionAtLeast(26, 0) || OperatingSystem.IsMacCatalystVersionAtLeast(26) ? + UIGlassEffect.Create(UIGlassEffectStyle.Regular) : + UIBlurEffect.FromStyle(UIBlurEffectStyle.Regular); public static UIColor DefaultHudToastBackgroundColor { get; } = UIColor.Clear; public static UIFont DefaultHudFont { get; } = UIFont.BoldSystemFontOfSize(16f); @@ -28,7 +33,19 @@ public static class ProgressHUDAppearance public const float DefaultRingRadius = 14f; public const float DefaultRingThickness = 1f; - public const float DefaultHudCornerRadius = 10f; + public static float DefaultHudCornerRadius { get; } = + OperatingSystem.IsIOSVersionAtLeast(26, 0) || OperatingSystem.IsMacCatalystVersionAtLeast(26) ? + 20f : 10f; + + public static float DefaultHudBorderThickness { get; } = + OperatingSystem.IsIOSVersionAtLeast(26, 0) || OperatingSystem.IsMacCatalystVersionAtLeast(26) ? + 1f : 0f; + + public static UIColor DefaultHudBorderColor { get; } = + OperatingSystem.IsIOSVersionAtLeast(26, 0) || OperatingSystem.IsMacCatalystVersionAtLeast(26) ? + UIColor.FromWhiteAlpha(1.0f, 0.3f) : + UIColor.Clear; + public const double DefaultProgressUpdateInterval = 300; public const float DefaultActivityIndicatorScale = 1f; @@ -66,11 +83,26 @@ public static class ProgressHUDAppearance /// Get or set hud corner radius /// public static float HudCornerRadius { get; set; } = DefaultHudCornerRadius; - + /// - /// Get or set hud background color + /// Get or set hud background color. This only works if HudBackgroundVisualEffect is null /// public static UIColor HudBackgroundColor { get; set; } = DefaultHudBackgroundColor; + + /// + /// Get or set hud border thickness + /// + public static float HudBorderThickness { get; set; } = DefaultHudBorderThickness; + + /// + /// Get or set hud border color + /// + public static UIColor HudBorderColor { get; set; } = DefaultHudBorderColor; + + /// + /// Get or set hud background visual effect + /// + public static UIVisualEffect? HudBackgroundVisualEffect { get; set; } = DefaultBackgroundVisualEffect; /// /// Get or set image tint color @@ -127,6 +159,9 @@ public static void ResetToDefaults() HudCornerRadius = DefaultHudCornerRadius; HudBackgroundColor = DefaultHudBackgroundColor; + HudBorderThickness = DefaultHudBorderThickness; + HudBackgroundVisualEffect = DefaultBackgroundVisualEffect; + HudBorderThickness = DefaultHudBorderThickness; HudImageTintColor = DefaultForegroundColor; HudToastBackgroundColor = DefaultHudToastBackgroundColor; HudFont = DefaultHudFont; diff --git a/BTProgressHUDDemo/MainPage.xaml b/BTProgressHUDDemo/MainPage.xaml index 2ddb54c..ea69775 100644 --- a/BTProgressHUDDemo/MainPage.xaml +++ b/BTProgressHUDDemo/MainPage.xaml @@ -16,7 +16,8 @@