fix device renaming pop-up
authorYurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <y.zinchuk@samsung.com>
Thu, 25 Jan 2024 12:06:43 +0000 (13:06 +0100)
committerYurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <y.zinchuk@samsung.com>
Tue, 30 Jan 2024 07:17:15 +0000 (08:17 +0100)
SettingMainGadget/SettingMainGadget/AboutGadget.cs
SettingMainGadget/SettingMainGadget/TextResources/Resources.ko-KR.resx
SettingView/res/cancel-text-icon.svg

index 45aa79d3d2257d3bbf0d8e0404811cddabaa14fa..ca6e703c752a1d3c87990539327fc7ff4d45a735 100644 (file)
@@ -22,6 +22,7 @@ namespace Setting.Menu
 
         private Sections sections = new Sections();
         private View content;
+        private View popup;
         private TextField textField;
         private TextLabel warning;
         private Button renameButton;
@@ -51,14 +52,25 @@ namespace Setting.Menu
             };
 
             SystemSettings.DeviceNameChanged += SystemSettings_DeviceNameChanged;
+            content.Relayout += Content_Relayout;
             CreateView();
 
             return content;
         }
 
+        private void Content_Relayout(object sender, EventArgs e)
+        {
+            if(popup != null && popup.IsOnWindow)
+            {
+                NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
+                ShowRenamePopup(deviceName);
+            }
+        }
+
         protected override void OnDestroy()
         {
             SystemSettings.DeviceNameChanged -= SystemSettings_DeviceNameChanged;
+            content.Relayout -= Content_Relayout;
 
             base.OnDestroy();
         }
@@ -178,7 +190,7 @@ namespace Setting.Menu
 
         private void ShowRenamePopup(string name)
         {
-            var content = new View()
+            popup = new View()
             {
                 BackgroundColor = isLightTheme ? new Color("#FAFAFA") : new Color("#16131A"),
                 WidthSpecification = LayoutParamPolicies.WrapContent,
@@ -188,116 +200,168 @@ namespace Setting.Menu
                     HorizontalAlignment = HorizontalAlignment.Center,
                     LinearOrientation = LinearLayout.Orientation.Vertical,
                 },
+                Padding = new Extents(16, 16, 16, 16).SpToPx(),
+            };
+            popup.BoxShadow = isLightTheme ? new Shadow(8.0f, new Color(0.0f, 0.0f, 0.0f, 0.16f), new Vector2(0.0f, 2.0f)) : new Shadow(6.0f, new Color("#FFFFFF29"), new Vector2(0.0f, 1.0f));
+
+            var content = new View()
+            {
+                BackgroundColor = Color.Transparent,
+                WidthSpecification = LayoutParamPolicies.WrapContent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+            };
+
+            var header = new View()
+            {
+                BackgroundColor = Color.Transparent,
+                WidthSpecification = LayoutParamPolicies.WrapContent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+            };
+
+            var textView = new View()
+            {
+                BackgroundColor = Color.Transparent,
+                WidthSpecification = LayoutParamPolicies.WrapContent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                },
+                Padding = new Extents(8, 8, 8, 8).SpToPx(),
             };
 
             //title text
             var textTitle = new TextLabel(NUIGadgetResourceManager.GetString(nameof(Resources.IDS_ST_HEADER_RENAME_DEVICE)))
             {
-                FontFamily = "BreezeSans",
                 PixelSize = 24.SpToPx(),
-                Margin = new Extents(0, 0, 24, 16).SpToPx(),
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                HorizontalAlignment = HorizontalAlignment.Center,
+                Margin = new Extents(0, 0, 0, 8).SpToPx(),
             };
 
-            content.Add(textTitle);
-
             // main text
             var textSubTitle = new TextLabel(NUIGadgetResourceManager.GetString(nameof(Resources.IDS_ST_BODY_DEVICE_NAMES_ARE_DISPLAYED)))
             {
-                FontFamily = "BreezeSans",
                 PixelSize = 24.SpToPx(),
-                SizeWidth = 618.SpToPx(),
                 MultiLine = true,
                 LineWrapMode = LineWrapMode.Word,
-                Margin = new Extents(24, 24, 0, 24).SpToPx(),
+                SizeWidth = 634.SpToPx(),
+                Margin = new Extents(0, 0, 8, 0).SpToPx(),
             };
-            content.Add(textSubTitle);
 
-            //entry view
-            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("Type text"));
+            textView.Add(textTitle);
+            textView.Add(textSubTitle);
+
+            var mainView = new View()
+            {
+                BackgroundColor = Color.Transparent,
+                WidthSpecification = LayoutParamPolicies.WrapContent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+                Padding = new Extents(8, 8, 8, 8).SpToPx(),
+            };
 
-            View entryView = new View()
+            var entryView = new View()
             {
+                BackgroundColor = Color.Transparent,
                 WidthSpecification = LayoutParamPolicies.WrapContent,
                 HeightSpecification = LayoutParamPolicies.WrapContent,
                 Layout = new LinearLayout()
                 {
                     LinearOrientation = LinearLayout.Orientation.Horizontal,
+                    VerticalAlignment = VerticalAlignment.Center,
+                    HorizontalAlignment = HorizontalAlignment.Center,
                 },
-                Margin = new Extents(48, 50, 0, 7).SpToPx(),
             };
+
+            var textFieldView = new View()
+            {
+                BackgroundColor = isLightTheme ? new Color("#FAFAFA") : new Color("#1D1A21"),
+                WidthSpecification = LayoutParamPolicies.WrapContent,
+                WidthResizePolicy = ResizePolicyType.FitToChildren,
+                SizeHeight = 48.SpToPx(),
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+                Padding = new Extents(10, 0, 0, 0).SpToPx(),
+            };
+
+            //entry view
+            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("Type text"));
+
             textField = new TextField
             {
                 FontFamily = "BreezeSans",
-                SizeWidth = 544.SpToPx(),
+                SizeWidth = 582.SpToPx(),
+                SizeHeight = 48.SpToPx(),
+                VerticalAlignment = VerticalAlignment.Center,
                 Placeholder = placeholder,
                 BackgroundColor = isLightTheme ? new Color("#FAFAFA") : new Color("#1D1A21"),
                 MaxLength = MAX_DEVICE_NAME_LEN,
                 EnableCursorBlink = true,
                 PixelSize = 24.SpToPx(),
                 Text = name,
-                Margin = new Extents(0, 26, 0, 0).SpToPx(),
             };
             textField.TextChanged += TextField_TextChanged;
-            CancelButton cancelTextButton = new CancelButton();
-            cancelTextButton.Clicked += cancelTextButton_Clicked;
 
-            entryView.Add(textField);
-            entryView.Add(cancelTextButton);
-            content.Add(entryView);
-
-            // separator
-            View separatorWrapper = new View()
+            CancelButton cancelTextButton = new CancelButton()
             {
-                Layout = new LinearLayout()
-                {
-                    LinearOrientation = LinearLayout.Orientation.Vertical,
-                },
+                Margin = new Extents(10, 0, 0, 0).SpToPx(),
             };
+            cancelTextButton.Clicked += cancelTextButton_Clicked;
+
+            textFieldView.Add(textField);
+            entryView.Add(textFieldView);
+            entryView.Add(cancelTextButton);
 
             View separator = new View
             {
-                Size = new Size(576.SpToPx(), 1),
-                BackgroundColor = new Color("#FF6200"),
-                Margin = new Extents(32, 82, 0, 16).SpToPx(),
-            };
-            separatorWrapper.Add(separator);
-            content.Add(separatorWrapper);
-
-            // warn label
-            View warningWrapper = new View()
-            {
-                WidthSpecification = LayoutParamPolicies.WrapContent,
-                HeightSpecification = LayoutParamPolicies.WrapContent,
-                Layout = new LinearLayout()
-                {
-                    LinearOrientation = LinearLayout.Orientation.Vertical,
-                },
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                Size = new Size(592, 1).SpToPx(),
+                BackgroundColor = isLightTheme ? new Color("#FF6200") : new Color("#FF8A00"),
             };
 
             warning = new TextLabel(NUIGadgetResourceManager.GetString(nameof(Resources.IDS_ST_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED)))
             {
-                SizeWidth = 618.SpToPx(),
                 PixelSize = 16.SpToPx(),
                 TextColor = new Color("#A40404"),
-                Margin = new Extents(32, 40, 0, 25).SpToPx(),
+                Margin = new Extents(8, 8, 8, 0).SpToPx(),
             };
-            warningWrapper.Add(warning);
-            content.Add(warningWrapper);
 
-            // buttons
-            View buttons = new View()
+            mainView.Add(entryView);
+            mainView.Add(separator);
+            mainView.Add(warning);
+
+            header.Add(textView);
+            header.Add(mainView);
+
+            var buttons = new View()
             {
-                WidthSpecification = LayoutParamPolicies.WrapContent,
-                HeightSpecification = LayoutParamPolicies.WrapContent,
-                Layout = new LinearLayout()
+                BackgroundColor = Color.Transparent,
+                SizeWidth = 658.SpToPx(),
+                Layout = new FlexLayout()
                 {
-                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                    Justification = FlexLayout.FlexJustification.SpaceBetween,
+                    Direction = FlexLayout.FlexDirection.Row
                 },
-                Padding = new Extents(32, 32, 0, 32).SpToPx(),
+                Padding = new Extents(16, 16, 16, 16).SpToPx(),
             };
 
             renameButton = new Button()
@@ -306,7 +370,6 @@ namespace Setting.Menu
                 HeightResizePolicy = ResizePolicyType.FitToChildren,
                 Text = NUIGadgetResourceManager.GetString(nameof(Resources.IDS_ST_BUTTON_RENAME)),
                 Size = new Size(252, 48).SpToPx(),
-                Margin = new Extents(61, 0, 0, 0).SpToPx(),
             };
             renameButton.Clicked += (object sender, ClickedEventArgs e) => {
                 Vconf.SetString(VconfDeviceName, textField.Text);
@@ -319,17 +382,19 @@ namespace Setting.Menu
                 HeightResizePolicy = ResizePolicyType.FitToChildren,
                 Text = NUIGadgetResourceManager.GetString(nameof(Resources.IDS_ST_BUTTON_CANCEL)),
                 Size = new Size(252, 48).SpToPx(),
-                Margin = new Extents(61, 0, 0, 0).SpToPx(),
             };
 
             cancelButton.Clicked += (object sender, ClickedEventArgs e) => { NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop(); };
             buttons.Add(cancelButton);
             buttons.Add(renameButton);
 
+            content.Add(header);
             content.Add(buttons);
+            popup.Add(content);
+
             checkNameLength(textField);
 
-            RoundedDialogPage.ShowDialog(content);
+            RoundedDialogPage.ShowDialog(popup);
         }
 
         private void TextField_TextChanged(object sender, TextField.TextChangedEventArgs e)
index 3088c42dd50842e87701ed59b66f47e8c445e7f5..e46831900bce183110d0bd3a66d9d09c399f649a 100644 (file)
   <data name="IDS_ST_BUTTON_REMOVE_DEFAULT_APPS_ABB" xml:space="preserve">
     <value>기본 앱 삭제</value>
   </data>
+  <data name="IDS_ST_BUTTON_RENAME" xml:space="preserve">
+    <value>개명</value>
+  </data>
   <data name="IDS_ST_BUTTON_RESET" xml:space="preserve">
     <value>초기화</value>
   </data>
index efa9253af9ff61dc29eeb955ca65e9f1bcd55b73..22468c6ddb74bfc0ff01ec2629b898fad19e1d0e 100644 (file)
@@ -1,16 +1,6 @@
-<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g clip-path="url(#clip0_3199_44654)">
-<g clip-path="url(#clip1_3199_44654)">
-<path d="M16.9397 16.0002L21.7997 11.1402C21.9089 11.0126 21.9659 10.8486 21.9595 10.6808C21.953 10.513 21.8834 10.3539 21.7647 10.2351C21.646 10.1164 21.4868 10.0468 21.319 10.0404C21.1512 10.0339 20.9872 10.091 20.8597 10.2002L15.9997 15.0602L11.1397 10.1935C11.0121 10.0843 10.8481 10.0272 10.6803 10.0337C10.5125 10.0402 10.3533 10.1097 10.2346 10.2285C10.1159 10.3472 10.0463 10.5064 10.0398 10.6741C10.0334 10.8419 10.0904 11.006 10.1997 11.1335L15.0597 16.0002L10.193 20.8602C10.1232 20.9199 10.0665 20.9935 10.0265 21.0762C9.98649 21.1589 9.964 21.249 9.96046 21.3408C9.95691 21.4326 9.97238 21.5242 10.0059 21.6097C10.0394 21.6953 10.0903 21.773 10.1552 21.8379C10.2202 21.9029 10.2979 21.9538 10.3834 21.9873C10.469 22.0208 10.5605 22.0363 10.6524 22.0327C10.7442 22.0292 10.8343 22.0067 10.917 21.9667C10.9997 21.9266 11.0732 21.87 11.133 21.8002L15.9997 16.9402L20.8597 21.8002C20.9872 21.9094 21.1512 21.9665 21.319 21.96C21.4868 21.9535 21.646 21.8839 21.7647 21.7652C21.8834 21.6465 21.953 21.4873 21.9595 21.3195C21.9659 21.1518 21.9089 20.9877 21.7997 20.8602L16.9397 16.0002Z" fill="#17234D" stroke="#FDFDFD"/>
-<path d="M16.9397 16.0002L21.7997 11.1402C21.9089 11.0126 21.9659 10.8486 21.9595 10.6808C21.953 10.513 21.8834 10.3539 21.7647 10.2351C21.646 10.1164 21.4868 10.0468 21.319 10.0404C21.1512 10.0339 20.9872 10.091 20.8597 10.2002L15.9997 15.0602L11.1397 10.1935C11.0121 10.0843 10.8481 10.0272 10.6803 10.0337C10.5125 10.0402 10.3533 10.1097 10.2346 10.2285C10.1159 10.3472 10.0463 10.5064 10.0398 10.6741C10.0334 10.8419 10.0904 11.006 10.1997 11.1335L15.0597 16.0002L10.193 20.8602C10.1232 20.9199 10.0665 20.9935 10.0265 21.0762C9.98649 21.1589 9.964 21.249 9.96046 21.3408C9.95691 21.4326 9.97238 21.5242 10.0059 21.6097C10.0394 21.6953 10.0903 21.773 10.1552 21.8379C10.2202 21.9029 10.2979 21.9538 10.3834 21.9873C10.469 22.0208 10.5605 22.0363 10.6524 22.0327C10.7442 22.0292 10.8343 22.0067 10.917 21.9667C10.9997 21.9266 11.0732 21.87 11.133 21.8002L15.9997 16.9402L20.8597 21.8002C20.9872 21.9094 21.1512 21.9665 21.319 21.96C21.4868 21.9535 21.646 21.8839 21.7647 21.7652C21.8834 21.6465 21.953 21.4873 21.9595 21.3195C21.9659 21.1518 21.9089 20.9877 21.7997 20.8602L16.9397 16.0002Z" fill="#17234D" stroke="#FDFDFD"/>
-</g>
-</g>
-<defs>
-<clipPath id="clip0_3199_44654">
-<rect width="32" height="32" rx="8" fill="white"/>
-</clipPath>
-<clipPath id="clip1_3199_44654">
-<rect width="24" height="24" fill="white" transform="translate(4 4)"/>
-</clipPath>
-</defs>
+<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M12.5 12.5L34.99 34.99" stroke="white" stroke-width="3" stroke-miterlimit="10" stroke-linecap="round"/>
+<path d="M34.99 12.5L12.5 34.99" stroke="white" stroke-width="3" stroke-miterlimit="10" stroke-linecap="round"/>
+<path d="M12.5 12.5L34.99 34.99" stroke="white" stroke-width="3" stroke-miterlimit="10" stroke-linecap="round"/>
+<path d="M34.99 12.5L12.5 34.99" stroke="white" stroke-width="3" stroke-miterlimit="10" stroke-linecap="round"/>
 </svg>