Implementation of main frontend of SharePanel 52/316852/13
authorMd. Shahrukh Islam/NC eXperience Group /SRBD/Engineer/Samsung Electronics <shahrukh.i@samsung.com>
Thu, 29 Aug 2024 09:02:54 +0000 (15:02 +0600)
committerMd. Shahrukh Islam/NC eXperience Group /SRBD/Engineer/Samsung Electronics <shahrukh.i@samsung.com>
Thu, 5 Sep 2024 04:32:44 +0000 (10:32 +0600)
[Problem] N/A

[Cause & Measure]
 Cause : N/A
 Measure : Implemented front end part of mainview of sharepanel.

Change-Id: I5feb3a17d743d28bb8194018822bd303ef45ca59
Signed-off-by: Md. Shahrukh Islam/NC eXperience Group /SRBD/Engineer/Samsung Electronics <shahrukh.i@samsung.com>
SharePanel/SharePanel/Common/AppConstants.cs [new file with mode: 0644]
SharePanel/SharePanel/Common/Logger.cs [new file with mode: 0644]
SharePanel/SharePanel/SharePanel.cs
SharePanel/SharePanel/Views/MainView.cs [new file with mode: 0644]
SharePanel/SharePanel/Views/SharePanelView.cs [new file with mode: 0644]

diff --git a/SharePanel/SharePanel/Common/AppConstants.cs b/SharePanel/SharePanel/Common/AppConstants.cs
new file mode 100644 (file)
index 0000000..cc7cc0e
--- /dev/null
@@ -0,0 +1,25 @@
+using Tizen.NUI;
+
+namespace SharePanel.Common
+{
+    static class AppConstants
+    {
+        private static int WindowWidth = NUIApplication.GetDefaultWindow().Size.Width;
+        private static int WindowHeight = NUIApplication.GetDefaultWindow().Size.Height;
+        private static int TaskBarHeight = (80 * WindowHeight) / 1080;
+
+        private static int SharePanelHeight = (368 * WindowHeight) / 1080;
+        private static int SharePanelWidth = WindowWidth;
+
+        private static int OuterViewWidth = WindowWidth;
+        private static int OuterViewHeight = WindowHeight - TaskBarHeight - SharePanelHeight;
+
+        public static Size SharePanelSize = new Size2D(SharePanelWidth, SharePanelHeight);
+        public static int SharePanelPositionY = WindowHeight - SharePanelHeight - TaskBarHeight;
+
+        public static Size OuterViewSize = new Size2D(OuterViewWidth, OuterViewHeight);
+
+        public static string KEY_BACK = "XF86Back";
+        public static string KEY_ESCAPE = "Escape";
+    }
+}
\ No newline at end of file
diff --git a/SharePanel/SharePanel/Common/Logger.cs b/SharePanel/SharePanel/Common/Logger.cs
new file mode 100644 (file)
index 0000000..1bb1079
--- /dev/null
@@ -0,0 +1,33 @@
+using Tizen.NUI;
+
+namespace SharePanel.Common
+{
+    static class Logger
+    {
+        private static string LogTag = "SHARE_PANEL";
+
+        public static void Debug(string message)
+        {
+            Tizen.Log.Debug(LogTag, message);
+        }
+
+        public static void Info(string message) {
+            Tizen.Log.Info(LogTag, message);
+        }
+
+        public static void Error(string message)
+        {
+            Tizen.Log.Error(LogTag, message);
+        }
+
+        public static void Warn(string message)
+        {
+            Tizen.Log.Warn(LogTag, message);
+        }
+
+        public static void Fatal(string message)
+        {
+            Tizen.Log.Fatal(LogTag, message);
+        }
+    }
+}
\ No newline at end of file
index 11ab4a0a7747e2fe84528a6b73a54eef1f6fcfa5..9890b56cdb2baea30132a59bd6430a9ed1971129 100644 (file)
@@ -1,34 +1,37 @@
-using System;
-using Tizen.NUI;
-using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+using SharePanel.Common;
+using SharePanel.Views;
 
 namespace SharePanel
 {
     class Program : NUIApplication
     {
+        private Window defaultWindow;
+
         protected override void OnCreate()
         {
+            Logger.Debug("OnCreate()");
+
             base.OnCreate();
+            defaultWindow = GetDefaultWindow();
             Initialize();
         }
 
         void Initialize()
         {
-            Window.Instance.KeyEvent += OnKeyEvent;
+            Logger.Debug("Initialize()");
 
-            TextLabel text = new TextLabel("Share-panel");
-            text.HorizontalAlignment = HorizontalAlignment.Center;
-            text.VerticalAlignment = VerticalAlignment.Center;
-            text.TextColor = Color.Blue;
-            text.HeightResizePolicy = ResizePolicyType.FillToParent;
-            text.WidthResizePolicy = ResizePolicyType.FillToParent;
+            defaultWindow.KeyEvent += OnKeyEvent;
+            defaultWindow.SetTransparency(true);
+            defaultWindow.BackgroundColor = Color.Transparent;
 
-            Window.Instance.GetDefaultLayer().Add(text);
+            MainView mainView = new MainView();
+            defaultWindow.Add(mainView);
         }
 
         public void OnKeyEvent(object sender, Window.KeyEventArgs e)
         {
-            if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
+            if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == AppConstants.KEY_BACK || e.Key.KeyPressedName == AppConstants.KEY_ESCAPE))
             {
                 Exit();
             }
@@ -38,6 +41,7 @@ namespace SharePanel
         {
             var app = new Program();
             app.Run(args);
+            Logger.Info("Share Panel Closed");
         }
     }
-}
+}
\ No newline at end of file
diff --git a/SharePanel/SharePanel/Views/MainView.cs b/SharePanel/SharePanel/Views/MainView.cs
new file mode 100644 (file)
index 0000000..d6d82bb
--- /dev/null
@@ -0,0 +1,50 @@
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using SharePanel.Common;
+
+namespace SharePanel.Views
+{
+    internal class MainView : View
+    {
+        private SharePanelView sharePanelView;
+        private View outerView;
+
+        public MainView()
+        {
+            Logger.Debug("MainView()");
+            Layout = new LinearLayout()
+            {
+                LinearOrientation = LinearLayout.Orientation.Vertical
+            };
+
+            AddOuterView();
+            AddSharePanel();
+        }
+
+        private void AddOuterView()
+        {
+            Logger.Debug("AddOuterView()");
+
+            outerView = new View()
+            {
+                Size = AppConstants.OuterViewSize,
+                Layout = new LinearLayout
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                }
+            };
+
+            outerView.BackgroundColor = Color.Transparent;
+            Add(outerView);
+        }
+
+        private void AddSharePanel()
+        {
+            Logger.Debug("AddSharePanel()");
+
+            sharePanelView = new SharePanelView();
+            Add(sharePanelView);
+        }
+    }
+}
\ No newline at end of file
diff --git a/SharePanel/SharePanel/Views/SharePanelView.cs b/SharePanel/SharePanel/Views/SharePanelView.cs
new file mode 100644 (file)
index 0000000..2596757
--- /dev/null
@@ -0,0 +1,22 @@
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using SharePanel.Common;
+
+namespace SharePanel.Views
+{
+    internal class SharePanelView : View
+    {
+        public SharePanelView()
+        {
+            Size = AppConstants.SharePanelSize;
+            BackgroundColor = Color.White;
+            PositionY = AppConstants.SharePanelPositionY;
+
+            Layout = new LinearLayout
+            {
+                LinearOrientation = LinearLayout.Orientation.Vertical,
+                HorizontalAlignment = HorizontalAlignment.Center,
+            };
+        }
+    }
+}
\ No newline at end of file