Correct components of type password popup 42/300842/1 tizen_8.0
authorManika Shrivastava <manika.sh@samsung.com>
Thu, 2 Nov 2023 11:20:28 +0000 (16:50 +0530)
committerManika Shrivastava <manika.sh@samsung.com>
Thu, 2 Nov 2023 11:20:40 +0000 (16:50 +0530)
This patch resolves jira https://code.sec.samsung.net/jira/browse/TEIGHT-5156

Change-Id: I2b99b347b7a72ca0890ad11656ab9068da362f6e
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
SettingWiFi/SettingWiFi/res/allowed/SettingWiFi/images/close_eye.svg [new file with mode: 0644]
SettingWiFi/SettingWiFi/res/allowed/SettingWiFi/images/open_eye.svg [new file with mode: 0644]
SettingWiFi/SettingWiFi/view/ConnectPage.cs
SettingWiFi/SettingWiFi/view/EyeButton.cs [new file with mode: 0644]
SettingWiFi/SettingWiFi/view/Resources.cs
packaging/org.tizen.cssetting-wifi-1.1.5.rpk

diff --git a/SettingWiFi/SettingWiFi/res/allowed/SettingWiFi/images/close_eye.svg b/SettingWiFi/SettingWiFi/res/allowed/SettingWiFi/images/close_eye.svg
new file mode 100644 (file)
index 0000000..92f9464
--- /dev/null
@@ -0,0 +1,7 @@
+<svg width="28" height="12" viewBox="0 0 28 12" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M1.5 1.88867C1.5 1.88867 5.87349 6.88695 13.9957 6.88695C22.1179 6.88695 26.4914 1.88867 26.4914 1.88867" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M3.99914 3.94434L1.5 6.88707" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M26.4912 6.88723L23.9971 3.94824" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M10.1392 6.4873L8.99707 10.0111" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M17.8231 6.49707L18.994 10.0109" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/SettingWiFi/SettingWiFi/res/allowed/SettingWiFi/images/open_eye.svg b/SettingWiFi/SettingWiFi/res/allowed/SettingWiFi/images/open_eye.svg
new file mode 100644 (file)
index 0000000..4057f64
--- /dev/null
@@ -0,0 +1,4 @@
+<svg width="26" height="20" viewBox="0 0 26 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M24.5562 8.66543C25.1479 9.46257 25.1479 10.5387 24.5562 11.3346C22.6924 13.8404 18.2208 19 13.0002 19C7.77957 19 3.30796 13.8404 1.44417 11.3346C1.15628 10.9529 1 10.4833 1 10C1 9.51668 1.15628 9.04712 1.44417 8.66543C3.30796 6.15957 7.77957 1 13.0002 1C18.2208 1 22.6924 6.15957 24.5562 8.66543V8.66543Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M13 14C15.2091 14 17 12.2091 17 10C17 7.79086 15.2091 6 13 6C10.7909 6 9 7.79086 9 10C9 12.2091 10.7909 14 13 14Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
index a270ae75e720e61e47bf4ac0056c0fb80941b86f..570c3ea0e6901904d510900110e4f5d36bcb30d8 100755 (executable)
@@ -9,15 +9,18 @@ using SettingCore;
 
 namespace SettingWiFi
 {
-    //internal class ConnectPage : RoundedDialogPage
     internal class ConnectPage : RoundedDialogPage
     {
         private AP mAp;
         private WiFi mWifi;
         private TextField mPasswordField;
-        private Button mConnectButton;
         private Window mWindow = NUIApplication.GetDefaultWindow();
 
+        private const int MAX_DEVICE_NAME_LEN = 32;
+        private TextLabel warning;
+        private Button okButton;
+        private bool isLightTheme => ThemeManager.PlatformThemeId == "org.tizen.default-light-theme";
+
         internal ConnectPage(WiFi wifi)
         {
             Debug("ConnectPage");
@@ -27,12 +30,22 @@ namespace SettingWiFi
         internal TextField CreatePasswordField()
         {
             Debug("+");
-            var passwordField = new TextField()
+            PropertyMap placeholder = new PropertyMap();
+            placeholder.Add("color", new PropertyValue(isLightTheme ? new Color("#CACACA") : new Color("#666666")));
+            placeholder.Add("fontFamily", new PropertyValue("BreezeSans"));
+            placeholder.Add("pixelSize", new PropertyValue(24.SpToPx()));
+            placeholder.Add("text", new PropertyValue(Resources.IDS_WIFI_HEADER_PASSWORD));
+
+            var passwordField = new TextField
             {
-                WidthSpecification = 534,
-                HeightSpecification = 48,
-                BackgroundColor = Color.White,
-                PlaceholderText = Resources.IDS_WIFI_HEADER_PASSWORD,
+                FontFamily = "BreezeSans",
+                SizeWidth = 530.SpToPx(),
+                Placeholder = placeholder,
+                BackgroundColor = isLightTheme ? new Color("#FAFAFA") : new Color("#1D1A21"),
+                MaxLength = MAX_DEVICE_NAME_LEN,
+                EnableCursorBlink = true,
+                PixelSize = 24.SpToPx(),
+                Margin = new Extents(0, 26, 0, 0).SpToPx(),
             };
 
             InputMethod inputSetting = new InputMethod
@@ -71,10 +84,11 @@ namespace SettingWiFi
 
             var wpsItem = new DefaultLinearItem()
             {
-                WidthSpecification = LayoutParamPolicies.MatchParent,
+                SizeWidth = 618.SpToPx(),
                 IsSelectable = true,
                 Icon = new ImageView(iconStyle),
                 Text = Resources.IDS_WIFI_OPT_WPS,
+                Margin = new Extents(15, 0, 0, 0).SpToPx(),
             };
 
             wpsItem.Icon.HeightSpecification = 20;
@@ -87,168 +101,204 @@ namespace SettingWiFi
         {
             mAp = ap;
 
-            var connectView = new RecyclerViewItem()
+            var content = new View()
             {
+                BackgroundColor = isLightTheme ? new Color("#FAFAFA") : new Color("#16131A"),
+                WidthSpecification = LayoutParamPolicies.WrapContent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
                 Layout = new LinearLayout()
                 {
                     LinearOrientation = LinearLayout.Orientation.Vertical,
                 },
-                IsSelectable = false,
             };
 
-            TextLabel label = new TextLabel(Resources.IDS_WIFI_BODY_TYPE_PASSWORD);
-            label.Padding = new Extents(5, 5, 5, 20);
-            connectView.Add(label);
+            // main text
+            content.Add(AddSubTitle());
 
-            connectView.Add(CreatePasswordEntryItem());
-            connectView.Add(CreateUnderline());
+            //entry view
+            content.Add(CreatePasswordView());
 
-            if(mAp.IsWps)
+            // separator
+            View separatorWrapper = new View()
             {
-                connectView.Add(CreateWpsItem());
-            }
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+            };
 
-            var cancelButton = new Button()
+            View separator = new View
             {
-                Text = Resources.IDS_WIFI_SK_CANCEL,
-                WidthSpecification = 252,
-                HeightSpecification = 48,
-                BackgroundColor = Color.White,
-                TextColor = new Color("#FF6200"),
-                BorderlineColor = new Color("#FF6200"),
-                BorderlineWidth = 2,
+                Size = new Size(550.SpToPx(), 1),
+                BackgroundColor = new Color("#FF6200"),
+                Margin = new Extents(24, 82, 0, 16).SpToPx(),
             };
-            cancelButton.Clicked += OnCancelClicked;
+            separatorWrapper.Add(separator);
+            content.Add(separatorWrapper);
 
-            mConnectButton = new Button()
+            // warn label
+            View warningWrapper = new View()
             {
-                Text = Resources.IDS_WIFI_SK_OK,
-                WidthSpecification = 252,
-                HeightSpecification = 48,
+                WidthSpecification = LayoutParamPolicies.WrapContent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
             };
-            mConnectButton.IsEnabled = false;
-            mConnectButton.Clicked += OnConnectClicked;
 
-            Content = new AlertDialog()
+            warning = new TextLabel(Resources.IDS_WIFI_BODY_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED)
             {
-                Title = mAp.Essid,
-                Content = connectView,
-                Actions = new View[] { cancelButton, mConnectButton},
+                SizeWidth = 618.SpToPx(),
+                PixelSize = 16.SpToPx(),
+                TextColor = new Color("#A40404"),
+                Margin = new Extents(24, 40, 0, 0).SpToPx(),
             };
-        }
+            warningWrapper.Add(warning);
+            content.Add(warningWrapper);
 
-        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
+            // wps
+            if (mAp.IsWps)
             {
-                hiddenInput.Mode = HiddenInputModeType.HideNone;
+                content.Add(CreateWpsItem());
             }
-            mPasswordField.SetHiddenInput(hiddenInput);
-            mPasswordField.Text = mPasswordField.Text;
-        }
 
-        private Selector<Color> GetDefaultColorSelector()
-        {
-            return new Selector<Color>()
+            okButton = new Button()
             {
-                Normal = new Color("#FFFFFF"),
-                Focused = new Color("#17234D"),
-                Pressed = new Color("#FF6200"),
-                Disabled = new Color("#CACACA"),
+                WidthResizePolicy = ResizePolicyType.FitToChildren,
+                HeightResizePolicy = ResizePolicyType.FitToChildren,
+                Text = Resources.IDS_WIFI_SK_OK,
+                Size = new Size(252, 48).SpToPx(),
+                Margin = new Extents(61, 0, 0, 0).SpToPx(),
             };
-        }
+            okButton.Clicked += OnOkClicked;
 
-        private Button CreateButton(string iconImagePath)
-        {
-            int buttonSize = 48;
-
-            ButtonStyle style = new ButtonStyle()
+            var cancelButton = new Button("Tizen.NUI.Components.Button.Outlined")
             {
-                IsSelectable = true,
-                CornerRadius = 50,
-                BackgroundColor = GetDefaultColorSelector(),
+                WidthResizePolicy = ResizePolicyType.FitToChildren,
+                HeightResizePolicy = ResizePolicyType.FitToChildren,
+                Text = Resources.IDS_WIFI_SK_CANCEL,
+                Size = new Size(252, 48).SpToPx(),
             };
+            cancelButton.Clicked += OnCancelClicked;
+
+            CheckNameLength(mPasswordField);
 
-            Button button = new Button(style)
+            Content = new AlertDialog()
             {
-                WidthSpecification = buttonSize,
-                HeightSpecification = buttonSize,
-                IconURL = Resources.GetPath() + iconImagePath,
-                IsSelectable = false,
+                Title = mAp.Essid,
+                Content = content,
+                Actions = new View[] { cancelButton, okButton },
             };
+        }
 
-            return button;
+        private void TextFieldTextChanged(object sender, TextField.TextChangedEventArgs e)
+        {
+            CheckNameLength(e.TextField);
         }
 
-        private Button GetCrossButton()
+        private void CheckNameLength(TextField textField)
         {
-            string crossIconImagePath = "/images/cross_icon.png";
-            Button crossButton = CreateButton(crossIconImagePath);
-            crossButton.Clicked += OnCrossButtonClicked;
+            if (textField.Text.Length >= MAX_DEVICE_NAME_LEN)
+            {
+                warning.Show();
+                okButton.IsEnabled = false;
+            }
+            else
+            {
+                warning.Hide();
+                try
+                {
+                    Debug("Password field changed");
+                    okButton.IsEnabled = mPasswordField.Text.Length >= Constants.MIN_PASSWORD_LENGTH ? true : false;
+                }
+                catch (Exception ex)
+                {
+                    Debug("Exception: " + ex.Message);
+                }
+            }
 
-            return crossButton;
+            if (textField.Text == string.Empty)
+            {
+                okButton.IsEnabled = false;
+            }
         }
 
-        private Button GetEyeButton()
+        private View AddSubTitle()
         {
-            string eyeIconImagePath = "/images/eye_icon.png";
-            Button eyeButton = CreateButton(eyeIconImagePath);
-            eyeButton.Clicked += OnEyeButtonClicked;
-            eyeButton.IsSelectable = true;
+            var textSubTitle = new TextLabel(Resources.IDS_WIFI_BODY_TYPE_PASSWORD)
+            {
+                FontFamily = "BreezeSans",
+                PixelSize = 24.SpToPx(),
+                SizeWidth = 618.SpToPx(),
+                MultiLine = true,
+                LineWrapMode = LineWrapMode.Word,
+                Margin = new Extents(24, 24, 0, 24).SpToPx(),
+            };
 
-            return eyeButton;
+            return textSubTitle;
         }
 
-        private View CreatePasswordEntryItem()
+        private View CreatePasswordView()
         {
-            View passwordEntryView = new View()
+            View entryView = new View()
             {
+                WidthSpecification = LayoutParamPolicies.WrapContent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
                 Layout = new LinearLayout()
                 {
                     LinearOrientation = LinearLayout.Orientation.Horizontal,
                 },
-                HeightSpecification = 48,
-                Padding = new Extents(5, 5, 10,0),
+                Margin = new Extents(35, 30, 0, 0).SpToPx(),
             };
 
             mPasswordField = CreatePasswordField();
-            mPasswordField.TextChanged += OnTextChanged;
 
-            passwordEntryView.Add(mPasswordField);
-            passwordEntryView.Add(GetCrossButton());
-            passwordEntryView.Add(GetEyeButton());
+            mPasswordField.TextChanged += TextFieldTextChanged;
+            SettingCore.Views.CancelButton cancelTextButton = new SettingCore.Views.CancelButton();
+            cancelTextButton.Clicked += CancelTextButtonClicked;
 
-            return passwordEntryView;
+            EyeButton eyeButton = new EyeButton();
+            eyeButton.Clicked += OnEyeButtonClicked;
+
+            entryView.Add(mPasswordField);
+            entryView.Add(cancelTextButton);
+            entryView.Add(eyeButton);
+
+            return entryView;
+        }
+
+        private void CancelTextButtonClicked(object sender, ClickedEventArgs e)
+        {
+            mPasswordField.Text = string.Empty;
         }
 
-        private View CreateUnderline()
+        public void UpdateHiddenProperty(bool hide)
         {
-            return new View()
+            Debug("+");
+            var hiddenInput = new Tizen.NUI.Text.HiddenInput();
+            if (hide)
             {
-                BorderlineColor = new Color("#FF6200"),
-                BorderlineWidth = 1,
-                WidthSpecification = 530,
-                HeightSpecification = 1,
-                Padding = new Extents(5, 0, 0, 0),
-            };
+                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 void OnEyeButtonClicked(object sender, ClickedEventArgs e)
         {
             Debug("+");
-            Button button = (Button)sender;
-            var hiddenInput = mPasswordField.GetHiddenInput();
+            EyeButton button = (EyeButton)sender;
+            button.OnSelected();
 
-            if (button.IsSelected)
+            if (button.hide==0)
             {
                 Debug("Show Password Selected");
                 UpdateHiddenProperty(false);
@@ -257,14 +307,6 @@ namespace SettingWiFi
                 Debug("Show Password UnSelected");
                 UpdateHiddenProperty(true);
             }
-
-        }
-
-        private void OnCrossButtonClicked(object sender, ClickedEventArgs e)
-        {
-            Debug("+");
-            Button button = (Button)sender;
-            mPasswordField.Text = "";
         }
 
         private void OnCancelClicked(object source, ClickedEventArgs args)
@@ -280,7 +322,7 @@ namespace SettingWiFi
             NUIApplication.GetDefaultWindow().GetDefaultNavigator().Push(page);
         }
 
-        private void OnConnectClicked(object source, ClickedEventArgs args)
+        private void OnOkClicked(object source, ClickedEventArgs args)
         {
             Connect();
             NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
@@ -309,19 +351,6 @@ namespace SettingWiFi
                 Error("Error other than wrong password " + e.Message);
             }
         }
-
-        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 class WrongPasswordEntered : InvalidOperationException
@@ -331,3 +360,4 @@ namespace SettingWiFi
         }
     }
 }
+
diff --git a/SettingWiFi/SettingWiFi/view/EyeButton.cs b/SettingWiFi/SettingWiFi/view/EyeButton.cs
new file mode 100644 (file)
index 0000000..8df1408
--- /dev/null
@@ -0,0 +1,76 @@
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+
+using SettingCore.Views;
+
+
+namespace SettingWiFi
+{
+    public class EyeButton : BaseComponent
+    {
+        private readonly ThemeColor BackgroundColors = new ThemeColor(Color.Transparent, Color.Transparent, Color.Transparent, Color.Transparent);
+        private readonly ThemeColor IconColors = new ThemeColor(new Color("#17234D"), new Color("#FF8A00"), new Color("#FF6200"), new Color("#FDFDFD"));
+
+        private readonly ImageView icon;
+        private readonly ImageVisual iconVisual;
+
+        public int hide = 1;
+
+        public EyeButton() : base()
+        {
+            BackgroundColor = BackgroundColors.Normal;
+            CornerRadius = 8f.SpToPx();
+            Size = new Size(30, 25).SpToPx();
+            Margin = new Extents(10, 0, 0, 0).SpToPx();
+
+            iconVisual = new ImageVisual
+            {
+                MixColor = IconColors.Normal,
+                URL = System.IO.Path.Combine(Resources.GetPath() + "/images/open_eye.svg"),
+                FittingMode = FittingModeType.ScaleToFill,
+            };
+            icon = new ImageView
+            {
+                Image = iconVisual.OutputVisualMap,
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+            };
+            Add(icon);
+
+            ThemeManager.ThemeChanged += (s, e) => { OnChangeSelected(false); };
+        }
+
+        public override void OnChangeSelected(bool selected)
+        {
+            if (selected)
+            {
+                iconVisual.MixColor = IconColors.Selected;
+                icon.Image = iconVisual.OutputVisualMap;
+
+                BackgroundColor = BackgroundColors.Selected;
+            }
+            else
+            {
+                iconVisual.MixColor = IconColors.Normal;
+                icon.Image = iconVisual.OutputVisualMap;
+
+                BackgroundColor = BackgroundColors.Normal;
+            }
+        }
+
+        public void OnSelected()
+        {
+            if (iconVisual.URL == System.IO.Path.Combine(Resources.GetPath() + "/images/open_eye.svg"))
+            {
+                iconVisual.URL = System.IO.Path.Combine(Resources.GetPath() + "/images/close_eye.svg");
+                hide = 0;
+            }
+
+            else
+            {
+                iconVisual.URL = System.IO.Path.Combine(Resources.GetPath() + "/images/open_eye.svg");
+                hide = 1;
+            }
+        }
+    }
+}
index 500d58a0306ba0c530304bdb6524ce0b8bbf127f..4a204a541bbf7fae375ddfd024834d639d308b7c 100755 (executable)
@@ -98,6 +98,7 @@
         static public string IDS_WIFI_OPT_MOBILEACCESSSERVICEATCIVATION_ON = "On";\r
         static public string IDS_WIFI_OPT_MOBILEACCESSSERVICEATCIVATION_OFF = "Off";\r
         static public string IDS_WIFI_HEADER_PASSWORD = "Password";\r
+        static public string IDS_WIFI_BODY_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED = "Maximum number of characters reached.";\r
         static public string IDS_WIFI_BODY_WI_FI = "Wi-Fi";\r
         static public string IDS_WIFI_BODY_UNKNOWN = "Unknown";\r
         static public string IDS_WIFI_BODY_SORT_BY = "Sort by";\r
         static public string IDS_WIFI_BODY_PROXY = "Proxy";\r
         static public string IDS_WIFI_BODY_DONE = "Done";\r
         static public string IDS_WIFI_BODY_GATEWAY = "Gateway";\r
-        static public string IDS_WIFI_BODY_TYPE_PASSWORD = "Type password.";\r
+        static public string IDS_WIFI_BODY_TYPE_PASSWORD = "Type password";\r
     }\r
 }\r
index efd9d1a7110c9da9b98872c3086148602087b639..5391eded3a9a5bbf3e21ebe6a7d8f84d177436b0 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