Remove scanning view.
authorPiotr Czaja/Advanced Frameworks (PLT) /SRPOL/Engineer/Samsung Electronics <p.czaja@samsung.com>
Mon, 30 Aug 2021 10:41:38 +0000 (12:41 +0200)
committerPiotr Czaja <p.czaja@samsung.com>
Tue, 14 Sep 2021 11:01:34 +0000 (13:01 +0200)
Fitness/Services/NavigationService.cs
Fitness/ViewModels/MainViewModel.cs
Fitness/ViewModels/ScanningViewModel.cs [deleted file]
Fitness/Views/ScanningView.cs [deleted file]
Fitness/res/layout/ScanningView.xaml [deleted file]

index 1ed12aaab4454442f6038dcc8f56e5c935b66143..ecbd579305e49aff703787980366ef60b5cc8f30 100644 (file)
@@ -65,17 +65,6 @@ namespace Fitness.Services
             navigation.Push(new ExercisePreviewView(workoutId));
         }
 
-        public async Task NavigateToScanningView()
-        {
-            var result = await PrivilegeService.Instance.CheckCameraPrivilege();
-
-            if (result == Tizen.Security.RequestResult.AllowForever
-                && TryCreateCameraDependentView(() => new ScanningView(), out Controls.Page view))
-            {
-                navigation.Push(view);
-            }
-        }
-
         public void Pop()
         {
             navigation.Pop();
index 95a34cddc459e4d52055d05d83bd84c01dca29a5..7fefdd6bfae048da66b88423b5a2096cb0d2f6ea 100644 (file)
@@ -16,7 +16,7 @@ namespace Fitness.ViewModels
         public MainViewModel()
         {
             WatchPreview = new Command(() => { NavigationService.Instance.NavigateToExercisePreviewView(SelectedWorkout.Id); });
-            StartWorkout = new Command(() => _ = NavigationService.Instance.NavigateToScanningView());
+            StartWorkout = new Command(() => _ = NavigationService.Instance.NavigateToExercisingView(SelectedWorkout));
             Exit = new Command(() => { Tizen.NUI.NUIApplication.Current.Exit(); });
 
             Workouts = WorkoutRepository.Instance.GetAll();
diff --git a/Fitness/ViewModels/ScanningViewModel.cs b/Fitness/ViewModels/ScanningViewModel.cs
deleted file mode 100644 (file)
index 089bf98..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-using System.Windows.Input;
-using Fitness.Services;
-using Tizen.Multimedia.Vision;
-using Tizen.NUI.Binding;
-
-namespace Fitness.ViewModels
-{
-    /// <summary>
-    /// Class handling the scanning view.
-    /// </summary>
-    public class ScanningViewModel : BaseViewModel
-    {
-        private int count;
-        private int hold;
-        private int score;
-        private Landmark[,] poseLandmarks;
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ScanningViewModel"/> class.
-        /// </summary>
-        public ScanningViewModel()
-        {
-            CloseScanningView = new Command(() =>
-            {
-                NavigationService.Instance.Pop();
-            });
-            SquatService = new SquatService()
-            {
-                HoldTimeThreshold = 1200,
-            };
-            SquatService.ExerciseStateUpdated += SquatService_ExerciseStateUpdated;
-        }
-
-        /// <summary>
-        /// Gets the pose landmark property.
-        /// </summary>
-        public Landmark[,] PoseLandmarks
-        {
-            get => poseLandmarks;
-            private set
-            {
-                if (value != poseLandmarks)
-                {
-                    poseLandmarks = value;
-                    RaisePropertyChanged();
-                }
-            }
-        }
-
-        /// <summary>
-        /// Gets or sets  the property specifying the correctness of the exercise - values ranging from 0 to 100.
-        /// </summary>
-        public int Score
-        {
-            get => score;
-            set
-            {
-                if (value != score)
-                {
-                    score = value;
-                    RaisePropertyChanged();
-                }
-            }
-        }
-
-        /// <summary>
-        /// Gets or sets the property specifying the number of repetitions of the exercise.
-        /// </summary>
-        public int Count
-        {
-            get => count;
-            set
-            {
-                if (value != count)
-                {
-                    count = value;
-                    RaisePropertyChanged();
-                }
-            }
-        }
-
-        /// <summary>
-        /// Gets or sets the property specifying the time of the exercise performed - values ranging from 0 to 5.
-        /// </summary>
-        public int Hold
-        {
-            get => hold;
-            set
-            {
-                if (value != hold)
-                {
-                    hold = value;
-                    RaisePropertyChanged();
-                }
-            }
-        }
-
-        /// <summary>
-        /// Gets title.
-        /// </summary>
-        public string Title { get; private set; } = "ScanningView";
-
-        /// <summary>
-        /// Gets the <see cref="SquatService"/> property.
-        /// </summary>
-        public IExerciseService SquatService { get; private set; }
-
-        /// <summary>
-        /// Gets EndWorkout Command.
-        /// </summary>
-        public ICommand CloseScanningView { get; private set; }
-
-        private void SquatService_ExerciseStateUpdated(object sender, ExerciseStateUpdatedEventArgs e)
-        {
-            PoseLandmarks = e.PoseLandmarks;
-            Score = e.Score;
-            Count = e.Count;
-            Hold = e.Hold;
-        }
-    }
-}
diff --git a/Fitness/Views/ScanningView.cs b/Fitness/Views/ScanningView.cs
deleted file mode 100644 (file)
index e750d2f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-using Tizen.Multimedia;
-
-namespace Fitness.Views
-{
-    /// <summary>
-    /// The page to adjust body.
-    /// </summary>
-    public partial class ScanningView : Fitness.Controls.Page
-    {
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ScanningView"/> class.
-        /// </summary>
-        public ScanningView()
-        {
-            InitializeComponent();
-            cameraView.Preview += DetectPreview;
-        }
-
-        /// <summary>
-        /// OnDisappearing.
-        /// </summary>
-        protected override void OnDisappearing()
-        {
-            if (cameraView?.PreviewState == Tizen.Multimedia.CameraState.Preview)
-            {
-                cameraView.Preview -= DetectPreview;
-                cameraView.StopPreview();
-            }
-        }
-
-        private void DetectPreview(object sender, PreviewEventArgs e)
-        {
-            if (BindingContext is ViewModels.ScanningViewModel viewModel)
-            {
-                _ = viewModel.SquatService.DetectExercise(e.Preview);
-            }
-        }
-    }
-}
diff --git a/Fitness/res/layout/ScanningView.xaml b/Fitness/res/layout/ScanningView.xaml
deleted file mode 100644 (file)
index 654a114..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ctrl:Page x:Class="Fitness.Views.ScanningView"
-           xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
-           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-           xmlns:vm="clr-namespace:Fitness.ViewModels"
-           xmlns:ctrl="clr-namespace:Fitness.Controls"
-           xmlns:views="clr-namespace:Fitness.Views"
-           xmlns:behaviors="clr-namespace:Fitness.Views.Behaviors"
-           HeightSpecification="{Static LayoutParamPolicies.MatchParent}"
-           WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
-           BackgroundColor="#EEEFF1"
-           ParentOrigin="Center"
-           PivotPoint="Center"
-           PositionUsesPivotPoint="true"
-           x:Name="Root">
-    
-    <View.BindingContext>
-        <vm:ScanningViewModel/>
-    </View.BindingContext>
-    
-    <View Position="320, 100"
-          Size="1280, 960">
-        
-        <ctrl:Camera x:Name="cameraView"
-                     WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
-                     HeightSpecification="{Static LayoutParamPolicies.MatchParent}"
-                     PreviewFps="Fps30"/>
-        
-        <ctrl:Overlay WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
-                      HeightSpecification="{Static LayoutParamPolicies.MatchParent}"
-                      BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
-                      PoseLandmarks="{Binding PoseLandmarks}">
-            <x:Arguments>
-                <Size2D>1280, 960</Size2D>
-            </x:Arguments>
-        </ctrl:Overlay>
-    
-    </View>
-    
-    <View WidthSpecification="{Static LayoutParamPolicies.MatchParent}">
-        
-        <View.Layout>
-            <LinearLayout LinearOrientation="Horizontal"/>
-        </View.Layout>
-        
-        <View WidthSpecification="{Static LayoutParamPolicies.MatchParent}">
-            
-            <View.Layout>
-                <LinearLayout LinearOrientation="Vertical"/>
-            </View.Layout>
-            
-            <TextLabel BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
-                       Text="{Binding Hold, StringFormat='Hold: {0}'}"
-                       PixelSize="40"
-                       TextColor="Black" />
-            <TextLabel BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
-                       Text="{Binding Count, StringFormat='Count: {0}'}"
-                       PixelSize="40"
-                       TextColor="Black" />
-            <TextLabel BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
-                       Text="{Binding Score, StringFormat='Score: {0}'}"
-                       PixelSize="40"
-                       TextColor="Black"/>
-        
-        </View>
-        
-        <ctrl:NinePatchButton BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
-                              WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
-                              Text="Close"
-                              Size="{views:SizeInUnits Width=80, Height=20}"
-                              PointSize="6"
-                              Command="{Binding CloseScanningView}"/>
-    
-    </View>
-
-</ctrl:Page>