Fix window position and size issue in low resolution. 70/314270/1
authorMd. Farhan Mahtab/NC eXperience Group /SRBD/Engineer/Samsung Electronics <farhan.m1@samsung.com>
Tue, 9 Jul 2024 12:01:34 +0000 (18:01 +0600)
committerMd. Farhan Mahtab/NC eXperience Group /SRBD/Engineer/Samsung Electronics <farhan.m1@samsung.com>
Tue, 9 Jul 2024 12:01:34 +0000 (18:01 +0600)
[Problem] When opening in low resolution the window border is positioned on the left side not centered.

[Cause & Measure]
 Cause : Base NUIApplication window size and position is being initialized with default value due to Tizen.System.TryGetValue giving static resolution.
 Measure : NUIApplication is initialized with smaller initial window size and postion and later resized according to resolution in OnCreate.

Change-Id: Ie233a18f14a8abcec11b3eec160291b7278ce0be
Signed-off-by: Md. Farhan Mahtab/NC eXperience Group /SRBD/Engineer/Samsung Electronics <farhan.m1@samsung.com>
Notifications/CustomBorder.cs
Notifications/Notifications.cs
packaging/org.tizen.notifications-1.0.1.tpk

index c2625d5f15560951ba3e8d1dfa1ed20eba6a3cea..69290d0696ae692800abf92652296270fd84a167 100644 (file)
@@ -47,6 +47,16 @@ namespace Notifications
             int minHeight = (int)(screenSize.Height * minHeightRatio);
             MinSize = new Size2D(minWidth, minHeight);
         }
+
+        public void UpdateMinSize(Size2D screenSize)
+        {
+            float minWidthRatio = 704.0f / 1920;
+            float minHeightRatio = 436.0f / 1080;
+            int minWidth = (int)(screenSize.Width * minWidthRatio);
+            int minHeight = (int)(screenSize.Height * minHeightRatio);
+            MinSize = new Size2D(minWidth, minHeight);
+        }
+
         private void OnThemeChanged(object sender, ThemeChangedEventArgs e)
         {
             if (e.IsPlatformThemeChanged)
index 857b146f86b424673bbe4be37f9f55bbbc5b2758..c4dd842fe071077cfdbdb93c90099cfb7c76a6ad 100644 (file)
@@ -20,7 +20,6 @@ using System.Globalization;
 using Tizen.NUI;
 using Notifications.Common;
 using Notifications.Core;
-using Tizen.System;
 
 namespace Notifications
 {
@@ -28,6 +27,7 @@ namespace Notifications
     {
         private Window window;
         private ViewManager viewManager;
+        private static CustomBorder appBorder;
 
         public Program(Size2D windowSize, Position2D windowPosition, CustomBorder appBorder) : base(windowSize, windowPosition, ThemeOptions.PlatformThemeEnabled, appBorder)
         {
@@ -56,9 +56,8 @@ namespace Notifications
             };
 
             window.SetAvailableOrientations(list);
-
+            appBorder.UpdateMinSize(GetScreenSize());
             WindowManager.UpdateWindowPositionSize();
-
             window.BackgroundColor = Color.Transparent;
             window.OrientationChanged += OnWindowOrientationChanged;
             viewManager = new ViewManager();
@@ -101,26 +100,8 @@ namespace Notifications
 
         static void Main(string[] args)
         {
-            int positionX, positionY;
-            int width, height;
-
-            _ = Information.TryGetValue("http://tizen.org/feature/screen.width", out int screenWidth);
-            _ = Information.TryGetValue("http://tizen.org/feature/screen.height", out int screenHeight);
-
-            Tizen.Log.Debug(AppConstants.LogTag, "screen width : " + screenWidth);
-            Tizen.Log.Debug(AppConstants.LogTag, "screen height : " + screenHeight);
-
-            Size2D displaySize = new Size2D(screenWidth, screenHeight);
-
-            width = (int)(displaySize.Width * AppConstants.windowWidthRatio);
-            height = (int)(displaySize.Height * AppConstants.windowHeightRatio);
-
-            positionX = (displaySize.Width - width) / 2;
-            positionY = (displaySize.Height - height) / 2;
-
-
-            CustomBorder appBorder = new CustomBorder(displaySize);
-            var app = new Program(new Size2D(width, height), new Position2D(positionX, positionY), appBorder);
+            appBorder = new CustomBorder(new Size2D(800, 480));
+            var app = new Program(new Size2D(10, 10), new Position2D(0,0), appBorder);
 
             app.Run(args);
         }
index 10bb2f924a5acc2727c45f20d6dce5cb1fa10092..4326f5a11a75cacaa8ccbb48536d44c3b2e88930 100644 (file)
Binary files a/packaging/org.tizen.notifications-1.0.1.tpk and b/packaging/org.tizen.notifications-1.0.1.tpk differ