Revert code to 1.1.9 version.
authorPiotr Czaja <p.czaja@samsung.com>
Wed, 19 Oct 2022 13:07:56 +0000 (15:07 +0200)
committerPiotr Czaja/Advanced Frameworks (PLT) /SRPOL/Engineer/Samsung Electronics <p.czaja@samsung.com>
Wed, 2 Nov 2022 13:24:26 +0000 (14:24 +0100)
Change-Id: I59f308996e3284a2f94e8961c4b6c48d7b136895

Oobe/Oobe.Common/Utils/ScreenSizeUtils.cs
Oobe/Oobe.Common/Utils/SpUtils.cs
Oobe/Oobe.Common/ViewModels/BasePageViewModel.cs
Oobe/Oobe.Common/Views/TermsView.cs
Oobe/Oobe/OobeApp.cs
Oobe/Oobe/ScalableUI/OrientationalView.cs
Oobe/Oobe/Views/MainView.cs

index e5f9ba9..23db12f 100644 (file)
@@ -54,32 +54,5 @@ namespace Oobe.Common.Utils
                 return (textLabel.LineCount - 1) * textLabel.SizeHeight / textLabel.LineCount;
             }
         }
-
-        public static float GetScaleFactor()
-        {
-            var size = IsPortrait ? Window.Instance.Size.Width : Window.Instance.Size.Height;
-            switch (size)
-            {
-                case 720:
-                    return 0.6f;
-                case 1080:
-                    return 0.9f;
-                default:
-                    {
-                        if (size > 1080)
-                        {
-                            return 0.9f;
-                        }
-                        else if (size < 1080 && size > 720)
-                        {
-                            return 0.6f;
-                        }
-                        else
-                        {
-                            return 0.4f;
-                        }
-                    }
-            }
-        }
     }
 }
index ce8e5d9..8c80030 100644 (file)
@@ -21,7 +21,7 @@ namespace Oobe.Common.Utils
 {
     public static class SpUtils
     {
-        public static float DefaultFactor = 1.48125f;
+        private const float DefaultFactor = 1.48125f;
 
         public static int ToPixels(int sp)
         {
index f5bc987..cec9faa 100644 (file)
@@ -96,10 +96,27 @@ namespace Oobe.Common.ViewModels
         private void SetBackground()
         {
             var visualMap = new NPatchVisual();
-            visualMap.URL = NUIApplication.Current.DirectoryInfo.Resource + $"page/{fhdBackgroundFile}";
+            visualMap.URL = GetBackgroundUrl();
             ViewBackground = visualMap.OutputVisualMap;
         }
 
+        private string GetBackgroundUrl()
+        {
+            string filename = hdBackgroundFile;
+            int biggerEdge = Math.Max(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height);
+            if (biggerEdge > 3000)
+            {
+                filename = fhdBackgroundFile;
+            }
+            else if (biggerEdge < 1500)
+            {
+                filename = uhdBackgroundFile;
+            }
+
+            string bgUrl = NUIApplication.Current.DirectoryInfo.Resource + $"page/{filename}";
+            return bgUrl;
+        }
+
         private void SetTheme(string name)
         {
             ThemeManager.ApplyTheme(new Theme(NUIApplication.Current.DirectoryInfo.Resource + $"theme/{name}Theme.xaml"));
index 957e525..daaaa93 100644 (file)
@@ -85,6 +85,11 @@ namespace Oobe.Common.Views
         private void ConfigureSize()
         {
             var userScale = TextUtils.GetFontSizeScale(SystemSettings.FontSize);
+            float h2 = (48 * userScale) + (ScreenSizeUtils.IsPortrait ? 72 : 63);
+            float h1 = (48 * userScale) + 55;
+            int bounding_height = (int)((ScreenSizeUtils.IsPortrait ? 1616 : 760) - h2 - h1);
+
+            Bounding.Size = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? new Size2D(824, bounding_height) : new Size2D(1664, bounding_height));
             Footnote.SizeWidth = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? 680 : 1520);
             Linear.CellPadding = SpUtils.ToPixels(new Size2D(20, 20));
             AgreeCheckBox.Size2D = SpUtils.ToPixels(new Size2D((int)(userScale * 24), (int)(userScale * 24)));
index dfe5223..15b43a7 100644 (file)
@@ -20,7 +20,6 @@ using Oobe.Common.Resources;
 using Oobe.Common.Services;
 using Oobe.Common.Utils;
 using Oobe.Managers;
-using Tizen.Applications;
 using Tizen.NUI;
 
 namespace Oobe
@@ -69,15 +68,6 @@ namespace Oobe
                 Reset();
             }
 
-            if (e.ReceivedAppControl.ExtraData.TryGet("scale", out string scale))
-            {
-                if (!string.IsNullOrEmpty(scale))
-                {
-                    Preference.Set("scale", scale);
-                    Tizen.Log.Debug("oobe", $"Set scale: {scale}");
-                }
-            }
-
             Start();
         }
 
@@ -88,30 +78,9 @@ namespace Oobe
             Window.Instance.Type = WindowType.Notification;
             Window.Instance.SetNotificationLevel(NotificationLevel.High);
 
-            SetupScaleFactor();
-
             ProcessManager.Instance.Start();
         }
 
-        private void SetupScaleFactor()
-        {
-            SpUtils.DefaultFactor = (float)SpTypeConverter.Instance.ConvertToPixel(1) / ScreenSizeUtils.GetScaleFactor();
-
-            if (Preference.Contains("scale"))
-            {
-                try
-                {
-                    SpUtils.DefaultFactor = float.Parse(Preference.Get<string>("scale"));
-                }
-                catch (Exception ex)
-                {
-                    Tizen.Log.Debug("oobe", $"Wrong scale format: {ex.Message}");
-                }
-            }
-
-            Tizen.Log.Debug("oobe", $"DefaultScaleFactor: {SpUtils.DefaultFactor}");
-        }
-
         private void Start()
         {
             if (ProcessManager.Instance.IsDone())
index 9e34ddd..9973fd5 100644 (file)
@@ -28,6 +28,7 @@ namespace ScalableUI
 
         public OrientationalView()
         {
+            Size2D = Window.Instance.Size;
             PositionUsesPivotPoint = true;
             ParentOrigin = Tizen.NUI.ParentOrigin.Center;
             PivotPoint = Tizen.NUI.PivotPoint.Center;
index 0329e38..7ba7e89 100644 (file)
@@ -34,26 +34,19 @@ namespace Oobe.Views
         public MainView(Window win)
             : base()
         {
-            WidthSpecification = LayoutParamPolicies.MatchParent;
-            HeightSpecification = LayoutParamPolicies.MatchParent;
+            Size = Window.Instance.Size;
+
             PositionUsesPivotPoint = true;
             ParentOrigin = Tizen.NUI.ParentOrigin.Center;
             PivotPoint = Tizen.NUI.PivotPoint.Center;
 
-            Layout = new LinearLayout
-            {
-                LinearOrientation = LinearLayout.Orientation.Vertical,
-            };
-
-            var marginSize = (ScreenSizeUtils.IsPortrait ? win.WindowSize.Height : win.WindowSize.Width) * 0.08f;
+            Tizen.Log.Debug("oobe", $"this.Size: {this.Size.Width} {this.Size.Height}");
 
             orientational = new ScalableUI.OrientationalView
             {
-                WidthSpecification = LayoutParamPolicies.MatchParent,
-                HeightSpecification = LayoutParamPolicies.MatchParent,
+                Size = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? new Size2D(952, 1792) : new Size2D(1792, 952)),
                 Position2D = new Position2D(0, 0),
                 ScrollDuration = TransitionTime,
-                Margin = SpUtils.ToPixels(new Extents(0, (ushort)marginSize, 0, (ushort)marginSize)),
             };
 
             Add(orientational);