blob: fdad3c769047820f025949e329168f0eaa294d2e (
plain)
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
49
50
|
using EProgressBar = ElmSharp.ProgressBar;
using EColor = ElmSharp.Color;
namespace Xamarin.Forms.Platform.Tizen
{
public class ActivityIndicatorRenderer : ViewRenderer<ActivityIndicator, EProgressBar>
{
static readonly EColor s_defaultColor = new EColor(129, 198, 255);
public ActivityIndicatorRenderer()
{
RegisterPropertyHandler(ActivityIndicator.ColorProperty, UpdateColor);
RegisterPropertyHandler(ActivityIndicator.IsRunningProperty, UpdateIsRunning);
}
protected override void OnElementChanged(ElementChangedEventArgs<ActivityIndicator> e)
{
if (Control == null)
{
SetNativeControl(new EProgressBar(Forms.Context.MainWindow)
{
Style = "process_medium",
IsPulseMode = true,
});
}
base.OnElementChanged(e);
}
void UpdateColor(bool initialize)
{
if (initialize && Element.Color.IsDefault)
return;
Control.Color = (Element.Color == Color.Default) ? s_defaultColor : Element.Color.ToNative();
}
void UpdateIsRunning()
{
if (Element.IsRunning)
{
Control.PlayPulse();
}
else
{
Control.StopPulse();
}
}
};
}
|