Create EAP Page Popup 41/300841/1
authorManika Shrivastava <manika.sh@samsung.com>
Thu, 2 Nov 2023 11:12:05 +0000 (16:42 +0530)
committerManika Shrivastava <manika.sh@samsung.com>
Thu, 2 Nov 2023 11:12:05 +0000 (16:42 +0530)
This patch resolves jira https://code.sec.samsung.net/jira/browse/TEIGHT-5165

Change-Id: Ie750edd407aee5d90850324ff01d2ed99e8ae010
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
SettingWiFi/SettingWiFi/model/AP.cs
SettingWiFi/SettingWiFi/view/EapInfoInputPage.cs [new file with mode: 0644]
SettingWiFi/SettingWiFi/view/EapInfoSource.cs [new file with mode: 0644]
SettingWiFi/SettingWiFi/view/EapPage.cs [new file with mode: 0644]
SettingWiFi/SettingWiFi/view/MainPage.cs
SettingWiFi/SettingWiFi/view/Resources.cs
packaging/org.tizen.cssetting-wifi-1.1.5.rpk

index 5a6b954ad5b4d5f190546d6a0e085f8ffee646a1..3c458c2d8f2c6dc4f0b1aeeb26dd923d2368d0a8 100755 (executable)
@@ -198,6 +198,15 @@ namespace SettingWiFi
             return false;\r
         }\r
 \r
+        public bool IsEap()\r
+        {\r
+            if (secType == WiFiSecurityType.Eap)\r
+            {\r
+                return true;\r
+            }\r
+            return false;\r
+        }\r
+\r
         public bool IsConnected()\r
         {\r
             if(state == WiFiState.Connected)\r
diff --git a/SettingWiFi/SettingWiFi/view/EapInfoInputPage.cs b/SettingWiFi/SettingWiFi/view/EapInfoInputPage.cs
new file mode 100644 (file)
index 0000000..f3ac4d0
--- /dev/null
@@ -0,0 +1,264 @@
+using SettingWiFi.res.locale;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using static SettingWiFi.Logger;
+
+namespace SettingWiFi
+{
+    internal class EapInfoInputPage : DialogPage
+    {
+        private EapItem mAddItem;
+        EapInfoSource mInfoSource;
+
+        private TextField mValueField;
+        private RadioButton[] mRadioButtons;
+        private RadioButtonGroup mGroup;
+        private string mTitle;
+        private int mCount;
+        private string mImagesPath;
+        private string[] mOptionNames;
+        private int mSelectedIndex;
+
+        internal EapInfoInputPage(EapItem item, EapInfoSource infoSource)
+        {
+            Debug("EapInfoInputPage");
+            mAddItem = item;
+            mInfoSource = infoSource;
+            mGroup = new RadioButtonGroup();
+            mImagesPath = Resources.GetPath() + "/images/";
+        }
+
+        internal void CreateComponents(string title, string value)
+        {
+            mTitle = title;
+            var infoView = new RecyclerViewItem()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+            };
+            mValueField = new TextField()
+            {
+                WidthSpecification = 600,
+                PlaceholderText = value,
+            };
+
+            infoView.Add(mValueField);
+
+            var okButton = new Button()
+            {
+                Text = Resources.IDS_WIFI_SK2_OK,
+            };
+            okButton.Clicked += OnOkClicked;
+
+            Content = new AlertDialog()
+            {
+                Title = title,
+                Content = infoView,
+                Actions = new View[] { okButton },
+            };
+        }
+
+        internal void CreateRadioComponents(string title, string[] options)
+        {
+            Debug("CreateRadioComponents" + title);
+            mTitle = title;
+            mOptionNames = options;
+            mCount = options.Length;
+            mRadioButtons = new RadioButton[mCount];
+            getSelectedIndex();
+
+            var optionView = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+            };
+
+            var okButton = new Button()
+            {
+                Text = Resources.IDS_WIFI_SK2_OK,
+            };
+            okButton.Clicked += OnRadioOkClicked;
+
+            CreateRadioOptions(optionView);
+            mRadioButtons[mSelectedIndex].IsSelected = true;
+            Content = new AlertDialog()
+            {
+                Title = mTitle,
+                Content = optionView,
+                Actions = new View[] { okButton },
+            };
+        }
+
+        private void getSelectedIndex()
+        {
+            Debug("");
+            mSelectedIndex = 0;
+            if (mTitle == Resources.IDS_ST_BUTTON_EAP_METHOD)
+            {
+                switch (mAddItem.Eapmethod)
+                {
+                    case "PEAP":
+                        mSelectedIndex = 0;
+                        break;
+                    case "TLS":
+                        mSelectedIndex = 1;
+                        break;
+                    case "TTLS":
+                        mSelectedIndex = 2;
+                        break;
+                    case "SIM":
+                        mSelectedIndex = 3;
+                        break;
+                    case "AKA":
+                        mSelectedIndex = 4;
+                        break;
+                }
+            }
+            else if (mTitle == Resources.IDS_ST_BUTTON_PHASE_AUTHENTICATION)
+            {
+                switch (mAddItem.Phaseauthentication)
+                {
+                    case "None ":
+                        mSelectedIndex = 0;
+                        break;
+                    case "MSCHAPV2":
+                        mSelectedIndex = 1;
+                        break;
+                    case "GTC":
+                        mSelectedIndex = 2;
+                        break;
+                }
+            }
+            else if (mTitle == Resources.IDS_ST_BUTTON_USER_CERTIFICATE)
+            {
+                switch (mAddItem.Usercertificate)
+                {
+                    case "None":
+                        mSelectedIndex = 0;
+                        break;
+                    case "Wifiserver":
+                        mSelectedIndex = 1;
+                        break;
+                    case "Wificonv":
+                        mSelectedIndex = 2;
+                        break;
+                    case "WL3-server":
+                        mSelectedIndex = 3;
+                        break;
+                }
+            }
+        }
+        private void CreateRadioOptions(View optionView)
+        {
+            for (int i = 0; i < mCount; i++)
+            {
+                int index = i;
+                var childView = new View()
+                {
+                    Layout = new GridLayout()
+                    {
+                        GridOrientation = GridLayout.Orientation.Horizontal,
+                        Columns = 2,
+                        Rows = 1,
+                        ColumnSpacing = 10,
+                    },
+                };
+                mRadioButtons[i] = new RadioButton();
+                var buttonStyle = mRadioButtons[i].Style;
+                CreateRadioButtonStyle(buttonStyle);
+                mRadioButtons[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+                {
+                    OnSelectionChanged(sender, args, index);
+                };
+                mRadioButtons[i].ApplyStyle(buttonStyle);
+                mRadioButtons[i].Size = new Size(48, 48);
+                mRadioButtons[i].Icon.Size = new Size(48, 48);
+                mGroup.Add(mRadioButtons[i]);
+                var nameLabel = new TextLabel(mOptionNames[i]);
+                nameLabel.WidthSpecification = 150;
+                childView.Add(nameLabel);
+                childView.Add(mRadioButtons[i]);
+                optionView.Add(childView);
+            }
+        }
+        void CreateRadioButtonStyle(ButtonStyle buttonStyle)
+        {
+            Debug("");
+            buttonStyle.Icon.Opacity = new Selector<float?>
+            {
+                Normal = 1.0f,
+                Selected = 1.0f,
+                Disabled = 0.4f,
+                DisabledSelected = 0.4f
+            };
+            buttonStyle.Icon.BackgroundImage = "";
+
+            buttonStyle.Icon.ResourceUrl = new Selector<string>
+            {
+                Normal = mImagesPath + "controller_btn_radio_off.png",
+                Selected = mImagesPath + "controller_btn_radio_on.png",
+                Disabled = mImagesPath + "controller_btn_radio_off.png",
+                DisabledSelected = mImagesPath + "controller_btn_radio_on.png",
+            };
+        }
+
+        void OnSelectionChanged(object sender, SelectedChangedEventArgs e, int i)
+        {
+            Debug($"{i}th RadioButton's IsSelected is changed to {e.IsSelected}.");
+            if (e.IsSelected)
+            {
+                mSelectedIndex = i;
+                Debug("Selected index: " + mSelectedIndex);
+            }
+        }
+
+        private void OnRadioOkClicked(object source, ClickedEventArgs args)
+        {
+            Debug("OnRadioOkClicked");
+            mInfoSource.Clear();
+            UpdateInfo(mTitle, mOptionNames[mSelectedIndex]);
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
+        }
+        private void OnOkClicked(object sender, ClickedEventArgs e)
+        {
+            Debug("OnOkClicked " + mValueField.Text + " : " + mTitle);
+            mInfoSource.Clear();
+            UpdateInfo(mTitle, mValueField.Text);
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
+        }
+
+        private void UpdateInfo(string fieldName, string value)
+        {
+            Debug("UpdateInfo");
+
+            if (fieldName == Resources.IDS_ST_BUTTON_EAP_METHOD)
+            {
+                Debug("Eap method: Updating value to " + value + " from " + mAddItem.Eapmethod);
+                mAddItem.Eapmethod = value;
+                mInfoSource.ShowEapInfo();
+            }
+            else if (fieldName == Resources.IDS_ST_BUTTON_PHASE_AUTHENTICATION)
+            {
+                Debug("Phase 2 authentication: Updating value to " + value + " from " + mAddItem.Phaseauthentication);
+                mAddItem.Phaseauthentication = value;
+                mInfoSource.ShowEapInfo();
+            }
+            else if (fieldName == Resources.IDS_ST_BUTTON_USER_CERTIFICATE)
+            {
+                Debug("User Certificate: Updating value to " + value + " from " + mAddItem.Usercertificate);
+                mAddItem.Usercertificate = value;
+                mInfoSource.ShowEapInfo();
+            }
+        }
+    }
+}
+
diff --git a/SettingWiFi/SettingWiFi/view/EapInfoSource.cs b/SettingWiFi/SettingWiFi/view/EapInfoSource.cs
new file mode 100644 (file)
index 0000000..19ba4d6
--- /dev/null
@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using Tizen.NUI.Components;
+using static SettingWiFi.Logger;
+
+namespace SettingWiFi
+{
+    public class EapInfoSource : ObservableCollection<EapInfoText>
+    {
+        private WiFi mWifi;
+        private EapItem mEapItem;
+        public EapInfoSource(WiFi wifi, EapItem item)
+        {
+            mWifi = wifi;
+            mEapItem = item;
+        }
+
+        internal void ShowEapInfo()
+        {
+            Debug("ShowEapInfo");
+            Add(new EapInfoText(Resources.IDS_ST_BUTTON_EAP_METHOD, mEapItem.Eapmethod, null));
+            Add(new EapInfoText(Resources.IDS_ST_BUTTON_PHASE_AUTHENTICATION, mEapItem.Phaseauthentication, null));
+            Add(new EapInfoText(Resources.IDS_ST_BUTTON_USER_CERTIFICATE, mEapItem.Usercertificate, null));
+        }
+    }
+
+    public class EapItem
+    {
+        public EapItem()
+        {
+            Debug("");
+        }
+
+        public EapItem(string eapmethod, string phaseauthentication, string usercertificate)
+        {
+            Eapmethod = eapmethod;
+            Phaseauthentication = phaseauthentication;
+            Usercertificate = usercertificate;
+        }
+        public string Eapmethod
+        {
+            get;
+            set;
+        }
+
+        public string Phaseauthentication
+        {
+            get;
+            set;
+        }
+
+        public string Usercertificate
+        {
+            get;
+            set;
+        }
+    }
+
+    public class EapInfoText : INotifyPropertyChanged
+    {
+        private string mInfoTitle;
+        private string mInfoValue;
+        public Predicate<string> mUpdater;
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+
+        public EapInfoText(string title, string value, Predicate<string> updater)
+        {
+            InfoTitle = title;
+            InfoValue = value;
+            mUpdater = updater;
+        }
+
+        private void OnPropertyChanged(string propertyName)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+
+        public string InfoTitle
+        {
+            get
+            {
+                return mInfoTitle;
+            }
+            set
+            {
+                mInfoTitle = value;
+                OnPropertyChanged("InfoTitle");
+            }
+        }
+
+        public string InfoValue
+        {
+            get
+            {
+                return mInfoValue;
+            }
+            set
+            {
+                mInfoValue = value;
+                OnPropertyChanged("InfoValue");
+            }
+        }
+    }
+}
+
diff --git a/SettingWiFi/SettingWiFi/view/EapPage.cs b/SettingWiFi/SettingWiFi/view/EapPage.cs
new file mode 100644 (file)
index 0000000..ba7d621
--- /dev/null
@@ -0,0 +1,476 @@
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using static SettingWiFi.Logger;
+
+namespace SettingWiFi
+{
+    internal class EapPage : ContentPage
+    {
+        private AP mAp;
+        private WiFi mWifi;
+        private EapItem mEapItem;
+        private TextField mPasswordField;
+        private TextField mIdentityField;
+        private Button mConnectButton;
+
+        EapInfoSource mEapDetailsInfoSource;
+        CollectionView mEapDetailsCollection;
+
+        internal EapPage(WiFi wifi)
+        {
+            Debug("EapPage");
+            mWifi = wifi;
+            mEapItem = new EapItem("PEAP", Resources.IDS_ST_BODY_NONE, Resources.IDS_ST_BODY_NONE);
+        }
+
+        internal void CreateComponents(AP ap)
+        {
+            mEapDetailsInfoSource = new EapInfoSource(mWifi, mEapItem);
+            mAp = ap;
+
+            var appBar = new AppBar()
+            {
+                Title = mAp.Essid,
+            };
+
+            AppBarStyle appBarStyle = (AppBarStyle)ThemeManager.GetStyle("Tizen.NUI.Components.AppBar");
+            Button backButton = new Button(((AppBarStyle)appBarStyle).BackButton);
+
+            backButton.Clicked += OnBackClicked;
+            appBar.NavigationContent = backButton;
+
+            View eapView = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                },
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+            };
+
+            View mDetailsView = new ScrollableBase()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                },
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+                ScrollingDirection = ScrollableBase.Direction.Vertical,
+                HideScrollbar = false,
+            };
+
+            mEapDetailsCollection = new CollectionView()
+            {
+                ItemsSource = mEapDetailsInfoSource,
+                ItemsLayouter = new LinearLayouter(),
+                ItemTemplate = CreateItemTemplate(),
+                IsGrouped = false,
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+            };
+
+            mEapDetailsInfoSource.ShowEapInfo();
+
+            View infoCollection = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                },
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+                Padding = new Extents(16, 0, 0, 0),
+            };
+
+            TextLabel identity = new TextLabel(Resources.IDS_WIFI_BODY_IDENTITY);
+            Margin = new Extents(0, 0, 10, 20);
+            infoCollection.Add(identity);
+
+            infoCollection.Add(CreateIdentityEntryItem());
+            infoCollection.Add(CreateUnderline());
+
+            TextLabel label = new TextLabel(Resources.IDS_WIFI_HEADER_PASSWORD);
+            Margin = new Extents(0, 0, 30, 20);
+            infoCollection.Add(label);
+
+            infoCollection.Add(CreatePasswordEntryItem());
+            infoCollection.Add(CreateUnderline());
+
+            View childView = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                },
+                Padding = new Extents(110, 0, 10, 8),
+            };
+
+            var cancelButton = new Button()
+            {
+                Text = Resources.IDS_WIFI_SK_CANCEL,
+                WidthSpecification = 252,
+                HeightSpecification = 48,
+                BackgroundColor = Color.White,
+                TextColor = new Color("#FF6200"),
+                BorderlineColor = new Color("#FF6200"),
+                BorderlineWidth = 2,
+            };
+            cancelButton.Clicked += OnCancelClicked;
+
+            mConnectButton = new Button()
+            {
+                Text = Resources.IDS_WIFI_SK_OK,
+                WidthSpecification = 252,
+                HeightSpecification = 48,
+                Margin = new Extents(160, 0, 0, 0).SpToPx(),
+            };
+            mConnectButton.IsEnabled = false;
+            mConnectButton.Clicked += OnConnectClicked;
+
+            childView.Add(cancelButton);
+            childView.Add(mConnectButton);
+
+            mDetailsView.Add(mEapDetailsCollection);
+            mDetailsView.Add(infoCollection);
+            eapView.Add(mDetailsView);
+            eapView.Add(childView);
+
+            AppBar = appBar;
+            Content = eapView;
+        }
+
+        private void OnBackClicked(object source, ClickedEventArgs args)
+        {
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
+        }
+
+        private DataTemplate CreateItemTemplate()
+        {
+            return new DataTemplate(() =>
+            {
+                DefaultLinearItem item = new DefaultLinearItem()
+                {
+                    WidthSpecification = LayoutParamPolicies.MatchParent,
+                };
+                item.Label.SetBinding(TextLabel.TextProperty, "InfoTitle");
+                item.Label.HorizontalAlignment = HorizontalAlignment.Begin;
+                item.SubLabel.SetBinding(TextLabel.TextProperty, "InfoValue");
+                item.SubLabel.HorizontalAlignment = HorizontalAlignment.Begin;
+                item.IsSelectable = false;
+                item.Clicked += OnInfoItemClicked;
+                return item;
+            });
+        }
+
+        private void OnCancelClicked(object source, ClickedEventArgs args)
+        {
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
+        }
+
+        private void OnConnectClicked(object source, ClickedEventArgs args)
+        {
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
+        }
+
+        private void OnInfoItemClicked(object sender, ClickedEventArgs e)
+        {
+            Debug("OnInfoItemClicked");
+            DefaultLinearItem infoItem = (DefaultLinearItem)sender;
+            var info = infoItem.BindingContext as EapInfoText;
+            if (info == null)
+            {
+                Error("Info null");
+            }
+            else
+            {
+                Debug("Item Clicked: " + info.InfoTitle);
+                if (info.InfoTitle == Resources.IDS_ST_BUTTON_EAP_METHOD)
+                {
+                    OnEapMethodClicked(sender, e);
+                }
+                else if (info.InfoTitle == Resources.IDS_ST_BUTTON_PHASE_AUTHENTICATION)
+                {
+                    OnPhase2AuthenticationClicked(sender, e);
+                }
+                else if (info.InfoTitle == Resources.IDS_ST_BUTTON_USER_CERTIFICATE)
+                {
+                    OnUserCertificateClicked(sender, e);
+                }
+                else
+                {
+                    Debug("Not a valid field");
+                }
+            }
+        }
+
+        public void OnEapMethodClicked(object source, ClickedEventArgs e)
+        {
+            Debug("OnEapMethodClicked");
+
+            string[] options = new string[]
+            {
+                "PEAP",
+                "TLS",
+                "TTLS",
+                "SIM",
+                "AKA"
+            };
+
+            var page = new EapInfoInputPage(mEapItem, mEapDetailsInfoSource);
+            page.CreateRadioComponents(Resources.IDS_ST_BUTTON_EAP_METHOD, options);
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Push(page);
+        }
+
+        public void OnPhase2AuthenticationClicked(object source, ClickedEventArgs e)
+        {
+            Debug("OnPhase2AuthenticationClicked");
+
+            string[] options = new string[]
+            {
+                "None",
+                "MSCHAPV2",
+                "GTC"
+            };
+
+            var page = new EapInfoInputPage(mEapItem, mEapDetailsInfoSource);
+            page.CreateRadioComponents(Resources.IDS_ST_BUTTON_PHASE_AUTHENTICATION, options);
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Push(page);
+        }
+
+        public void OnUserCertificateClicked(object source, ClickedEventArgs e)
+        {
+            Debug("OnUserCertificateClicked");
+
+            string[] options = new string[]
+            {
+                "None",
+                "Wifiserver",
+                "Wificonv",
+                "WL3-server"
+            };
+
+            var page = new EapInfoInputPage(mEapItem, mEapDetailsInfoSource);
+            page.CreateRadioComponents(Resources.IDS_ST_BUTTON_USER_CERTIFICATE, options);
+            NUIApplication.GetDefaultWindow().GetDefaultNavigator().Push(page);
+        }
+
+        private View CreatePasswordEntryItem()
+        {
+            View passwordEntryView = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                },
+                HeightSpecification = 35,
+            };
+
+            mPasswordField = CreatePasswordField();
+            mPasswordField.TextChanged += OnTextChanged;
+
+            passwordEntryView.Add(mPasswordField);
+            passwordEntryView.Add(GetCrossButton());
+            passwordEntryView.Add(GetEyeButton());
+
+            return passwordEntryView;
+        }
+
+        private View CreateIdentityEntryItem()
+        {
+            View identityEntryView = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                    HorizontalAlignment = HorizontalAlignment.Begin,
+                },
+                HeightSpecification = 35,
+            };
+
+            mIdentityField = CreateIdentityField();
+
+            identityEntryView.Add(mIdentityField);
+
+            return identityEntryView;
+        }
+
+        private View CreateUnderline()
+        {
+            return new View()
+            {
+                BorderlineColor = new Color("#FF6200"),
+                BorderlineWidth = 1,
+                WidthSpecification = 530,
+                HeightSpecification = 1,
+            };
+        }
+
+        private void OnTextChanged(object sender, TextField.TextChangedEventArgs e)
+        {
+            try
+            {
+                Debug("Password field changed");
+                mConnectButton.IsEnabled = mPasswordField.Text.Length >= Constants.MIN_PASSWORD_LENGTH ? true : false;
+            }
+            catch (Exception ex)
+            {
+                Debug("Exception: " + ex.Message);
+            }
+        }
+
+        internal TextField CreatePasswordField()
+        {
+            Debug("+");
+            var passwordField = new TextField()
+            {
+                WidthSpecification = 534,
+                HeightSpecification = 35,
+                BackgroundColor = Color.White,
+                PlaceholderText = Resources.IDS_WIFI_HEADER_PASSWORD,
+            };
+
+            InputMethod inputSetting = new InputMethod
+            {
+                PanelLayout = InputMethod.PanelLayoutType.Password,
+            };
+            PropertyMap p1 = inputSetting.OutputMap;
+            passwordField.InputMethodSettings = p1;
+
+            mPasswordField = passwordField;
+            UpdateHiddenProperty(true);
+
+            return passwordField;
+        }
+
+        internal TextField CreateIdentityField()
+        {
+            Debug("+");
+            var identityField = new TextField()
+            {
+                WidthSpecification = 534,
+                HeightSpecification = 35,
+                BackgroundColor = Color.White,
+                PlaceholderText = Resources.IDS_WIFI_BODY_IDENTITY,
+            };
+
+            InputMethod inputSetting = new InputMethod
+            {
+                PanelLayout = InputMethod.PanelLayoutType.Password,
+            };
+            PropertyMap p1 = inputSetting.OutputMap;
+            identityField.InputMethodSettings = p1;
+
+            mIdentityField = identityField;
+
+            return identityField;
+        }
+
+        private Button GetCrossButton()
+        {
+            string crossIconImagePath = "/images/cross_icon.png";
+            Button crossButton = CreateButton(crossIconImagePath);
+            crossButton.Clicked += OnCrossButtonClicked;
+
+            return crossButton;
+        }
+
+        private Button GetEyeButton()
+        {
+            string eyeIconImagePath = "/images/eye_icon.png";
+            Button eyeButton = CreateButton(eyeIconImagePath);
+            eyeButton.Clicked += OnEyeButtonClicked;
+            eyeButton.IsSelectable = true;
+
+            return eyeButton;
+        }
+
+        private void OnEyeButtonClicked(object sender, ClickedEventArgs e)
+        {
+            Debug("+");
+            Button button = (Button)sender;
+            var hiddenInput = mPasswordField.GetHiddenInput();
+
+            if (button.IsSelected)
+            {
+                Debug("Show Password Selected");
+                UpdateHiddenProperty(false);
+            }
+            else
+            {
+                Debug("Show Password UnSelected");
+                UpdateHiddenProperty(true);
+            }
+
+        }
+
+        private void OnCrossButtonClicked(object sender, ClickedEventArgs e)
+        {
+            Debug("+");
+            Button button = (Button)sender;
+            mPasswordField.Text = "";
+        }
+
+        private Button CreateButton(string iconImagePath)
+        {
+            int buttonSize = 48;
+
+            ButtonStyle style = new ButtonStyle()
+            {
+                IsSelectable = true,
+                CornerRadius = 50,
+                BackgroundColor = GetDefaultColorSelector(),
+            };
+
+            Button button = new Button(style)
+            {
+                WidthSpecification = buttonSize,
+                HeightSpecification = buttonSize,
+                IconURL = Resources.GetPath() + iconImagePath,
+                IsSelectable = false,
+            };
+
+            return button;
+        }
+
+        private void UpdateHiddenProperty(bool hide)
+        {
+            Debug("+");
+            var hiddenInput = new Tizen.NUI.Text.HiddenInput();
+            if (hide)
+            {
+                hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
+                hiddenInput.SubstituteCharacter = '*';
+                hiddenInput.SubstituteCount = 0;
+                hiddenInput.ShowLastCharacterDuration = 1000;
+            }
+            else
+            {
+                hiddenInput.Mode = HiddenInputModeType.HideNone;
+            }
+            mPasswordField.SetHiddenInput(hiddenInput);
+            mPasswordField.Text = mPasswordField.Text;
+        }
+
+        private Selector<Color> GetDefaultColorSelector()
+        {
+            return new Selector<Color>()
+            {
+                Normal = new Color("#FFFFFF"),
+                Focused = new Color("#17234D"),
+                Pressed = new Color("#FF6200"),
+                Disabled = new Color("#CACACA"),
+            };
+        }
+    }
+}
+
index 4cd55a3e11c479f8a0ee48928be12481b4ba26ff..543a9f3818eb00227be430b0fd84dc717cc2a886 100755 (executable)
@@ -374,6 +374,14 @@ namespace SettingWiFi
             return page;
         }
 
+        private ContentPage CreateEapPage(AP ap)
+        {
+            Debug("CreateEapPage");
+            var page = new EapPage(mWifi);
+            page.CreateComponents(ap);
+            return page;
+        }
+
         private DialogPage CreateConnectPage(AP ap)
         {
             Debug("+");
@@ -511,6 +519,11 @@ namespace SettingWiFi
                 {
                     ConnectOpenAP(device);
                 }
+                else if (device.IsEap())
+                {
+                    var mEapPage = CreateEapPage(device);
+                    NUIApplication.GetDefaultWindow().GetDefaultNavigator().Push(mEapPage);
+                }
                 else
                 {
                     var mConnectPage = CreateConnectPage(device);
index 159b9389ad47084806fc3d383c612026aa4fef8a..500d58a0306ba0c530304bdb6524ce0b8bbf127f 100755 (executable)
         static public string IDS_ST_BODY_IPV6 = "IPv6";\r
         static public string IDS_ST_BODY_NETWORK_PREFIX_LENGTH = "Network prefix length";\r
         static public string IDS_ST_BUTTON_SECURITY_ABB = "Security";\r
+        static public string IDS_ST_BUTTON_EAP_METHOD = "EAP method";\r
+        static public string IDS_ST_BUTTON_PHASE_AUTHENTICATION = "Phase 2 authentication";\r
+        static public string IDS_ST_BUTTON_USER_CERTIFICATE = "User certificate";\r
         static public string IDS_WIFI_CERTIFICATE_SEARCH_RESULTS = "Certificate Search Results";\r
         static public string IDS_WIFI_NO_CERTIFICATE_FOUND = "No certificate found.";\r
         static public string IDS_WIFI_AFTER_YOU_INSTALL_THEY_WILL_BE_SHOWN_HERE = "After you install, they will be shown here.";\r
index 9f646659a5f7fa67291b3c7fab8770da9796023f..efd9d1a7110c9da9b98872c3086148602087b639 100644 (file)
Binary files a/packaging/org.tizen.cssetting-wifi-1.1.5.rpk and b/packaging/org.tizen.cssetting-wifi-1.1.5.rpk differ