Adding gray effect & dismiss logic
authork.stepaniuk <k.stepaniuk@samsung.com>
Tue, 24 Mar 2020 16:14:16 +0000 (17:14 +0100)
committerLukasz Stanislawski/IoT & UI Sample (PLT) /SRPOL/Engineer/Samsung Electronics <l.stanislaws@samsung.com>
Thu, 26 Mar 2020 08:45:46 +0000 (09:45 +0100)
Signed-off-by: k.stepaniuk <k.stepaniuk@samsung.com>
Oobe/OobeCommon/Utils/Popup.cs
Oobe/OobeWifi/Controls/Wifi/WifiView.cs

index 8b96178..3ca6413 100644 (file)
@@ -1,8 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 
@@ -10,19 +6,42 @@ namespace OobeCommon.Utils
 {
     public static class Popup
     {
+        public static void ShowCentered(View view)
+        {
+            view.PositionUsesPivotPoint = true;
+            view.PivotPoint = new Position(0.5f, 0.5f);
+            view.ParentOrigin = new Position(0.5f, 0.5f);
+            Show(view);
+        }
+
         public static void Show(View view)
         {
             var layer = new Layer();
+            var gray = new Tizen.NUI.Components.Control()
+            {
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                HeightResizePolicy = ResizePolicyType.FillToParent,
+                BackgroundColor = new Color(0f, 0f, 0f, 0.1f),
+            };
+            gray.TouchEvent += (s, e) =>
+            {
+                if (e.Touch.GetState(0) == PointStateType.Up)
+                {
+                    Window.Instance.RemoveLayer(layer);
+                    layer.Dispose();
+                }
+                return true;
+            };
+            layer.Add(gray);
+
+            view.TouchEvent += (s, e) => false; //prevent gray view reacting
             layer.Add(view);
             Window.Instance.AddLayer(layer);
+        }
 
-            void onTouch(object sender, Window.TouchEventArgs e)
-            {
-                Window.Instance.TouchEvent -= onTouch;
-                Window.Instance.RemoveLayer(layer);
-                layer.Dispose();
-            };
-            Window.Instance.TouchEvent += onTouch;
+        private static bool Gray_TouchEvent(object source, View.TouchEventArgs e)
+        {
+            throw new NotImplementedException();
         }
     }
 }
index ca9a86e..541a21e 100644 (file)
@@ -72,6 +72,15 @@ namespace Oobe.Wifi.Controls.Wifi
 
         private static async void OnApTapped(Tizen.Network.WiFi.WiFiAP wifiAp)
         {
+            OobeCommon.Utils.Popup.Show(new View()
+            {
+                PositionUsesPivotPoint = true,
+                PivotPoint = new Position(0.5f, 0.5f),
+                ParentOrigin = new Position(0.5f, 0.5f),
+                Size = new Size(300, 300),
+                BackgroundColor = Color.Red,
+            });
+            return;
             if (wifiAp.NetworkInformation.ConnectionState == Tizen.Network.WiFi.WiFiConnectionState.Connected)
             {
                 Tizen.Log.Debug("oobe", $"Already connected to {wifiAp.NetworkInformation.Essid}");