update mainview 11/282711/1
authorYurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <y.zinchuk@samsung.com>
Mon, 10 Oct 2022 13:58:04 +0000 (15:58 +0200)
committerk.stepaniuk <k.stepaniuk@samsung.com>
Mon, 10 Oct 2022 14:11:27 +0000 (16:11 +0200)
Change-Id: Ie67940561be64490f1fb3770dcd291bc0e1ffed1

Oobe/Oobe.Common/Utils/ScreenSizeUtils.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 23db12f..e5f9ba9 100644 (file)
@@ -54,5 +54,32 @@ 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 cec9faa..f5bc987 100644 (file)
@@ -96,27 +96,10 @@ namespace Oobe.Common.ViewModels
         private void SetBackground()
         {
             var visualMap = new NPatchVisual();
-            visualMap.URL = GetBackgroundUrl();
+            visualMap.URL = NUIApplication.Current.DirectoryInfo.Resource + $"page/{fhdBackgroundFile}";
             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 daaaa93..957e525 100644 (file)
@@ -85,11 +85,6 @@ 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 660e305..dfe5223 100644 (file)
@@ -88,10 +88,14 @@ namespace Oobe
             Window.Instance.Type = WindowType.Notification;
             Window.Instance.SetNotificationLevel(NotificationLevel.High);
 
-            var size = ScreenSizeUtils.IsPortrait ? Window.Instance.Size.Width : Window.Instance.Size.Height;
-            var scale = size >= 1080 ? 0.9f : 0.6f;
-            SpUtils.DefaultFactor = (Window.Instance.Dpi.Width / 160) / scale;
-            Tizen.Log.Debug("oobe", $"DefaultScaleFactor: {SpUtils.DefaultFactor}");
+            SetupScaleFactor();
+
+            ProcessManager.Instance.Start();
+        }
+
+        private void SetupScaleFactor()
+        {
+            SpUtils.DefaultFactor = (float)SpTypeConverter.Instance.ConvertToPixel(1) / ScreenSizeUtils.GetScaleFactor();
 
             if (Preference.Contains("scale"))
             {
@@ -105,7 +109,7 @@ namespace Oobe
                 }
             }
 
-            ProcessManager.Instance.Start();
+            Tizen.Log.Debug("oobe", $"DefaultScaleFactor: {SpUtils.DefaultFactor}");
         }
 
         private void Start()
index 9973fd5..9e34ddd 100644 (file)
@@ -28,7 +28,6 @@ namespace ScalableUI
 
         public OrientationalView()
         {
-            Size2D = Window.Instance.Size;
             PositionUsesPivotPoint = true;
             ParentOrigin = Tizen.NUI.ParentOrigin.Center;
             PivotPoint = Tizen.NUI.PivotPoint.Center;
index 7ba7e89..0329e38 100644 (file)
@@ -34,19 +34,26 @@ namespace Oobe.Views
         public MainView(Window win)
             : base()
         {
-            Size = Window.Instance.Size;
-
+            WidthSpecification = LayoutParamPolicies.MatchParent;
+            HeightSpecification = LayoutParamPolicies.MatchParent;
             PositionUsesPivotPoint = true;
             ParentOrigin = Tizen.NUI.ParentOrigin.Center;
             PivotPoint = Tizen.NUI.PivotPoint.Center;
 
-            Tizen.Log.Debug("oobe", $"this.Size: {this.Size.Width} {this.Size.Height}");
+            Layout = new LinearLayout
+            {
+                LinearOrientation = LinearLayout.Orientation.Vertical,
+            };
+
+            var marginSize = (ScreenSizeUtils.IsPortrait ? win.WindowSize.Height : win.WindowSize.Width) * 0.08f;
 
             orientational = new ScalableUI.OrientationalView
             {
-                Size = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? new Size2D(952, 1792) : new Size2D(1792, 952)),
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
                 Position2D = new Position2D(0, 0),
                 ScrollDuration = TransitionTime,
+                Margin = SpUtils.ToPixels(new Extents(0, (ushort)marginSize, 0, (ushort)marginSize)),
             };
 
             Add(orientational);