--- /dev/null
+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
--- /dev/null
+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
-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();
}
{
var app = new Program();
app.Run(args);
+ Logger.Info("Share Panel Closed");
}
}
-}
+}
\ No newline at end of file
--- /dev/null
+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
--- /dev/null
+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