From 6efca8196563709994cfa935ca634533a80d2d1d Mon Sep 17 00:00:00 2001 From: Lukasz Stanislawski Date: Tue, 20 Oct 2020 11:10:51 +0200 Subject: [PATCH] UI Prototype --- Fitness/Fitness.csproj | 4 ++-- Fitness/Views/ExercisePreviewView.cs | 12 ++++++++++ Fitness/Views/ExercisingView.cs | 12 ++++++++++ Fitness/Views/ExtentsInUnitsExtension.cs | 36 +++++++++++++++++++++++++++++ Fitness/Views/LoadingView.cs | 12 ++++++++++ Fitness/Views/MainView.xaml.cs | 1 + Fitness/Views/ScanningView.cs | 12 ++++++++++ Fitness/Views/UnitsUtils.cs | 16 +++++++++++++ Fitness/res/layout/1280x720/MainView.xaml | 15 ------------ Fitness/res/layout/ExercisePreviewView.xaml | 6 +++++ Fitness/res/layout/ExercisingView.xaml | 6 +++++ Fitness/res/layout/LoadingView.xaml | 6 +++++ Fitness/res/layout/MainView.xaml | 32 +++++++++++++++++++++++++ Fitness/res/layout/ScanningView.xaml | 6 +++++ 14 files changed, 159 insertions(+), 17 deletions(-) create mode 100644 Fitness/Views/ExercisePreviewView.cs create mode 100644 Fitness/Views/ExercisingView.cs create mode 100644 Fitness/Views/ExtentsInUnitsExtension.cs create mode 100644 Fitness/Views/LoadingView.cs create mode 100644 Fitness/Views/ScanningView.cs delete mode 100644 Fitness/res/layout/1280x720/MainView.xaml create mode 100644 Fitness/res/layout/ExercisePreviewView.xaml create mode 100644 Fitness/res/layout/ExercisingView.xaml create mode 100644 Fitness/res/layout/LoadingView.xaml create mode 100644 Fitness/res/layout/MainView.xaml create mode 100644 Fitness/res/layout/ScanningView.xaml diff --git a/Fitness/Fitness.csproj b/Fitness/Fitness.csproj index d2c4b45..5194ad6 100644 --- a/Fitness/Fitness.csproj +++ b/Fitness/Fitness.csproj @@ -31,11 +31,11 @@ - + - + diff --git a/Fitness/Views/ExercisePreviewView.cs b/Fitness/Views/ExercisePreviewView.cs new file mode 100644 index 0000000..08fb6c0 --- /dev/null +++ b/Fitness/Views/ExercisePreviewView.cs @@ -0,0 +1,12 @@ +using Tizen.NUI.BaseComponents; + +namespace Fitness.Views +{ + public partial class ExercisePreviewView : View + { + public ExercisePreviewView() + { + InitializeComponent(); + } + } +} diff --git a/Fitness/Views/ExercisingView.cs b/Fitness/Views/ExercisingView.cs new file mode 100644 index 0000000..60e7bb9 --- /dev/null +++ b/Fitness/Views/ExercisingView.cs @@ -0,0 +1,12 @@ +using Tizen.NUI.BaseComponents; + +namespace Fitness.Views +{ + public partial class ExercisingView : View + { + public ExercisingView() + { + InitializeComponent(); + } + } +} diff --git a/Fitness/Views/ExtentsInUnitsExtension.cs b/Fitness/Views/ExtentsInUnitsExtension.cs new file mode 100644 index 0000000..dffe89f --- /dev/null +++ b/Fitness/Views/ExtentsInUnitsExtension.cs @@ -0,0 +1,36 @@ +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; +using Tizen.NUI.Xaml; + +namespace Fitness.Views +{ + public class ExtentsInUnitsExtension : IMarkupExtension + { + /// + /// Start offset in units + /// + public ushort Start { get; set; } + + /// + /// End offset in units + /// + public ushort End { get; set; } + + /// + /// Top offset in units + /// + public ushort Top { get; set; } + + /// + /// Bottom offset in units + /// + public ushort Bottom { get; set; } + + public object ProvideValue(IServiceProvider provider) + { + return new Extents(UnitsUtils.UnitsToPixels(Start), UnitsUtils.UnitsToPixels(End), UnitsUtils.UnitsToPixels(Top), UnitsUtils.UnitsToPixels(Bottom)); + } + } +} diff --git a/Fitness/Views/LoadingView.cs b/Fitness/Views/LoadingView.cs new file mode 100644 index 0000000..6585649 --- /dev/null +++ b/Fitness/Views/LoadingView.cs @@ -0,0 +1,12 @@ +using Tizen.NUI.BaseComponents; + +namespace Fitness.Views +{ + public partial class LoadingView : View + { + public LoadingView() + { + InitializeComponent(); + } + } +} diff --git a/Fitness/Views/MainView.xaml.cs b/Fitness/Views/MainView.xaml.cs index ffd5a79..79763f1 100644 --- a/Fitness/Views/MainView.xaml.cs +++ b/Fitness/Views/MainView.xaml.cs @@ -1,3 +1,4 @@ +using Tizen.NUI; using Tizen.NUI.BaseComponents; namespace Fitness.Views diff --git a/Fitness/Views/ScanningView.cs b/Fitness/Views/ScanningView.cs new file mode 100644 index 0000000..e48c2a5 --- /dev/null +++ b/Fitness/Views/ScanningView.cs @@ -0,0 +1,12 @@ +using Tizen.NUI.BaseComponents; + +namespace Fitness.Views +{ + public partial class ScanningView : View + { + public ScanningView() + { + InitializeComponent(); + } + } +} diff --git a/Fitness/Views/UnitsUtils.cs b/Fitness/Views/UnitsUtils.cs index 83e0e4a..c3faa55 100644 --- a/Fitness/Views/UnitsUtils.cs +++ b/Fitness/Views/UnitsUtils.cs @@ -19,6 +19,14 @@ namespace Fitness.Views } /// + /// Converts units into pixels using current UnitSize settings + /// + public static ushort UnitsToPixels(ushort units) + { + return (ushort)(units * (ushort)Config.PixelsPerUnit); + } + + /// /// Converts pixels into units using current UnitSize settings /// public static int PixelsToUnits(int pixels) @@ -41,5 +49,13 @@ namespace Fitness.Views { return new Size2D(PixelsToUnits(size.Width), PixelsToUnits(size.Height)); } + + /// + /// Converts pixels into units using current UnitSize settings + /// + public static Extents UnitsToPixels(Extents extents) + { + return new Extents(UnitsToPixels(extents.Start), UnitsToPixels(extents.End), UnitsToPixels(extents.Top), UnitsToPixels(extents.Bottom)); + } } } diff --git a/Fitness/res/layout/1280x720/MainView.xaml b/Fitness/res/layout/1280x720/MainView.xaml deleted file mode 100644 index f38c720..0000000 --- a/Fitness/res/layout/1280x720/MainView.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/Fitness/res/layout/ExercisePreviewView.xaml b/Fitness/res/layout/ExercisePreviewView.xaml new file mode 100644 index 0000000..8efd3de --- /dev/null +++ b/Fitness/res/layout/ExercisePreviewView.xaml @@ -0,0 +1,6 @@ + + + diff --git a/Fitness/res/layout/ExercisingView.xaml b/Fitness/res/layout/ExercisingView.xaml new file mode 100644 index 0000000..940f50f --- /dev/null +++ b/Fitness/res/layout/ExercisingView.xaml @@ -0,0 +1,6 @@ + + + diff --git a/Fitness/res/layout/LoadingView.xaml b/Fitness/res/layout/LoadingView.xaml new file mode 100644 index 0000000..b0377a5 --- /dev/null +++ b/Fitness/res/layout/LoadingView.xaml @@ -0,0 +1,6 @@ + + + diff --git a/Fitness/res/layout/MainView.xaml b/Fitness/res/layout/MainView.xaml new file mode 100644 index 0000000..c96009e --- /dev/null +++ b/Fitness/res/layout/MainView.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Fitness/res/layout/ScanningView.xaml b/Fitness/res/layout/ScanningView.xaml new file mode 100644 index 0000000..e111ae9 --- /dev/null +++ b/Fitness/res/layout/ScanningView.xaml @@ -0,0 +1,6 @@ + + + -- 2.7.4