зеркало из https://github.com/jsuarezruiz/HotUI.git
Коммит
74ed3b5a0c
|
@ -12,7 +12,8 @@ namespace HotUI.Samples
|
|||
[Body]
|
||||
View body()
|
||||
{
|
||||
if (isLoading) return new Text(() => "Loading...");
|
||||
//if (isLoading) return new Text(() => "Loading...");
|
||||
if (isLoading) return new ActivityIndicator().Color(Color.Fuchsia);
|
||||
|
||||
if (reports.Value.Count == 0) return new Button(() => "Generate Report", async () =>
|
||||
{
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using Android.Content;
|
||||
using AndroidApp = Android.Widget;
|
||||
|
||||
namespace HotUI.Android.Handlers
|
||||
{
|
||||
public class ActivityIndicatorHandler : AbstractControlHandler<ActivityIndicator, AndroidApp.ProgressBar>
|
||||
{
|
||||
public static readonly PropertyMapper<ActivityIndicator> Mapper = new PropertyMapper<ActivityIndicator>(ViewHandler.Mapper)
|
||||
{
|
||||
[EnvironmentKeys.Colors.Color] = MapColorProperty,
|
||||
};
|
||||
|
||||
private static Color DefaultColor;
|
||||
|
||||
public ActivityIndicatorHandler() : base(Mapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override AndroidApp.ProgressBar CreateView(Context context)
|
||||
{
|
||||
var activityIndicator = new AndroidApp.ProgressBar(context);
|
||||
activityIndicator.Indeterminate = true;
|
||||
|
||||
if(DefaultColor == null)
|
||||
{
|
||||
// get default color
|
||||
DefaultColor = activityIndicator.ProgressTintList.DefaultColor.ToColor();
|
||||
}
|
||||
|
||||
return activityIndicator;
|
||||
}
|
||||
|
||||
protected override void DisposeView(AndroidApp.ProgressBar nativeView)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void MapColorProperty(IViewHandler viewHandler, ActivityIndicator virtualView)
|
||||
{
|
||||
var nativeView = (AndroidApp.ProgressBar)viewHandler.NativeView;
|
||||
var color = virtualView.GetColor(DefaultColor);
|
||||
|
||||
//TODO: check how to set color
|
||||
//nativeView.progresstint = color.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -85,6 +85,7 @@
|
|||
<Compile Include="Handlers\ManagedZStackHandler.cs" />
|
||||
<Compile Include="Handlers\ManagedGridHandler.cs" />
|
||||
<Compile Include="Controls\HUITouchGesterListener.cs" />
|
||||
<Compile Include="Handlers\ActivityIndicatorHandler.cs" />
|
||||
<Compile Include="Handlers\TabViewHandler.cs" />
|
||||
<Compile Include="Controls\HUITabView.cs" />
|
||||
<Compile Include="Controls\HUINavigationView.cs" />
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace HotUI.Android
|
|||
Registrar.Handlers.Register<TextField, TextFieldHandler>();
|
||||
Registrar.Handlers.Register<Text, TextHandler>();
|
||||
Registrar.Handlers.Register<Toggle, ToggleHandler>();
|
||||
Registrar.Handlers.Register<ActivityIndicator, ActivityIndicatorHandler>();
|
||||
//Registrar.Handlers.Register<WebView, WebViewHandler> ();
|
||||
|
||||
// Containers
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using HotUI.iOS.Handlers;
|
||||
using UIKit;
|
||||
|
||||
namespace HotUI.iOS
|
||||
{
|
||||
public class ActivityIndicatorHandler : AbstractControlHandler<ActivityIndicator,UIActivityIndicatorView>
|
||||
{
|
||||
public static readonly PropertyMapper<ActivityIndicator> Mapper = new PropertyMapper<ActivityIndicator>(ViewHandler.Mapper)
|
||||
{
|
||||
[EnvironmentKeys.Colors.Color] = MapColorProperty,
|
||||
};
|
||||
|
||||
private static Color DefaultColor;
|
||||
|
||||
public ActivityIndicatorHandler() : base(Mapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override UIActivityIndicatorView CreateView()
|
||||
{
|
||||
var activityIndicator = new UIActivityIndicatorView();
|
||||
activityIndicator.StartAnimating();
|
||||
|
||||
if(DefaultColor == null)
|
||||
{
|
||||
DefaultColor = activityIndicator.Color.ToColor();
|
||||
}
|
||||
return activityIndicator;
|
||||
}
|
||||
|
||||
protected override void DisposeView(UIActivityIndicatorView nativeView)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void MapColorProperty(IViewHandler viewHandler, ActivityIndicator virtualView)
|
||||
{
|
||||
var nativeView = (UIActivityIndicatorView)viewHandler.NativeView;
|
||||
var color = virtualView.GetColor(DefaultColor);
|
||||
nativeView.Color = color.ToUIColor();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -92,6 +92,7 @@
|
|||
<Compile Include="Controls\HUITabView.cs" />
|
||||
<Compile Include="Graphics\UIImageBitmap.cs" />
|
||||
<Compile Include="Controls\HUITapGestures.cs" />
|
||||
<Compile Include="Handlers\ActivityIndicatorHandler.cs" />
|
||||
<Compile Include="Handlers\ProgressBarHandler.cs" />
|
||||
<Compile Include="Extensions\AnimationExtensions.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace HotUI.iOS
|
|||
Registrar.Handlers.Register<Slider, SliderHandler>();
|
||||
Registrar.Handlers.Register<ShapeView, ShapeViewHandler>();
|
||||
Registrar.Handlers.Register<Toggle, ToggleHandler>();
|
||||
Registrar.Handlers.Register<ActivityIndicator, ActivityIndicatorHandler>();
|
||||
//Registrar.Handlers.Register<WebView, WebViewHandler> ();
|
||||
|
||||
// Containers
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
namespace HotUI
|
||||
{
|
||||
public class ActivityIndicator : View
|
||||
{
|
||||
public ActivityIndicator()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче