1. Delete GalleryGridItem
authorjjie.choi <jjie.choi>
Tue, 11 Apr 2017 06:54:05 +0000 (15:54 +0900)
committerjjie.choi <jjie.choi>
Tue, 11 Apr 2017 08:09:10 +0000 (17:09 +0900)
2. Change gallery tab layout
3. Implement gallery delete mode

Change-Id: Icb247c5a5a438222303d968893e306458fed035f

TVMediaHub/TVMediaHub.Tizen/TVMediaHub.Tizen.csproj
TVMediaHub/TVMediaHub.Tizen/ViewModels/ImageTabViewModel.cs
TVMediaHub/TVMediaHub.Tizen/Views/Gallery3ColumnGroupView.xaml
TVMediaHub/TVMediaHub.Tizen/Views/Gallery3ColumnGroupView.xaml.cs
TVMediaHub/TVMediaHub.Tizen/Views/GalleryGridItem.xaml [deleted file]
TVMediaHub/TVMediaHub.Tizen/Views/GalleryGridItem.xaml.cs [deleted file]
TVMediaHub/TVMediaHub.Tizen/Views/GalleryImageContent.xaml
TVMediaHub/TVMediaHub.Tizen/Views/GalleryImageContent.xaml.cs
TVMediaHub/TVMediaHub.Tizen/Views/ImageTab.xaml
TVMediaHub/TVMediaHub.Tizen/Views/ImageTab.xaml.cs
TVMediaHub/TVMediaHub.Tizen/Views/MusicTab.xaml

index f7e634e..2d3290a 100755 (executable)
@@ -76,9 +76,6 @@
     <Compile Include="Views\Gallery3ColumnGroupView.xaml.cs">
       <DependentUpon>Gallery3ColumnGroupView.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\GalleryGridItem.xaml.cs">
-      <DependentUpon>GalleryGridItem.xaml</DependentUpon>
-    </Compile>
     <Compile Include="Views\GalleryImageContent.xaml.cs">
       <DependentUpon>GalleryImageContent.xaml</DependentUpon>
     </Compile>
     <Content Include="res\img_tizen_zoom_minimap_shadow.9.png" />
   </ItemGroup>
   <ItemGroup>
-    <EmbeddedResource Include="Views\GalleryGridItem.xaml">
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
-    </EmbeddedResource>
-  </ItemGroup>
-  <ItemGroup>
     <EmbeddedResource Include="Views\Gallery3ColumnGroupView.xaml">
       <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
     </EmbeddedResource>
   <ProjectExtensions>
     <VisualStudio>
       <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Debug|Any CPU">
-        <ProjectCorporateFlavorCfg />
+        <ProjectCommonFlavorCfg />
       </FlavorProperties>
       <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Release|Any CPU">
-        <ProjectCorporateFlavorCfg />
+        <ProjectCommonFlavorCfg />
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
index aa60516..43670c6 100644 (file)
  * limitations under the License.
  */
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.ComponentModel;
+using Xamarin.Forms;
 
 namespace TVMediaHub.Tizen.ViewModels
 {
-    class ImageTabViewModel
+
+    class ImageTabViewModel:INotifyPropertyChanged
     {
+        int SelectedSource;
+        int SortBy;
+        bool imageDelMode;
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        public Command DeleteModeChangeCommand { get; set; }
+
+        public bool IsDeleteMode
+        {
+            set
+            {
+                if (imageDelMode != value)
+                {
+                    imageDelMode = value;
+                    OnPropertyChanged("IsDeleteMode");
+                }
+            }
+            get
+            {
+                return imageDelMode;
+            }
+        }
+
+        void GetImageData(int source, int sortby)
+        {
+
+        }
+
+        void OnSourceChanged(int source)
+        {
+
+        }
+
+        void OnSortbyChanged(int sortby)
+        {
+            if(SortBy != sortby)
+            {
+                SortBy = sortby;
+            }
+        }
+
+        void OnDeleteModeChanged()
+        {
+            if (IsDeleteMode == false)
+            {
+                IsDeleteMode = true;
+            }
+            else
+            {
+                IsDeleteMode = false;
+            }
+        }
+
+        void OnPropertyChanged(string propertyName)
+        {
+            PropertyChangedEventHandler handler = PropertyChanged;
+            if (handler != null)
+            {
+                handler(this, new PropertyChangedEventArgs(propertyName));
+            }
+        }
+
+        public ImageTabViewModel()
+        {
+            DeleteModeChangeCommand = new Command(() =>
+            {
+                OnDeleteModeChanged();
+            });
+        }
+
     }
+
+
 }
index 2eded45..574e0a1 100644 (file)
@@ -2,7 +2,15 @@
 <StackLayout xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              x:Class="TVMediaHub.Tizen.Views.Gallery3ColumnGroupView">
-    <Label x:Name="groupTitle" Text="AAAAAA"/>
+    <StackLayout.Resources>
+        <ResourceDictionary>
+            <Style x:Key="GroupNameNormal" TargetType="Label">
+                <Setter Property="FontFamily" Value="Breeze Sans Light"/>
+                <Setter Property="TextColor" Value="#33FFFFFF"/>
+            </Style>
+        </ResourceDictionary>
+    </StackLayout.Resources>
+    <Label x:Name="groupTitle" Text="AAAAAA" Style="{StaticResource GroupNameNormal}"/>
     <Grid x:Name="GroupContentArea" ColumnSpacing="2" RowSpacing="2" >
 
     </Grid>
index c92358c..76a715e 100644 (file)
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-using Xamarin.Forms;
+using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
 
 namespace TVMediaHub.Tizen.Views
@@ -19,9 +13,16 @@ namespace TVMediaHub.Tizen.Views
         public Gallery3ColumnGroupView()
         {
             InitializeComponent();
+            InitializeSize();
             AddContentsView();
         }
 
+        private void InitializeSize()
+        {
+            Margin = new Thickness(0, 0, Utils.SizeUtils.GetWidthSize(60), 0);
+            groupTitle.FontSize = Utils.SizeUtils.GetFontSize(30);
+        }
+
         void AddContentsView()
         {
 
diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/GalleryGridItem.xaml b/TVMediaHub/TVMediaHub.Tizen/Views/GalleryGridItem.xaml
deleted file mode 100644 (file)
index 02bc92d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<StackLayout xmlns="http://xamarin.com/schemas/2014/forms"
-             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-             x:Class="TVMediaHub.Tizen.Views.GalleryGridItem">
-
-    <Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
-        <BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Orange" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"/>
-        <Image
-            Grid.Row="0" Grid.Column="0"
-            x:Name="ItemCheckedImage"
-            VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
-            Source="ic_tizen_apps_launcher_pinmark.png" />
-        <Button Grid.Row="0" Grid.Column="0" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Clicked="OnItemTapped" Opacity="0"/>
-    </Grid>
-</StackLayout>
\ No newline at end of file
diff --git a/TVMediaHub/TVMediaHub.Tizen/Views/GalleryGridItem.xaml.cs b/TVMediaHub/TVMediaHub.Tizen/Views/GalleryGridItem.xaml.cs
deleted file mode 100644 (file)
index 8954bb7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Input;
-using Xamarin.Forms;
-using Xamarin.Forms.Xaml;
-
-namespace TVMediaHub.Tizen.Views
-{
-    [XamlCompilation(XamlCompilationOptions.Compile)]
-    public partial class GalleryGridItem : StackLayout
-    {
-
-
-        public static readonly BindableProperty CommandProperty =
-           BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(GalleryGridItem), null, BindingMode.TwoWay);
-
-        public ICommand Command
-        {
-            get { return (ICommand)GetValue(CommandProperty); }
-            set { SetValue(CommandProperty, value); }
-        }
-        public String CommandParameter
-        {
-            get;
-            set;
-        }
-
-        public GalleryGridItem()
-        {
-            InitializeComponent();
-        }
-
-        void OnItemTapped(object sender, EventArgs args)
-        {
-            Command?.Execute(CommandParameter);
-        }
-
-    }
-}
index 6673c4b..95b216a 100644 (file)
@@ -1,20 +1,41 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <StackLayout xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-             x:Class="TVMediaHub.Tizen.Views.GalleryImageContent">
-    <StackLayout.Resources>
-        <ResourceDictionary>
+             x:Class="TVMediaHub.Tizen.Views.GalleryImageContent"
+             xmlns:Utils="clr-namespace:TVMediaHub.Tizen.Utils"
+             IsDeleteMode="{Binding IsDeleteMode}">
 
-        </ResourceDictionary>
-    </StackLayout.Resources>
-    <Grid WidthRequest="180" HeightRequest="180">
-        <Image x:Name="imgFocused" Grid.Row="0" Grid.Column="0" Source="ic_tizen_media_thumbnail_gradient_focused.9.png" IsVisible="False" />
+    <Grid x:Name="ImgContent" WidthRequest="180" HeightRequest="180">
+        <Image x:Name="imgFocused"
+               Grid.Row="0" Grid.Column="0"
+               Source="ic_tizen_media_thumbnail_gradient_focused.9.png"
+               IsVisible="False" />
         <Image x:Name="ContentImage"
                Grid.Row="0" Grid.Column="0"
                Source=""/>
-        <Label x:Name="duration" Grid.Row="0" Grid.Column="0" Text="06:28" HorizontalTextAlignment="End" VerticalTextAlignment="End"/>
-        <Image x:Name="imgPlay" Grid.Row="0" Grid.Column="0" Source="btn_tizen_list_thumbnail_play.png" IsVisible="False" />
-        <Image x:Name="imgDimmed" Grid.Row="0" Grid.Column="0" Source="img_tizen_dimmed_opacity85.9.png" IsVisible="False" />
-        <Image x:Name="imgCheck" Grid.Row="0" Grid.Column="0" Source="ic_tizen_apps_launcher_pinmark.png" IsVisible="False" />
+        <Label x:Name="duration"
+               Grid.Row="0" Grid.Column="0"
+               Text="06:28"
+               VerticalOptions="End"
+               HorizontalOptions="End"/>
+        <Image x:Name="ImgPlay"
+               Grid.Row="0" Grid.Column="0"
+               Source="btn_tizen_list_thumbnail_play.png"
+               IsVisible="False" />
+        <Utils:NinePatch x:Name="ImgDimmed"
+                         Grid.Row="0" Grid.Column="0"
+                         Source="img_tizen_dimmed_opacity85.9.png"
+                         BorderLeft="10"
+                         BorderTop="10"
+                         BorderRight="10"
+                         BorderBottom="10"
+                         IsVisible="False" />
+        <Image x:Name="ImgCheck"
+               Grid.Row="0" Grid.Column="0"
+               Source="ic_tizen_apps_launcher_pinmark.png"
+               IsVisible="False" />
+        <Button Grid.Row="0" Grid.Column="0"
+                Opacity="0"
+                Clicked="OnItemClicked"/>
     </Grid>
 </StackLayout>
\ No newline at end of file
index 3806c19..ebca6fd 100644 (file)
@@ -1,9 +1,7 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
 
@@ -12,14 +10,91 @@ namespace TVMediaHub.Tizen.Views
     [XamlCompilation(XamlCompilationOptions.Compile)]
     public partial class GalleryImageContent : StackLayout
     {
+        public static readonly BindableProperty IsDeleteModeProperty = BindableProperty.Create("IsDeleteMode", typeof(bool), typeof(GalleryImageContent), false);
+        static int NORMAL = 0;
+        static int SELECTED = 1;
+
+
         List<Color> colorSet = new List<Color>{Color.Aqua, Color.Blue, Color.DeepSkyBlue, Color.Green, Color.IndianRed, Color.MediumVioletRed, Color.MediumTurquoise,
         Color.MintCream, Color.Plum, Color.Tan};
+
+        int CurStatus;
+
+
+        public bool IsDeleteMode
+        {
+            set
+            {
+                SetValue(IsDeleteModeProperty, value);
+            }
+            get
+            {
+                return (bool)GetValue(IsDeleteModeProperty);
+            }
+        }
+
         public GalleryImageContent()
         {
             InitializeComponent();
 
             Random r = new Random();
             ContentImage.BackgroundColor =colorSet.ElementAt(r.Next(10));
+
+            PropertyChanged += ImageTabPropertyChanged;
+        }
+
+
+
+        void OnItemClicked()
+        {
+            if (IsDeleteMode)
+            {
+                if (CurStatus == 0)
+                {
+                    CurStatus = SELECTED;
+                }
+                else
+                {
+                    CurStatus = NORMAL;
+                }
+
+                UpdateView();
+            } else
+            {
+                // play content
+            }
+        }
+
+        void UpdateView()
+        {
+            switch (CurStatus)
+            {
+                case 0:
+                    ImgContent.WidthRequest = 180;
+                    ImgContent.HeightRequest = 180;
+                    ImgDimmed.IsVisible = false;
+                    ImgCheck.IsVisible = false;
+                    break;
+                case 1:
+                    ImgContent.WidthRequest = 180;
+                    ImgContent.HeightRequest = 180;
+                    ImgDimmed.IsVisible = true;
+                    ImgCheck.IsVisible = true;
+                    break;
+            }
+        }
+
+
+        private void ImageTabPropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            if(e.PropertyName.CompareTo("IsDeleteMode") == 0)
+            {
+                if (!IsDeleteMode)
+                {
+                    CurStatus = NORMAL;
+                    UpdateView();
+                }
+            }
         }
     }
 }
index 1e01bca..31429c9 100644 (file)
@@ -3,27 +3,24 @@
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 x:Class="TVMediaHub.Tizen.Views.ImageTab"
                 xmlns:Views="clr-namespace:TVMediaHub.Tizen.Views"
+                xmlns:ViewModels="clr-namespace:TVMediaHub.Tizen.ViewModels"
                 RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
                 RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}">
-    <ScrollView RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.855}"
+    <RelativeLayout.BindingContext>
+        <ViewModels:ImageTabViewModel/>
+    </RelativeLayout.BindingContext>
+    <ScrollView x:Name="ImageTabScrollView"
+                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.855}"
                 RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                 Orientation="Horizontal">
-        <StackLayout Orientation="Horizontal">
-            <Views:GalleryGridItem HeightRequest="500" WidthRequest="500" Command="{Binding OnSeleteModeCommand}"/>
-            <BoxView BackgroundColor="Aqua" HeightRequest="500" WidthRequest="500"/>
-            <BoxView BackgroundColor="Bisque" HeightRequest="500" WidthRequest="500"/>
-            <BoxView BackgroundColor="SaddleBrown" HeightRequest="500" WidthRequest="500"/>
-            <BoxView BackgroundColor="Coral" HeightRequest="500" WidthRequest="500"/>
-            <BoxView BackgroundColor="GreenYellow" HeightRequest="500" WidthRequest="500"/>
-            <BoxView BackgroundColor="SteelBlue" HeightRequest="500" WidthRequest="500"/>
+        <StackLayout x:Name="GalleryContentView" Orientation="Horizontal">
         </StackLayout>
     </ScrollView>
-    <!-- TODO : Remove Label -->
-    <Label Text="Image Tab"></Label>
 
     <!-- TODO : Add Footer -->
     <RelativeLayout RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.145}"
                     RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                     RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.855}">
+        <Button x:Name="TestButton" Text="TestDeleteMode" Clicked="OnTestButtonClick" Command="{Binding DeleteModeChangeCommand}"/>
     </RelativeLayout>
 </RelativeLayout>
\ No newline at end of file
index e81e3f4..f9a866e 100644 (file)
  * limitations under the License.
  */
 
+using System;
 using Xamarin.Forms;
 
 namespace TVMediaHub.Tizen.Views
 {
     public partial class ImageTab : RelativeLayout
     {
+        bool IsDeleteMode;
+
         public ImageTab()
         {
             InitializeComponent();
+            InitializeSize();
+            AddGroup();
+        }
+
+        void InitializeSize()
+        {
+            ImageTabScrollView.Margin = new Thickness(Utils.SizeUtils.GetWidthSize(96), Utils.SizeUtils.GetHeightSize(74), 0, Utils.SizeUtils.GetHeightSize(84));
+        }
+
+        void AddGroup()
+        {
+            int groupSize = 3;
+            Gallery3ColumnGroupView galleryGroup;
+
+            for (int i = 0; i < groupSize; i++)
+            {
+                galleryGroup = new Gallery3ColumnGroupView();
+                // set GroupView data
+                GalleryContentView.Children.Add(galleryGroup);
+            }
         }
+
+        void GetImageData()
+        {
+
+        }
+
+        void OnTestButtonClick(object sender, EventArgs e)
+        {
+            IsDeleteMode = !IsDeleteMode;
+            if (IsDeleteMode)
+            {
+                TestButton.Text = "TestButton ON";
+            }
+            else
+            {
+                TestButton.Text = "TestButton OFF";
+            }
+        }
+
     }
 }
index 083abe8..0ecbc68 100644 (file)
@@ -9,7 +9,6 @@
                 RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                 Orientation="Horizontal">
         <StackLayout Orientation="Horizontal">
-            <Views:GalleryGridItem HeightRequest="500" WidthRequest="500" Command="{Binding OnSeleteModeCommand}"/>
             <BoxView BackgroundColor="Aqua" HeightRequest="500" WidthRequest="500"/>
             <BoxView BackgroundColor="Bisque" HeightRequest="500" WidthRequest="500"/>
             <BoxView BackgroundColor="SaddleBrown" HeightRequest="500" WidthRequest="500"/>