Use npatch visual for background image.
authorPiotr Czaja/Advanced Frameworks (PLT) /SRPOL/Engineer/Samsung Electronics <p.czaja@samsung.com>
Mon, 14 Mar 2022 08:34:08 +0000 (09:34 +0100)
committerPiotr Czaja <p.czaja@samsung.com>
Thu, 5 May 2022 12:30:08 +0000 (14:30 +0200)
Change-Id: I71db99dd7b51b0301dba69716e2011cf17634e38

Oobe/Oobe.Common/Pages/BasePage.cs
Oobe/Oobe.Common/res/page/0_BG_WHITEsmall.png [deleted file]
Oobe/Oobe.Common/res/page/fhd_whitebg.9.png [new file with mode: 0644]
Oobe/Oobe.Common/res/page/hd_whitebg.9.png [new file with mode: 0644]
Oobe/Oobe.Common/res/page/uhd_whitebg.9.png [new file with mode: 0644]

index 3c23ffec7b0b1f1c925539a0f7ef8b3c8d056971..748a4aa5f3b6a8c65b385e2622f736e567915782 100644 (file)
@@ -16,6 +16,7 @@
 
 using Oobe.Common.Styles;
 using Oobe.Common.Utils;
+using System;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
@@ -27,6 +28,9 @@ namespace Oobe.Common.Pages
     /// </summary>
     public class BasePage : View
     {
+        private const string hdBackgroundFile = "hd_whitebg.9.png";
+        private const string fhdBackgroundFile = "fhd_whitebg.9.png";
+        private const string uhdBackgroundFile = "uhd_whitebg.9.png";
         private View content;
         private View dimView;
 
@@ -58,8 +62,32 @@ namespace Oobe.Common.Pages
                 FontStyle = new PropertyMap().AddLightFontStyle(),
             };
             dimView.Add(Title);
-            BackgroundImage = NUIApplication.Current.DirectoryInfo.Resource + "page/0_BG_WHITEsmall.png";
             Add(dimView);
+            SetBackground();
+        }
+
+        private void SetBackground()
+        {
+            var visualMap = new NPatchVisual();
+            visualMap.URL = GetBackgroundUrl();
+            Background = 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;
         }
 
         /// <summary>
diff --git a/Oobe/Oobe.Common/res/page/0_BG_WHITEsmall.png b/Oobe/Oobe.Common/res/page/0_BG_WHITEsmall.png
deleted file mode 100644 (file)
index 4e6dfdf..0000000
Binary files a/Oobe/Oobe.Common/res/page/0_BG_WHITEsmall.png and /dev/null differ
diff --git a/Oobe/Oobe.Common/res/page/fhd_whitebg.9.png b/Oobe/Oobe.Common/res/page/fhd_whitebg.9.png
new file mode 100644 (file)
index 0000000..01ca44f
Binary files /dev/null and b/Oobe/Oobe.Common/res/page/fhd_whitebg.9.png differ
diff --git a/Oobe/Oobe.Common/res/page/hd_whitebg.9.png b/Oobe/Oobe.Common/res/page/hd_whitebg.9.png
new file mode 100644 (file)
index 0000000..625e370
Binary files /dev/null and b/Oobe/Oobe.Common/res/page/hd_whitebg.9.png differ
diff --git a/Oobe/Oobe.Common/res/page/uhd_whitebg.9.png b/Oobe/Oobe.Common/res/page/uhd_whitebg.9.png
new file mode 100644 (file)
index 0000000..982691b
Binary files /dev/null and b/Oobe/Oobe.Common/res/page/uhd_whitebg.9.png differ