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 @@
+ Command="{Binding Command}"
+ BackgroundColor="{Binding Color}"/>
diff --git a/BTProgressHUDDemo/MainViewModel.cs b/BTProgressHUDDemo/MainViewModel.cs
index 423b66b..b8c8186 100644
--- a/BTProgressHUDDemo/MainViewModel.cs
+++ b/BTProgressHUDDemo/MainViewModel.cs
@@ -11,6 +11,18 @@ public class MainViewModel
float progress = -1;
NSTimer timer;
+ Color[] colors =
+ [
+ Color.FromRgb(255, 59, 48),
+ Color.FromRgb(255, 149, 0),
+ Color.FromRgb(255, 204, 0),
+ Color.FromRgb(76, 217, 100),
+ Color.FromRgb(90, 200, 250),
+ Color.FromRgb(0, 122, 255),
+ Color.FromRgb(88, 86, 214),
+ Color.FromRgb(255, 45, 85)
+ ];
+
public MainViewModel()
{
Items =
@@ -104,10 +116,10 @@ public MainViewModel()
ProgressHUDAppearance.RingColor = UIColor.Green;
ProgressHUDAppearance.RingBackgroundColor = UIColor.Brown;
- ProgressHUDAppearance.HudBackgroundColor = UIColor.Yellow;
+ ProgressHUDAppearance.HudBackgroundColor = UIColor.Brown;
ProgressHUDAppearance.HudTextColor = UIColor.Purple;
ProgressHUDAppearance.HudButtonTextColor = UIColor.Orange;
- ProgressHUDAppearance.HudCornerRadius = 2;
+ ProgressHUDAppearance.HudCornerRadius = 16;
ProgressHUDAppearance.HudTextAlignment = UITextAlignment.Left;
ProgressHUDAppearance.HudTextColor = UIColor.Cyan;
ProgressHUDAppearance.HudToastBackgroundColor = UIColor.Blue;
@@ -188,6 +200,7 @@ public MainViewModel()
CommandItem Create(string text, Action action, bool timedKill) => new CommandItem(
text,
+ colors[Random.Shared.Next(colors.Length)],
new Command(() =>
{
try
@@ -224,6 +237,7 @@ void KillAfter()
public record CommandItem(
string Text,
+ Color Color,
ICommand Command
);
}
diff --git a/README.md b/README.md
index 038ac52..1162853 100644
--- a/README.md
+++ b/README.md
@@ -89,6 +89,9 @@ control the following options:
- Corner Radius
- Background Color
+- Background Visual Effect (overrides background color)
+- Border Thickness
+- Border Color
- Image Tint Color
- Text Font
- Button Font