summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs57
1 files changed, 57 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs
new file mode 100644
index 00000000..04a69c6a
--- /dev/null
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs
@@ -0,0 +1,57 @@
+using EProgressBar = ElmSharp.ProgressBar;
+using EColor = ElmSharp.Color;
+
+namespace Xamarin.Forms.Platform.Tizen
+{
+ public class ActivityIndicatorRenderer : ViewRenderer<ActivityIndicator, EProgressBar>
+ {
+ static readonly EColor s_defaultColor = EColor.Black;
+
+ public ActivityIndicatorRenderer()
+ {
+ RegisterPropertyHandler(ActivityIndicator.ColorProperty, UpdateColor);
+ RegisterPropertyHandler(ActivityIndicator.IsRunningProperty, UpdateIsRunning);
+ }
+
+ protected override void OnElementChanged(ElementChangedEventArgs<ActivityIndicator> e)
+ {
+ if (Control == null)
+ {
+ var ac = new EProgressBar(Forms.Context.MainWindow)
+ {
+ Style = "process_medium",
+ IsPulseMode = true,
+ };
+ SetNativeControl(ac);
+ }
+
+ if (e.OldElement != null)
+ {
+ }
+
+ if (e.NewElement != null)
+ {
+ }
+
+ base.OnElementChanged(e);
+ }
+
+ void UpdateColor()
+ {
+ Control.Color = (Element.Color == Color.Default) ? s_defaultColor : Element.Color.ToNative();
+ }
+
+ void UpdateIsRunning()
+ {
+ if (Element.IsRunning)
+ {
+ Control.PlayPulse();
+ }
+ else
+ {
+ Control.StopPulse();
+ }
+ }
+
+ };
+}