public static Size SharePanelSize = new Size2D(SharePanelWidth, SharePanelHeight);
public static int SharePanelPositionY = WindowHeight - SharePanelHeight - TaskBarHeight;
-
+ public static int TopViewWidth = WindowWidth;
+ public static int TopViewHeight = (int)((90 * WindowHeight) / 1080);
+ public static int SharePanelCornerRadius = (28 * WindowHeight) / 1080;
+ public static int HeaderWidth = (WindowWidth * 9) / 10;
+ public static float TextPointSize = (14.5f * 1080) / WindowHeight;
public static Size OuterViewSize = new Size2D(OuterViewWidth, OuterViewHeight);
+ public static int CloseButtonWidth = WindowWidth / 10;
+ public static int CloseButtonHeight = (int)((80 * WindowHeight) / 1080);
+ public static Size CloseButtonSize = new Size2D(CloseButtonWidth, CloseButtonHeight);
+
public static string KEY_BACK = "XF86Back";
public static string KEY_ESCAPE = "Escape";
}
--- /dev/null
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace SharePanel.Common
+{
+ class PropertyNotifier : INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
+ {
+ if (Equals(storage, value))
+ {
+ return false;
+ }
+
+ storage = value;
+ OnPropertyChanged(propertyName);
+ Logger.Info(propertyName + " Set to " + value);
+ return true;
+ }
+
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using SharePanel.Common;
+using System.Collections;
+using System.Collections.Generic;
+using System.Windows.Input;
+using Tizen.Applications;
+using Tizen.NUI.Binding;
+
+namespace SharePanel.ViewModels
+{
+ internal class SharePanelViewModel: PropertyNotifier
+ {
+ private ICommand closeClicked;
+ private IEnumerable itemModelList;
+
+ public SharePanelViewModel()
+ {
+ CloseClicked = new Command(onCloseClicked);
+ }
+
+ public ICommand CloseClicked
+ {
+ get => closeClicked;
+ set => SetProperty(ref closeClicked, value);
+ }
+
+ public IEnumerable ItemModelList
+ {
+ get => itemModelList;
+ set => SetProperty(ref itemModelList, value);
+ }
+
+ public void onCloseClicked()
+ {
+ Logger.Info("Closing Share Panel");
+ Application.Current.Exit();
+ }
+ }
+}
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
using SharePanel.Common;
+using Tizen.NUI.Components;
+using SharePanel.ViewModels;
+using Tizen.NUI.Binding;
namespace SharePanel.Views
{
{
private SharePanelView sharePanelView;
private View outerView;
+ private SharePanelViewModel viewModel;
public MainView()
{
private void AddOuterView()
{
- Logger.Debug("AddOuterView()");
+ Logger.Debug("AddOuterView(): Outer View Created");
outerView = new View()
{
private void AddSharePanel()
{
- Logger.Debug("AddSharePanel()");
+ Logger.Debug("AddSharePanel(): Share Panel View Created");
+ viewModel = new SharePanelViewModel();
sharePanelView = new SharePanelView();
+ sharePanelView.BindingContext = viewModel;
+
+ sharePanelView.closeButton.SetBinding(Control.CommandProperty, "CloseClicked");
+
Add(sharePanelView);
}
+
+ private bool OnOuterViewTouched(object sender, TouchEventArgs e)
+ {
+ Logger.Info("Outer View Touched");
+ viewModel.onCloseClicked();
+ return true;
+ }
}
}
\ No newline at end of file
using Tizen.NUI;
+using Tizen.NUI.Components;
using Tizen.NUI.BaseComponents;
using SharePanel.Common;
+using System.Reflection.PortableExecutable;
namespace SharePanel.Views
{
internal class SharePanelView : View
{
+ private View topBar;
+ private View headerView;
+ public Button closeButton;
+ public TextLabel header;
+
public SharePanelView()
{
Size = AppConstants.SharePanelSize;
BackgroundColor = Color.White;
PositionY = AppConstants.SharePanelPositionY;
+ CornerRadius = AppConstants.SharePanelCornerRadius;
Layout = new LinearLayout
{
LinearOrientation = LinearLayout.Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Center,
};
+
+ AddTopBar();
+ }
+
+ public void AddTopBar()
+ {
+ topBar = new View
+ {
+ BackgroundColor = Color.White,
+ WidthSpecification = AppConstants.TopViewWidth,
+ HeightSpecification = AppConstants.TopViewHeight,
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Horizontal,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ },
+ CornerRadius = AppConstants.SharePanelCornerRadius
+ };
+ AddHeaderView();
+ AddCloseButton();
+ Add(topBar);
+ }
+
+ public void AddHeaderView()
+ {
+ headerView = new View()
+ {
+ WidthSpecification = AppConstants.HeaderWidth,
+ HeightSpecification = AppConstants.TopViewHeight,
+
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Horizontal,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center
+ }
+ };
+
+ Logger.Debug("height under headerview is " + AppConstants.TopViewHeight);
+
+ header = new TextLabel()
+ {
+ Text = "Share",
+ PointSize = AppConstants.TextPointSize,
+ Margin = new Extents((ushort)AppConstants.CloseButtonWidth, 0, 0, 0)
+ };
+ Logger.Debug("Header pointsize is " + header.PointSize);
+ headerView.Add(header);
+
+ topBar.Add(headerView);
+ }
+
+ public void AddCloseButton()
+ {
+ closeButton = new Button()
+ {
+ IconURL = "*Resource*/Images/close.png",
+ Size = AppConstants.CloseButtonSize,
+ CornerRadius = AppConstants.SharePanelCornerRadius,
+ BackgroundColor = Color.White,
+ CellHorizontalAlignment = HorizontalAlignmentType.Right
+ };
+ topBar.Add(closeButton);
}
}
}
\ No newline at end of file