Apply breaking long text lines.
authorPiotr Czaja/Advanced Frameworks (PLT) /SRPOL/Engineer/Samsung Electronics <p.czaja@samsung.com>
Wed, 27 Apr 2022 15:15:17 +0000 (17:15 +0200)
committerPiotr Czaja <p.czaja@samsung.com>
Thu, 5 May 2022 12:30:08 +0000 (14:30 +0200)
Change-Id: I2f71ea5bb209fe4edc205874a5873fa82ae56991

Oobe/Oobe.Common/Utils/ScreenSizeUtils.cs
Oobe/Oobe.Terms/Styles/TextLabelStyles.cs
Oobe/Oobe.Terms/Views/TermsView.cs
Oobe/Oobe.Welcome/WelcomeStep.cs
Oobe/Oobe.Wifi/Controls/Wifi/AddNewNetworkPupup.cs
Oobe/Oobe.Wifi/Controls/Wifi/WifiPasswordPopup.cs
Oobe/Oobe.Wifi/Controls/Wifi/WifiView.cs
Oobe/Oobe.Wifi/WifiStep.cs

index 27bca2a15cdcf440cf0ef59e7d263351070706a6..8356ccba1fb965788fc1a2d0a45857d8a4a1afed 100644 (file)
@@ -43,15 +43,18 @@ namespace Oobe.Common.Utils
             }
         }
 
-        public static float GetFootnoteFontSizeScaleMaxHuge()
+        public static float GetExtraSizeHeight(TextLabel textLabel)
         {
-            switch (SystemSettings.FontSize)
+            if (textLabel.LineCount <= 1)
             {
-                case SystemSettingsFontSize.Giant:
-                    return TextUtils.GetFontSizeScale(SystemSettingsFontSize.Huge);
-                default:
-                    return TextUtils.GetFontSizeScale(SystemSettings.FontSize);
+                return 0;
+            }
+            else
+            {
+                return (textLabel.LineCount - 1) * textLabel.SizeHeight / textLabel.LineCount;
             }
         }
+
+
     }
 }
\ No newline at end of file
index cce0eae223a12808b7718632b6ed1269e16838d8..de9ccda188105e6e3118a46dd3d9ae8b91c6abf4 100644 (file)
@@ -46,12 +46,18 @@ namespace Oobe.Terms.Styles
             HorizontalAlignment = HorizontalAlignment.Begin,
             FontFamily = "BreezeSans",
             Ellipsis = false,
+            MultiLine = true,
+            LineWrapMode = LineWrapMode.Word,
+            WidthResizePolicy = ResizePolicyType.FillToParent,
         };
 
         private static TextLabelStyle guideTextLabelStyle = new TextLabelStyle
         {
             PixelSize = SpUtils.ToPixels(18.0f),
             Ellipsis = false,
+            MultiLine = true,
+            LineWrapMode = LineWrapMode.Word,
+            WidthResizePolicy = ResizePolicyType.FillToParent,
             TextColor = new Selector<Color>
             {
                 Normal = new Color(112.0f / 255.0f, 112.0f / 255.0f, 112.0f / 255.0f, 1.0f),
index f2c399a3df1f78123656f7ebaefec7cdcc2e3e17..3cd26a78ed7a539c62cd889e460fb5cbf005c659 100644 (file)
@@ -34,11 +34,14 @@ namespace Oobe.Terms.Views
         private TextLabel agreeLabel;
         private CheckBox agreeCheckBox;
         private TapGestureDetector tapGestureDetector;
+        private View bounding;
         private ScrollableBase scroller;
         private TextLabel termsContent;
 
         private bool agreementCheckable;
         private bool nextEnabled;
+        private View ihaveread;
+        private TextLabel guide;
 
         public TermsView(IProcessNavigation nav, TermsProvider terms)
         {
@@ -61,7 +64,7 @@ namespace Oobe.Terms.Views
             float h2 = (48 * TextUtils.GetFontSizeScale(SystemSettings.FontSize)) + (ScreenSizeUtils.IsPortrait ? 72 : 63);
             float h1 = (48 * TextUtils.GetFontSizeScale(SystemSettings.FontSize)) + 55;
             int bounding_height = (int)((ScreenSizeUtils.IsPortrait ? 1616 : 776) - h2 - h1);
-            View bounding = new View
+            bounding = new View
             {
                 BackgroundColor = Color.White,
                 CornerRadius = 25.0f,
@@ -123,9 +126,9 @@ namespace Oobe.Terms.Views
                 nav.Previous();
             };
 
-            TextLabel guide = new TextLabel(TextLabelStyles.GuideTextLabelStyle);
+            guide = new TextLabel(TextLabelStyles.GuideTextLabelStyle);
             guide.TranslatableText = "YOU_MUST_SCROLL_DOWN_AND_READ_THE_WHOLE_TEXT_ABOVE";
-            guide.FontSizeScale = ScreenSizeUtils.GetFootnoteFontSizeScaleMaxLarge();
+            guide.FontSizeScale = FontSizeScale.UseSystemSetting;
 
             agreeCheckBox = new CheckBox(Oobe.Terms.Styles.ButtonStyles.IHaveReadAndAgreeSwitchStyle);
             agreeCheckBox.Size2D = SpUtils.ToPixels(new Size2D((int)(TextUtils.GetFontSizeScale(SystemSettings.FontSize) * 24), (int)(TextUtils.GetFontSizeScale(SystemSettings.FontSize) * 24)));
@@ -140,7 +143,7 @@ namespace Oobe.Terms.Views
             agreeLabel = new TextLabel(TextLabelStyles.IHaveReadAndAgreeTextStyleDisabled);
             agreeLabel.State = States.Disabled;
             agreeLabel.TranslatableText = "I_HAVE_READ_AND_AGREE_TO_TERMS_AND_CONDITIONS";
-            agreeLabel.FontSizeScale = ScreenSizeUtils.GetFootnoteFontSizeScaleMaxLarge();
+            agreeLabel.FontSizeScale = FontSizeScale.UseSystemSetting;
 
             var footnote = new View
             {
@@ -153,8 +156,9 @@ namespace Oobe.Terms.Views
                 },
             };
 
-            var ihaveread = new View
+            ihaveread = new View
             {
+                SizeWidth = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? 680 : 1520),
                 Layout = new LinearLayout
                 {
                     LinearOrientation = LinearLayout.Orientation.Vertical,
@@ -196,6 +200,15 @@ namespace Oobe.Terms.Views
                 return false;
             };
             timer.Start();
+            ihaveread.Relayout += Ihaveread_Relayout;
+        }
+
+        private void Ihaveread_Relayout(object sender, System.EventArgs e)
+        {
+            float agreeLabelExtraSizeHeight = ScreenSizeUtils.GetExtraSizeHeight(agreeLabel);
+            var boundingSizeCorrection = ScreenSizeUtils.GetExtraSizeHeight(guide) + agreeLabelExtraSizeHeight;
+            bounding.SizeHeight -= SpUtils.ToPixels(boundingSizeCorrection);
+            agreeCheckBox.PositionY -= agreeLabelExtraSizeHeight;
         }
 
         private bool NextEnabled
index 4a74224909b8e62578019ae2d050b2264ac29f91..51c4659d84525045ce6f07f37f024d0c9bbf4db3 100644 (file)
@@ -27,9 +27,11 @@ namespace Oobe.Welcome
 {\r
     public class WelcomeStep : ProcessStep\r
     {\r
+        private OneButtonPage container;\r
+\r
         public override BasePage CreateView(IProcessNavigation nav)\r
         {\r
-            var container = new OneButtonPage();\r
+            container = new OneButtonPage();\r
 \r
             container.Title.PivotPoint = Position.PivotPointBottomCenter;\r
             container.Title.ParentOrigin = Position.ParentOriginBottomCenter;\r
@@ -37,6 +39,8 @@ namespace Oobe.Welcome
                 -(550 + (387 * TextUtils.GetFontSizeScale(SystemSettings.FontSize))) :\r
                 -(327 + (174 * TextUtils.GetFontSizeScale(SystemSettings.FontSize)))));\r
             container.Title.TranslatableText = "WELCOME_TITLE";\r
+            container.Title.MultiLine = true;\r
+            container.Title.LineWrapMode = LineWrapMode.Word;\r
 \r
             TextLabel content = new TextLabel();\r
             content.SizeWidth = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? 872 : 1356);\r
@@ -61,7 +65,15 @@ namespace Oobe.Welcome
                 -(656 + (108 * TextUtils.GetFontSizeScale(SystemSettings.FontSize))) :\r
                 -(327 + (55 * TextUtils.GetFontSizeScale(SystemSettings.FontSize)))));\r
 \r
+            container.Title.Relayout += Title_Relayout;\r
             return container;\r
         }\r
+\r
+        private void Title_Relayout(object sender, System.EventArgs e)\r
+        {\r
+            float titleExtraSizeHeight = ScreenSizeUtils.GetExtraSizeHeight(container.Title);\r
+            container.Title.PositionY += titleExtraSizeHeight / 2;\r
+            container.Title.Relayout -= Title_Relayout;\r
+        }\r
     }\r
 }\r
index ab30531afa191f5c8ad104b77aeb84b371f60134..c55fb7aa27ab0603524be1144dccba9587799d62 100644 (file)
@@ -160,14 +160,14 @@ namespace Oobe.Wifi.Controls.Wifi
         private Button CreateRevealButton(Position2D position = null)
         {
             position ??= new Position2D();
-            var userScale = ScreenSizeUtils.GetFootnoteFontSizeScaleMaxLarge();
+            var userScale = TextUtils.GetFontSizeScale(SystemSettings.FontSize);
             var button = new Button(ButtonStyles.Reveal)
             {
                 Size = SpUtils.ToPixels(new Size(userScale * 48, userScale * 48)),
                 Position = SpUtils.ToPixels(position),
                 IsSelectable = true,
                 PositionUsesPivotPoint = true,
-                PivotPoint = Tizen.NUI.PivotPoint.BottomRight,
+                PivotPoint = new Position(1.0f, 0.77f),
                 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
             };
             button.Clicked += (s, e) =>
@@ -482,7 +482,7 @@ namespace Oobe.Wifi.Controls.Wifi
 
             if (revealButton is null)
             {
-                revealButton = CreateRevealButton(new Position2D(ScreenSizeUtils.IsPortrait ? 936 : 1104, 375));
+                revealButton = CreateRevealButton(new Position2D(ScreenSizeUtils.IsPortrait ? 936 : 1104, 363));
                 this.Add(revealButton);
             }
 
index 26235e083a5e6e0e05c95103713b3ca49421d287..780217377f5dff9f37418a8b71d22bceb8c3280a 100644 (file)
@@ -23,6 +23,7 @@ using Tizen.Network.WiFi;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
+using Tizen.System;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
@@ -38,23 +39,31 @@ namespace Oobe.Wifi.Controls.Wifi
         private string backgroundImagePath = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "08_popup_body.png");
         private WiFiAP wifiAp;
         private bool isConnecting = false;
+        private TextLabel titleLabel;
 
         public WifiPasswordPopup(WiFiAP wifiAp)
         {
             BackgroundImage = backgroundImagePath;
-            Size = SpUtils.ToPixels(new Size(ScreenSizeUtils.IsPortrait ? 1016 : 1184, ScreenSizeUtils.IsPortrait ? 404 : 401));
+            var titleHeight = 48 * TextUtils.GetFontSizeScale(SystemSettings.FontSize);
+            Size = SpUtils.ToPixels(new Size(ScreenSizeUtils.IsPortrait ? 1016 : 1184, ScreenSizeUtils.IsPortrait ? 356 + titleHeight : 353 + titleHeight));
             this.wifiAp = wifiAp;
 
-            this.Add(new View() // underline
+            View underline = new View()
             {
                 Size = SpUtils.ToPixels(new Size(ScreenSizeUtils.IsPortrait ? 856 : 1024, 1)),
-                Position2D = SpUtils.ToPixels(new Position2D(80, 197)),
+                Position2D = SpUtils.ToPixels(new Position2D(80, -204)),
+                PositionUsesPivotPoint = true,
+                PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+                ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
                 BackgroundColor = new Color(0xC3 / 255.0f, 0xCA / 255.0f, 0xD2 / 255.0f, 1.0f),
-            });
+            };
+            this.Add(underline);
 
-            var titleLabel = new TextLabel
+            titleLabel = new TextLabel
             {
-                PositionY = SpUtils.ToPixels(61),
+                PositionY = SpUtils.ToPixels(37),
+                Padding = SpUtils.ToPixels(new Extents(80, 80, 0, 0)),
+
                 // no translatableText because of dynamic content
                 Text = string.Format(Translations.WIFI_ENTER_PASSWORD_TO_JOIN, wifiAp.NetworkInformation.Essid),
                 PixelSize = SpUtils.ToPixels(40),
@@ -64,15 +73,17 @@ namespace Oobe.Wifi.Controls.Wifi
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 PositionUsesPivotPoint = true,
-                PivotPoint = Tizen.NUI.PivotPoint.Center,
+                PivotPoint = Tizen.NUI.PivotPoint.TopCenter,
                 ParentOrigin = Tizen.NUI.ParentOrigin.TopCenter,
                 FontSizeScale = FontSizeScale.UseSystemSetting,
+                MultiLine = true,
+                LineWrapMode = LineWrapMode.Word,
             };
             this.Add(titleLabel);
 
             passwordEntry = new PasswordEntry()
             {
-                Position = SpUtils.ToPixels(new Position(80, 200)),
+                Position = SpUtils.ToPixels(new Position(80, -206)),
                 MaxLength = MaxPasswordLength,
                 PixelSize = SpUtils.ToPixels(22),
                 TextColor = new Color(0, 0x0C / 255.0f, 0x2B / 255.0f, 1.0f),
@@ -84,7 +95,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 VerticalAlignment = VerticalAlignment.Bottom,
                 PositionUsesPivotPoint = true,
                 PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
-                ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+                ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
                 FontSizeScale = FontSizeScale.UseSystemSetting,
             };
             passwordEntry.TextChanged += (s, e) => UpdateOKButton();
@@ -93,7 +104,7 @@ namespace Oobe.Wifi.Controls.Wifi
 
             connectionFailure = new TextLabel
             {
-                Position = SpUtils.ToPixels(new Position(80, 201)),
+                Position = SpUtils.ToPixels(new Position(80, -204)),
                 TranslatableText = "WIFI_INVALID_PASSWORD",
                 PixelSize = SpUtils.ToPixels(18),
                 TextColor = new Color(0xAA / 255.0f, 0x18 / 255.0f, 0x18 / 255.0f, 1.0f),
@@ -103,21 +114,21 @@ namespace Oobe.Wifi.Controls.Wifi
                 VerticalAlignment = VerticalAlignment.Center,
                 PositionUsesPivotPoint = true,
                 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
-                ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+                ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
                 FontSizeScale = FontSizeScale.UseSystemSetting,
             };
             connectionFailure.Hide();
             this.Add(connectionFailure);
 
-            var userScale = ScreenSizeUtils.GetFootnoteFontSizeScaleMaxLarge();
+            var userScale = TextUtils.GetFontSizeScale(SystemSettings.FontSize);
             revealButton = new Button(ButtonStyles.Reveal)
             {
                 Size = SpUtils.ToPixels(new Size(userScale * 48, userScale * 48)),
-                Position = SpUtils.ToPixels(new Position(ScreenSizeUtils.IsPortrait ? 944 : 1112, 205)),
+                Position = SpUtils.ToPixels(new Position(ScreenSizeUtils.IsPortrait ? 944 : 1112, -204)),
                 IsSelectable = true,
                 PositionUsesPivotPoint = true,
-                PivotPoint = Tizen.NUI.PivotPoint.BottomRight,
-                ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+                PivotPoint = new Position(1.0f, 0.77f),
+                ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
             };
             revealButton.Clicked += (s, e) => TogglePasswordVisibility();
             this.Add(revealButton);
@@ -125,7 +136,10 @@ namespace Oobe.Wifi.Controls.Wifi
             cancelButton = new Button(ButtonStyles.Cancel)
             {
                 Size = SpUtils.ToPixels(new Size(336, 96)),
-                Position = SpUtils.ToPixels(new Position(80, 261)),
+                Position = SpUtils.ToPixels(new Position(80, -44)),
+                PositionUsesPivotPoint = true,
+                PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+                ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
             };
             cancelButton.TextLabel.FontSizeScale = FontSizeScale.UseSystemSetting;
             cancelButton.Clicked += (s, e) =>
@@ -137,7 +151,10 @@ namespace Oobe.Wifi.Controls.Wifi
             okButton = new Button(ButtonStyles.OK)
             {
                 Size = SpUtils.ToPixels(new Size(336, 96)),
-                Position = SpUtils.ToPixels(new Position(ScreenSizeUtils.IsPortrait ? 600 : 768, 261)),
+                Position = SpUtils.ToPixels(new Position(ScreenSizeUtils.IsPortrait ? 600 : 768, -44)),
+                PositionUsesPivotPoint = true,
+                PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+                ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
                 IsEnabled = false,
             };
             okButton.TextLabel.FontSizeScale = FontSizeScale.UseSystemSetting;
@@ -172,6 +189,18 @@ namespace Oobe.Wifi.Controls.Wifi
                 }
             };
             this.Add(okButton);
+            Relayout += WifiPasswordPopup_Relayout;
+        }
+
+        private void WifiPasswordPopup_Relayout(object sender, EventArgs e)
+        {
+            float popupTitleExtraSizeHeight = ScreenSizeUtils.GetExtraSizeHeight(titleLabel);
+            if (popupTitleExtraSizeHeight > 0)
+            {
+                Relayout -= WifiPasswordPopup_Relayout;
+            }
+
+            SizeHeight += popupTitleExtraSizeHeight;
         }
 
         public event Action OnDismiss;
index c66e710f057978a5a88ec8451e70d49b4f72e4f4..ae5a4dc550cc3ae1d2f74705ecd56e76d7fb7599 100644 (file)
@@ -21,6 +21,7 @@ using Tizen.Network.WiFi;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
+using Tizen.System;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
@@ -81,7 +82,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 PositionX = SpUtils.ToPixels(40),
             };
 
-            float userScale = ScreenSizeUtils.GetFootnoteFontSizeScaleMaxLarge();
+            float userScale = TextUtils.GetFontSizeScale(SystemSettings.FontSize);
             var progress = new View()
             {
                 Size = SpUtils.ToPixels(new Size(userScale * 25, userScale * 26)),
@@ -260,7 +261,7 @@ namespace Oobe.Wifi.Controls.Wifi
         private View CreateListViewPlaceHolder()
         {
             var view = new View();
-            var listView = new ListView(1080, 490)
+            var listView = new ListView(ScreenSizeUtils.IsPortrait ? 824 : 1080, ScreenSizeUtils.IsPortrait ? 795 : 490)
             {
                 Footer = CreateManualWifiView(),
                 Items = ApManager.Views,
index a5d6707bac8e0f10e3d1a9a9bea0d6ad8fcd50c8..b1c28db07fd2841aafeaa5e6ffe3c1e6234edaae 100644 (file)
@@ -33,20 +33,22 @@ namespace Oobe.Wifi
     {
         private WifiView wifiView = null;
         private EventHandler<ConnectionStateChangedEventArgs> connectionChanged;
+        private TwoButtonsPage view;
 
         public override BasePage CreateView(IProcessNavigation nav)
         {
             DisposeView();
 
-            var view = new TwoButtonsPage();
+            view = new TwoButtonsPage();
 
             view.Title.ParentOrigin = new Position(0.5f, ScreenSizeUtils.IsPortrait ? 0.183f : 0.035f);
             view.Title.TranslatableText = "CHOOSE_WIFI_NETWORK";
-            view.Title.FontSizeScale = ScreenSizeUtils.GetFootnoteFontSizeScaleMaxHuge();
-
+            view.Title.FontSizeScale = FontSizeScale.UseSystemSetting;// ScreenSizeUtils.GetFootnoteFontSizeScaleMaxHuge();
+            view.Title.MultiLine = true;
+            view.Title.LineWrapMode = LineWrapMode.Word;
 
             wifiView = new WifiView();
-            wifiView.View.Size = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? new Size2D(824, 800) : new Size2D(1080, 568));
+            wifiView.View.Size = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? new Size2D(824, 880) : new Size2D(1080, 568));
             wifiView.View.Position = new Position(0, SpUtils.ToPixels((ScreenSizeUtils.IsPortrait ? 408 : 55) + (48 * TextUtils.GetFontSizeScale(SystemSettings.FontSize))));
 
             view.Content = wifiView.View;
@@ -63,9 +65,17 @@ namespace Oobe.Wifi
 
             connectionChanged = (s, e) => ApplyStyle(e.State == WiFiConnectionState.Connected);
             WiFiManager.ConnectionStateChanged += connectionChanged;
+            view.Title.Relayout += Title_Relayout;
             return view;
         }
 
+        private void Title_Relayout(object sender, EventArgs e)
+        {
+            float titleExtraSizeHeight = ScreenSizeUtils.GetExtraSizeHeight(view.Title);
+            view.Title.PositionY -= titleExtraSizeHeight;
+            view.Title.Relayout -= Title_Relayout;
+        }
+
         public override void OnShutdown()
         {
             base.OnShutdown();