(WIP)
authorHyerim Kim <rimi.kim@samsung.com>
Tue, 23 May 2017 06:20:56 +0000 (15:20 +0900)
committerHyerim Kim <rimi.kim@samsung.com>
Tue, 23 May 2017 07:17:35 +0000 (16:17 +0900)
Modifies text of No content and font properties
Implements delete and update MediaInformation

Change-Id: Ib05434a8b275d6dd0702b63754ae6f017649c219
Signed-off-by: Hyerim Kim <rimi.kim@samsung.com>
TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs
TVMediaHub/TVMediaHub.Tizen/ViewModels/VideoTabViewModel.cs
TVMediaHub/TVMediaHub.Tizen/Views/ImageTab.xaml
TVMediaHub/TVMediaHub.Tizen/Views/ImageTab.xaml.cs
TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml [changed mode: 0644->0755]
TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml.cs
TVMediaHub/TVMediaHub.Tizen/Views/VideoPlayer.xaml
TVMediaHub/TVMediaHub.Tizen/Views/VideoPlayer.xaml.cs
TVMediaHub/TVMediaHub.Tizen/Views/VideoTab.xaml [changed mode: 0644->0755]
TVMediaHub/TVMediaHub.Tizen/Views/VideoTab.xaml.cs

index d854f10..6563a37 100755 (executable)
@@ -383,9 +383,17 @@ namespace TVMediaHub.Tizen.Models
         /// </summary>
         /// <param name="media">A media content to be deleted</param>
         /// <returns>Always returns true</returns>
-        bool Delete(MediaInformation media)
+        public bool Delete(MediaInformation media)
         {
-            // TODO : delete
+            try
+            {
+                ContentManager.Database.Delete(media);
+            }
+            catch (Exception exception)
+            {
+                Log.Error(TAG, exception.Message);
+            }
+
             return true;
         }
 
@@ -394,9 +402,18 @@ namespace TVMediaHub.Tizen.Models
         /// </summary>
         /// <param name="media">A media content to be updated</param>
         /// <returns>Always returns true</returns>
-        bool Update(MediaInformation media)
+        public bool Update(MediaInformation media)
         {
-            // TODO : update
+            try
+            {
+                ContentManager.Database.Update(media);
+                UpdateListeners?.Invoke(this, EventArgs.Empty);
+            }
+            catch (Exception exception)
+            {
+                Log.Error(TAG, exception.Message);
+            }
+
             return true;
         }
 
index 9ef6ff2..5e912de 100755 (executable)
@@ -89,6 +89,11 @@ namespace TVMediaHub.Tizen.ViewModels
         public ICommand GetInformationsCommand { get; set; }
 
         /// <summary>
+        /// A command for deleting a video content
+        /// </summary>
+        public ICommand DeleteContentCommand { get; set; }
+
+        /// <summary>
         /// A command to set current video information
         /// </summary>
         public ICommand SetCurrentVideoInfo
@@ -172,6 +177,19 @@ namespace TVMediaHub.Tizen.ViewModels
                     }
                 }
             });
+            DeleteContentCommand = new Command(() =>
+            {
+                IsDeleteStatus = !IsDeleteStatus;
+
+                foreach (var group in VideoList)
+                {
+                    foreach (var info in group.Contents)
+                    {
+                        info.IsDeleteStatus = IsDeleteStatus;
+                        MediaHubImpl.GetInstance.VideoProviderInstance.Delete(info.Information);
+                    }
+                }
+            });
             ChangeSortOptionCommand = new Command<string>((opt) =>
             {
                 var option = opt.ToLower();
index bb60352..925d0f9 100755 (executable)
@@ -44,7 +44,7 @@
         <StackLayout x:Name="GalleryNoContents" Orientation="Vertical" IsVisible="True"
                      RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}">
             <Image x:Name="ImgNoContents" Source="img_media_no_contents.png" HorizontalOptions="Center"/>
-            <Label x:Name="LabelNoContents" Text="No content to display" FontFamily="Breeze Sans Light" TextColor="#33FFFFFF" HorizontalOptions="Center"/>
+            <Label x:Name="LabelNoContents" Text="No content" FontFamily="BreezeSans" HorizontalOptions="Center"/>
         </StackLayout>
     </RelativeLayout>
 </mh:ContentPageEx>
\ No newline at end of file
index 33d8d58..c2f9d87 100755 (executable)
@@ -145,6 +145,7 @@ namespace TVMediaHub.Tizen.Views
 
             InitializeData();
             InitializeSize();
+            InitializeFonts();
             InitializeFooter();
             ItemsSource.CollectionChanged += ItemsSourceCollectionChanged;
 
@@ -178,6 +179,15 @@ namespace TVMediaHub.Tizen.Views
         }
 
         /// <summary>
+        /// A method for initializing several fonts that are used in this class
+        /// </summary>
+        private void InitializeFonts()
+        {
+            LabelNoContents.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Light);
+            LabelNoContents.TextColor = Color.FromRgba(255, 255, 255, 20);
+        }
+
+        /// <summary>
         /// A method for initializing footer
         /// </summary>
         private void InitializeFooter()
old mode 100644 (file)
new mode 100755 (executable)
index 663ead1..3179c60
@@ -26,7 +26,7 @@
             <StackLayout x:Name="MusicNoContents" Orientation="Vertical" IsVisible="True"
                             RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}">
                 <Image x:Name="ImgNoContents" Source="img_media_no_contents.png" HorizontalOptions="Center"/>
-                <Label x:Name="LabelNoContents" Text="No content to display" FontFamily="Breeze Sans Light" TextColor="#33FFFFFF" HorizontalOptions="Center"/>
+                <Label x:Name="LabelNoContents" Text="No content" FontFamily="BreezeSans" HorizontalOptions="Center"/>
             </StackLayout>
         </RelativeLayout>
     </RelativeLayout>
index 87f9415..60ff382 100755 (executable)
@@ -17,6 +17,7 @@
 using TVMediaHub.Tizen.Controls;
 using TVMediaHub.Tizen.Utils;
 using Xamarin.Forms;
+using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
 
 namespace TVMediaHub.Tizen.Views
 {
@@ -33,6 +34,7 @@ namespace TVMediaHub.Tizen.Views
         {
             InitializeComponent();
             InitializeSize();
+            InitializeFonts();
         }
 
         /// <summary>
@@ -48,6 +50,15 @@ namespace TVMediaHub.Tizen.Views
         }
 
         /// <summary>
+        /// A method for initializing several fonts that are used in this class
+        /// </summary>
+        private void InitializeFonts()
+        {
+            LabelNoContents.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Light);
+            LabelNoContents.TextColor = Color.FromRgba(255, 255, 255, 20);
+        }
+
+        /// <summary>
         /// A method for initializing page when the page is appeared
         /// </summary>
         protected override void InitializePage()
index 3799242..54a7975 100755 (executable)
                                      RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.075}"
                                      RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
                                      RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.5958}" />
-
-            <Controls:MediaHubButton x:Name="OptionBtn"
-                                     RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
-                                     RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.075}"
-                                     RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
-                                     RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.9015}" />
         </RelativeLayout>
 
         <RelativeLayout x:Name="SpeedInfo" IsVisible="false" Opacity="0"
                    TextColor="White"
                    HorizontalTextAlignment="Start"/>
         </RelativeLayout>
-
-        <BoxView x:Name="PopupAnchor"
-                 Opacity="0"
-                 RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.1333}"
-                 RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.177}"
-                 RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.6963}"
-                 RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.7729}" />
     </RelativeLayout>
 </mh:ContentPageEx>
\ No newline at end of file
index f0a6025..59b9546 100755 (executable)
@@ -507,10 +507,7 @@ namespace TVMediaHub.Tizen.Views
             ForwardBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusRightView(NextBtn.MediaHubButtonBtn);
 
             NextBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusLeftView(ForwardBtn.MediaHubButtonBtn);
-            NextBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusRightView(OptionBtn.MediaHubButtonBtn);
-
-            OptionBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusLeftView(NextBtn.MediaHubButtonBtn);
-            OptionBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusRightView(OptionBtn.MediaHubButtonBtn);
+            NextBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusRightView(NextBtn.MediaHubButtonBtn);
 
             RunShowAnimation();
             timer = ElmSharp.EcoreMainloop.AddTimer(timerInterval, HideControlAreaHandler());
@@ -619,8 +616,8 @@ namespace TVMediaHub.Tizen.Views
         /// </summary>
         private void InitializeButtons()
         {
-            MediaHubButton[] buttons = new MediaHubButton[6] { PreviousBtn, RewindBtn, PausePlayBtn, ForwardBtn, NextBtn, OptionBtn };
-            string[] icons = new string[6] { "previous", "rewind", "play", "forward", "next", "option" };
+            MediaHubButton[] buttons = new MediaHubButton[5] { PreviousBtn, RewindBtn, PausePlayBtn, ForwardBtn, NextBtn };
+            string[] icons = new string[5] { "previous", "rewind", "play", "forward", "next" };
             string iconPath = "btn_viewer_control_previous_normal.png";
 
             for (int i = 0; i < buttons.Length; i++)
old mode 100644 (file)
new mode 100755 (executable)
index 6142e55..d3d576b
@@ -11,7 +11,8 @@
              ChangeTabStatusCommand="{Binding ChangeTabStatusCommand}"
              ChangeSortOptionCommand="{Binding ChangeSortOptionCommand}"
              GetInformationsCommand="{Binding GetInformationsCommand}"
-             OnClickCommand="{Binding SetCurrentVideoInfo}">
+             OnClickCommand="{Binding SetCurrentVideoInfo}"
+             DeleteContentCommand="{Binding DeleteContentCommand}">
     <RelativeLayout
         RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
         RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}">
@@ -46,7 +47,7 @@
         <StackLayout x:Name="VideoNoContents" Orientation="Vertical" IsVisible="True"
                      RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}">
             <Image x:Name="ImgNoContents" Source="img_media_no_contents.png" HorizontalOptions="Center"/>
-            <Label x:Name="LabelNoContents" Text="No content to display" FontFamily="Breeze Sans Light" TextColor="#33FFFFFF" HorizontalOptions="Center"/>
+            <Label x:Name="LabelNoContents" Text="No content" FontFamily="BreezeSans" HorizontalOptions="Center"/>
         </StackLayout>
     </RelativeLayout>
 </mh:ContentPageEx>
\ No newline at end of file
index cbf1b65..58336da 100755 (executable)
@@ -109,6 +109,20 @@ namespace TVMediaHub.Tizen.Views
         }
 
         /// <summary>
+        /// Identifies the DeleteContentCommand bindable property
+        /// </summary>
+        public static readonly BindableProperty DeleteContentCommandProperty = BindableProperty.Create("DeleteContentCommand", typeof(ICommand), typeof(VideoTab), default(ICommand));
+
+        /// <summary>
+        /// Gets or sets DeleteContent Command
+        /// </summary>
+        public ICommand DeleteContentCommand
+        {
+            get { return (ICommand)GetValue(DeleteContentCommandProperty); }
+            set { SetValue(DeleteContentCommandProperty, value); }
+        }
+
+        /// <summary>
         /// Identifies the OnClickCommand bindable property
         /// </summary>
         public static readonly BindableProperty OnClickCommandProperty = BindableProperty.Create("OnClickCommand", typeof(ICommand), typeof(VideoItem), default(ICommand));
@@ -143,6 +157,7 @@ namespace TVMediaHub.Tizen.Views
             InitializeComponent();
             InitializeData();
             InitializeSize();
+            InitializeFonts();
             InitializeFooter();
             ItemsSource.CollectionChanged += ItemsSourceCollectionChanged;
         }
@@ -156,6 +171,15 @@ namespace TVMediaHub.Tizen.Views
         }
 
         /// <summary>
+        /// A method for initializing several fonts that are used in this class
+        /// </summary>
+        private void InitializeFonts()
+        {
+            LabelNoContents.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Light);
+            LabelNoContents.TextColor = Color.FromRgba(255, 255, 255, 20);
+        }
+
+        /// <summary>
         /// Initialize the size that is used in this class
         /// </summary>
         private void InitializeSize()
@@ -422,6 +446,7 @@ namespace TVMediaHub.Tizen.Views
         {
             // TODO : Change to delete Content command
             ChangeTabStatusCommand?.Execute("");
+            DeleteContentCommand?.Execute("");
             FooterNormal.IsVisible = true;
             FooterDelete.IsVisible = false;
             SetFooterFocusChain(VideoTabScrollView.ScrollX);