Fix MoreButton options. 46/284146/7
authorAkash <akash1.kumar@samsung.com>
Thu, 10 Nov 2022 10:43:39 +0000 (16:13 +0530)
committerAkash <akash1.kumar@samsung.com>
Thu, 17 Nov 2022 11:15:53 +0000 (16:45 +0530)
- Fixed not showing of MoreButton on Mainpage.
- Added AdvancedPage.cs and WiFiDirectPage.cs files.

Change-Id: I04a050fc4a8978e83bafabe63fdfa87cca2aca9e
Signed-off-by: Akash <akash1.kumar@samsung.com>
SettingWiFi/SettingWiFi/view/AdvancedPage.cs [new file with mode: 0644]
SettingWiFi/SettingWiFi/view/MainPage.cs
SettingWiFi/SettingWiFi/view/WiFiDirectPage.cs [new file with mode: 0644]
SettingWiFi/SettingWiFi/view/WidgetSettingWiFi.cs [changed mode: 0755->0644]

diff --git a/SettingWiFi/SettingWiFi/view/AdvancedPage.cs b/SettingWiFi/SettingWiFi/view/AdvancedPage.cs
new file mode 100644 (file)
index 0000000..b5c7fbb
--- /dev/null
@@ -0,0 +1,54 @@
+using System.Collections.Generic;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using SettingWiFi.res.locale;
+using static SettingWiFi.Logger;
+
+namespace SettingWiFi
+{
+    //This class still need to be completed
+    internal class AdvancedPage : ContentPage
+    {
+        private WiFi mWifi;
+        private APSource mApSource;
+
+        internal AdvancedPage(WiFi wifi)
+        {
+            mWifi = wifi;
+        }
+
+        internal void CreateComponents(APSource apSource)
+        {
+            mApSource = apSource;
+
+            var findView = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+                WidthSpecification = 200,
+                HeightSpecification = 100,
+            };
+
+            var cancelButton = new Button()
+            {
+                Text = Resources.IDS_WIFI_SK_CANCEL,
+                WidthSpecification = 300,
+                HeightSpecification = 80,
+            };
+            cancelButton.Clicked += (object source, ClickedEventArgs args) =>
+            {
+                Navigator.Pop();
+            };
+
+            Content = new AlertDialog()
+            {
+                Title = Resources.IDS_ST_BODY_ADVANCED,
+                Content = findView,
+                Actions = new View[] { cancelButton, },
+            };
+        }
+    }
+}
index cedcb62f67a9df3d7f9bc4ba13a5c270b69df662..c4f6241f6f18f0c90c5d8a89a18587e6f4f0de3d 100644 (file)
@@ -27,6 +27,8 @@ namespace SettingWiFi
         WiFi mWifi;
         APSource mApSource;
 
+        Button moreButton;
+
         private static readonly string mImagePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/";
         private static readonly int itemCount = 3;
         private MenuItem[] menuItems = new MenuItem[itemCount];
@@ -36,6 +38,10 @@ namespace SettingWiFi
             mWifi = wifi;
         }
 
+        internal Button MoreButton()
+        {
+            return moreButton;
+        }
         internal Loading CreateLoadingIcon()
         {
             var path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
@@ -64,7 +70,7 @@ namespace SettingWiFi
         {
             mApSource = new APSource();
 
-            var moreButton = new Button();
+            moreButton = new Button();
             moreButton.Icon.ResourceUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource
                 + "/images/menu.png";
 
@@ -153,12 +159,10 @@ namespace SettingWiFi
                         Navigator.Push(CreateHiddenConnectPage());
                         break;
                     case MoreMenu.AdvancedPage:
-                        // Advanced  page need to be added instead of HiddenConnect page
-                        Navigator.Push(CreateHiddenConnectPage());
+                        Navigator.Push(CreateAdvancedPage());
                         break;
                     case MoreMenu.WiFiDirectPage:
-                        // WiFiDirect page need to be added instead of HiddenConnect page
-                        Navigator.Push(CreateHiddenConnectPage());
+                        Navigator.Push(CreateWiFiDirectPage());
                         break;
                 }
             };
@@ -233,7 +237,9 @@ namespace SettingWiFi
 
                     item.Icon = GetApIconImageView();
                     item.Extra = GetInfoButton();
-
+                    item.IsSelectable = false;
+                    //OnAppClicked not working as expected as of now. Need to popup contentpage when clicked
+                    item.Clicked += OnAPClicked;
                     return item;
                 });
         }
@@ -291,6 +297,20 @@ namespace SettingWiFi
             return page;
         }
 
+        private ContentPage CreateAdvancedPage()
+        {
+            var page = new AdvancedPage(mWifi);
+            page.CreateComponents(mApSource);
+            return page;
+        }
+
+        private ContentPage CreateWiFiDirectPage()
+        {
+            var page = new WiFiDirectPage(mWifi);
+            page.CreateComponents(mApSource);
+            return page;
+        }
+
         private DialogPage CreateConnectPage(AP ap)
         {
             var page = new ConnectPage(mWifi);
@@ -353,8 +373,18 @@ namespace SettingWiFi
             }
         }
 
+        private async void OnAPClicked(object sender, ClickedEventArgs ev)
+        {
+            Debug("OnAPClicked");
+
+            Button button = (Button)sender;
+            mConnectPage = CreateConnectPage(button.BindingContext as AP);
+            Navigator.Push(mConnectPage);
+        }
+
         public async void OnScanListSelected(object sender, SelectionChangedEventArgs ev)
         {
+            Debug("OnScanListSelected");
             foreach (object item in ev.CurrentSelection)
             {
                 if (item == null) break;
diff --git a/SettingWiFi/SettingWiFi/view/WiFiDirectPage.cs b/SettingWiFi/SettingWiFi/view/WiFiDirectPage.cs
new file mode 100644 (file)
index 0000000..8ceca5c
--- /dev/null
@@ -0,0 +1,54 @@
+using System.Collections.Generic;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using SettingWiFi.res.locale;
+using static SettingWiFi.Logger;
+
+namespace SettingWiFi
+{
+    // This class still need to be completed
+    internal class WiFiDirectPage : ContentPage
+    {
+        private WiFi mWifi;
+        private APSource mApSource;
+
+        internal WiFiDirectPage(WiFi wifi)
+        {
+            mWifi = wifi;
+        }
+
+        internal void CreateComponents(APSource apSource)
+        {
+            mApSource = apSource;
+
+            var findView = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+                WidthSpecification = 200,
+                HeightSpecification = 100,
+            };
+
+            var cancelButton = new Button()
+            {
+                Text = Resources.IDS_WIFI_SK_CANCEL,
+                WidthSpecification = 300,
+                HeightSpecification = 80,
+            };
+            cancelButton.Clicked += (object source, ClickedEventArgs args) =>
+            {
+                Navigator.Pop();
+            };
+
+            Content = new AlertDialog()
+            {
+                Title = Resources.IDS_WIFI_BODY_WI_FI_DIRECT_ABB,
+                Content = findView,
+                Actions = new View[] { cancelButton, },
+            };
+        }
+    }
+}
old mode 100755 (executable)
new mode 100644 (file)
index 787e458..e79d688
@@ -20,10 +20,12 @@ namespace SettingWiFi
 \r
         WiFi mWifi;\r
 \r
+        Button moreButton;\r
         private ContentPage CreateMainPage()\r
         {\r
             var page = new MainPage(mWifi);\r
             page.CreateComponents();\r
+            moreButton = page.MoreButton();\r
             return page;\r
         }\r
 \r
@@ -36,7 +38,7 @@ namespace SettingWiFi
             mMainPage = CreateMainPage();\r
             AppBar appBar = CreateAppBar(Resources.IDS_WIFI_BODY_WI_FI);\r
             mMainPage.AppBar = appBar;\r
-\r
+            appBar.Actions = new View[] { moreButton, };\r
             navigator.Push(mMainPage);\r
         }\r
 \r