-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
ActivityIndicatorHandler.cs
48 lines (40 loc) · 1.59 KB
/
ActivityIndicatorHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#if __IOS__ || MACCATALYST
using PlatformView = Microsoft.Maui.Platform.MauiActivityIndicator;
#elif MONOANDROID
using PlatformView = Android.Widget.ProgressBar;
#elif WINDOWS
using PlatformView = Microsoft.UI.Xaml.Controls.ProgressRing;
#elif TIZEN
using PlatformView = ElmSharp.ProgressBar;
#elif (NETSTANDARD || !PLATFORM) || (NET6_0 && !IOS && !ANDROID && !TIZEN)
using PlatformView = System.Object;
#endif
namespace Microsoft.Maui.Handlers
{
public partial class ActivityIndicatorHandler : IActivityIndicatorHandler
{
public static IPropertyMapper<IActivityIndicator, IActivityIndicatorHandler> Mapper = new PropertyMapper<IActivityIndicator, IActivityIndicatorHandler>(ViewHandler.ViewMapper)
{
[nameof(IActivityIndicator.Color)] = MapColor,
[nameof(IActivityIndicator.IsRunning)] = MapIsRunning,
#if __ANDROID__
// Android does not have the concept of IsRunning, so we are leveraging the Visibility
[nameof(IActivityIndicator.Visibility)] = MapIsRunning,
#endif
#if WINDOWS
[nameof(IActivityIndicator.Width)] = MapWidth,
[nameof(IActivityIndicator.Height)] = MapHeight,
[nameof(IActivityIndicator.Background)] = MapBackground,
#endif
};
public static CommandMapper<IActivityIndicator, IActivityIndicatorHandler> CommandMapper = new(ViewCommandMapper);
public ActivityIndicatorHandler() : base(Mapper, CommandMapper)
{
}
public ActivityIndicatorHandler(IPropertyMapper mapper) : base(mapper ?? Mapper, CommandMapper)
{
}
IActivityIndicator IActivityIndicatorHandler.VirtualView => VirtualView;
PlatformView IActivityIndicatorHandler.PlatformView => PlatformView;
}
}