Adding animation to scanning
authork.stepaniuk <k.stepaniuk@samsung.com>
Mon, 6 Apr 2020 09:53:30 +0000 (11:53 +0200)
committerk.stepaniuk <k.stepaniuk@samsung.com>
Mon, 6 Apr 2020 14:20:00 +0000 (16:20 +0200)
Signed-off-by: k.stepaniuk <k.stepaniuk@samsung.com>
Oobe/OobeWifi/Controls/Wifi/WifiView.cs

index 2cb086c9e6f9311b6c24b2367d63f98696aaf251..05d1ea0e9f91b50dd47b543e96ba8686908ed507 100644 (file)
@@ -206,11 +206,34 @@ namespace Oobe.Wifi.Controls.Wifi
                     LinearOrientation = LinearLayout.Orientation.Horizontal,
                 }
             };
-            view.Add(new View()
+
+            var progress = new View()
             {
                 Margin = new Extents(0, 0, 1, 0),
                 BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "12_icon_scanning.png"),
-            });
+            };
+            view.Add(progress);
+
+            Animation animation = null;
+            progress.VisibilityChanged += (s, e) =>
+            {
+                if (e.Visibility == false)
+                {
+                    animation?.Stop();
+                    animation?.Clear();
+                    animation?.Dispose();
+                    animation = null;
+                    progress.Orientation = new Rotation(new Radian(new Degree(0)), new Vector3(0, 0, -1));
+                }
+                else if (animation == null)
+                {
+                    animation = new Animation(1_000);
+                    animation.Looping = true;
+                    animation.AnimateTo(progress, "Orientation", new Rotation(new Radian(new Degree(180)), new Vector3(0, 0, -1)), new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
+                    animation.Play();
+                }
+            };
+
             view.Add(new TextLabel()
             {
                 TranslatableText = "WIFI_SCANNING",