Modify Apps footer GUI
authorGeunsun, Lee <gs86.lee@samsung.com>
Mon, 17 Apr 2017 09:29:28 +0000 (18:29 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:53 +0000 (18:34 +0900)
Change-Id: Id8d4d746ce0285d6544184b5c4f951675bed0f1f

TVApps/TVApps/ViewModels/MainPageViewModel.cs
TVApps/TVApps/Views/FooterDeleteStatus.xaml
TVApps/TVApps/Views/FooterDeleteStatus.xaml.cs
TVApps/TVApps/Views/FooterNormalStatus.xaml
TVApps/TVApps/Views/FooterNormalStatus.xaml.cs
TVApps/TVApps/Views/FooterPinStatus.xaml
TVApps/TVApps/Views/FooterPinStatus.xaml.cs
TVApps/TVApps/Views/MainPage.xaml

index 504b37be810e3f8c63a8f10a8fc7583fc8300fd7..21b6b4dbc2107c0ccc2265021ab13fd732c09b54 100644 (file)
@@ -132,22 +132,7 @@ namespace TVApps.ViewModels
         /// </summary>
         public Command DeletePopupCommand { get; set; }
 
-        /// <summary>
-        /// Gets and Sets current sorting option of AppsHolder
-        /// </summary>
-        /// <see cref="AppsHolder"/>
-        private SortingOptions SortingOption
-        {
-            get
-            {
-                return appsHolder.SortingOption;
-            }
-
-            set
-            {
-                appsHolder.SortingOption = value;
-            }
-        }
+        public Command<int> SortOptionIndexCommand { get; set; }
 
         /// <summary>
         /// Title text font size
@@ -191,31 +176,6 @@ namespace TVApps.ViewModels
             }
         }
 
-        /// <summary>
-        /// Gets and Sets current sorting option index
-        /// If change SortingOption index, AppsHolder sorts list
-        /// </summary>
-        public int SortOptionIndex
-        {
-            get
-            {
-                return Convert.ToInt32(SortingOption);
-            }
-
-            set
-            {
-                SortingOptions newSortingOption = (SortingOptions)Enum.ToObject(typeof(SortingOptions), value);
-                if (newSortingOption != SortingOption)
-                {
-                    SortingOption = newSortingOption;
-                    if (InstalledAppList != null)
-                    {
-                        appsHolder.SortApps(SortingOption);
-                    }
-                }
-            }
-        }
-
         /// <summary>
         /// Gets or Sets ShortcutInfo of Focused AppItemCell
         /// </summary>
@@ -281,6 +241,11 @@ namespace TVApps.ViewModels
                 }
             });
 
+            SortOptionIndexCommand = new Command<int>((sortingOption) =>
+            {
+                appsHolder.SortApps((SortingOptions)Enum.ToObject(typeof(SortingOptions), sortingOption));
+            });
+
             DeletePopupCommand = new Command<Dictionary<string, string>>(async (arg) =>
             {
                 string answer;
@@ -378,7 +343,7 @@ namespace TVApps.ViewModels
             appsHolder = new AppsHolder(this);
 
             // TODO : set default value as RecentlyInstalled
-            SortingOption = SortingOptions.Ascending;
+            appsHolder.SortingOption = SortingOptions.Ascending;
             ChangeCurrentStatus(AppsStatus.Default);
         }
 
index a2ce87bb5a01f9a4cf9d33a472f56217d67f0268..977ee0d4afa46153913ca0e28cefdc690a4c2c72 100644 (file)
@@ -1,22 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Grid xmlns="http://xamarin.com/schemas/2014/forms"
+<RelativeLayout xmlns="http://xamarin.com/schemas/2014/forms"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:Control="clr-namespace:TVApps.Controls"
       x:Class="TVApps.Views.FooterDeleteStatus">
 
-  <Grid.RowDefinitions>
-    <RowDefinition Height="625*" />
-    <RowDefinition Height="375*" />
-  </Grid.RowDefinitions>
-
-  <Grid.ColumnDefinitions>
-    <ColumnDefinition Width="6385*" />
-    <ColumnDefinition Width="3115*" />
-    <ColumnDefinition Width="500*" />
-  </Grid.ColumnDefinitions>
-
-  <Control:TVButton Grid.Row="0" Grid.Column="1"
-                    Text="CANCEL"
-                    HorizontalOptions="End"
-                    Command="{Binding ButtonDeleteCancelCommand}"/>
-</Grid>
\ No newline at end of file
+</RelativeLayout>
\ No newline at end of file
index 8631d95ef3934027f69edafe1049a127b4d35285..0c6926f21a37bd077a28b2c503ddadc1d5ca3b63 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+using LibTVRefCommonPortable.Utils;
+using TVApps.Controls;
 using Xamarin.Forms;
 
 namespace TVApps.Views
@@ -21,14 +23,28 @@ namespace TVApps.Views
     /// <summary>
     /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Delete
     /// </summary>
-    public partial class FooterDeleteStatus : Grid
+    public partial class FooterDeleteStatus : RelativeLayout
     {
+        private TVButton CancelButton;
         /// <summary>
         /// A constructor
         /// </summary>
         public FooterDeleteStatus()
         {
             InitializeComponent();
+
+            CancelButton = new TVButton()
+            {
+                Text = "CANCEL",
+            };
+
+            CancelButton.SetBinding(TVButton.CommandProperty, new Binding("ButtonDeleteCancelCommand"));
+
+            this.Children.Add(CancelButton,
+                heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(80)),
+                widthConstraint: Constraint.Constant(SizeUtils.GetWidthSize(300)),
+                yConstraint: Constraint.Constant(SizeUtils.GetHeightSize(762)),
+                xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(96 + 1130 + 300 + 2)));
         }
     }
 }
index 5ef0dd3c8935fce734d6d2d52807f784343dc639..849808ccd42e7c22873dd8c37cc724adab9665e0 100644 (file)
@@ -1,37 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Grid xmlns="http://xamarin.com/schemas/2014/forms"
+<RelativeLayout xmlns="http://xamarin.com/schemas/2014/forms"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:Control="clr-namespace:TVApps.Controls"
       x:Class="TVApps.Views.FooterNormalStatus"
       PinAppCommand="{Binding ButtonPinAppCommand}"
-      DeleteAppCommand="{Binding ButtonDeleteAppCommand}">
+      DeleteAppCommand="{Binding ButtonDeleteAppCommand}"
+      SortOptionIndexCommand="{Binding SortOptionIndexCommand}">
 
-  <Grid.RowDefinitions>
-    <RowDefinition Height="625*" />
-    <RowDefinition Height="375*" />
-  </Grid.RowDefinitions>
-
-  <Grid.ColumnDefinitions>
-    <ColumnDefinition Width="5385*" />
-    <ColumnDefinition Width="4115*" />
-    <ColumnDefinition Width="500*" />
-  </Grid.ColumnDefinitions>
-
-  <StackLayout Grid.Row="0" Grid.Column="1"
-               Orientation="Horizontal"
-               HorizontalOptions="End">
-
-    <Picker Title="SORT BY" SelectedIndex="{Binding SortOptionIndex}">
-      <Picker.Items>
-        <x:String>Recently Installed</x:String>
-        <x:String>Recently Used</x:String>
-        <x:String>A - Z</x:String>
-        <x:String>Z - A</x:String>
-      </Picker.Items>
-    </Picker>
-
-    <Control:TVButton Text="OPTION"
-            Clicked="OnOptionsClicked" />
-
-  </StackLayout>
-</Grid>
\ No newline at end of file
+</RelativeLayout>
\ No newline at end of file
index ec7e207336892265d6abbf5458d0f718fb3dca36..7b67ddb9babd35ab33fa170773c37d7aa1044bd9 100644 (file)
@@ -19,16 +19,21 @@ using Tizen.Xamarin.Forms.Extension;
 using LibTVRefCommonPortable.Utils;
 using System.Windows.Input;
 using System;
+using TVApps.Controls;
+using System.Collections.Generic;
 
 namespace TVApps.Views
 {
     /// <summary>
     /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Default
     /// </summary>
-    public partial class FooterNormalStatus : Grid
+    public partial class FooterNormalStatus : RelativeLayout
     {
         private bool isPopupShowing = false;
 
+        private DropdownList SortButton;
+        private TVButton OptionButton;
+
         /// <summary>
         /// A command will be executed if the Pin option is selected
         /// </summary>
@@ -49,12 +54,59 @@ namespace TVApps.Views
             set { SetValue(DeleteAppCommandProperty, value); }
         }
 
+        public static readonly BindableProperty SortOptionIndexCommandProperty = BindableProperty.Create("SortOptionIndexCommand", typeof(Command), typeof(FooterNormalStatus), null);
+        public ICommand SortOptionIndexCommand
+        {
+            get { return (ICommand)GetValue(SortOptionIndexCommandProperty); }
+            set { SetValue(SortOptionIndexCommandProperty, value); }
+        }
+
         /// <summary>
         /// A constructor
         /// </summary>
         public FooterNormalStatus()
         {
             InitializeComponent();
+
+            CreateSortButton();
+            CreateOptionButton();
+        }
+
+        private void CreateOptionButton()
+        {
+            OptionButton = new TVButton()
+            {
+                Text = "OPTION",
+            };
+            OptionButton.Clicked += OnOptionsClicked;
+
+            this.Children.Add(OptionButton,
+                heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(80)),
+                widthConstraint: Constraint.Constant(SizeUtils.GetWidthSize(300)),
+                yConstraint: Constraint.Constant(SizeUtils.GetHeightSize(762)),
+                xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(96 + 1130 + 300 + 2)));
+        }
+
+        private void CreateSortButton()
+        {
+            List<string> SortList = new List<string> { "Recentely Installed", "Recently Used", "A - Z", "Z - A" };
+
+            SortButton = new DropdownList();
+            SortButton.ItemsSource = SortList;
+
+            SortButton.ItemSelected += (s, e) =>
+            {
+                if (SortList.Contains(e.SelectedItem.ToString()))
+                {
+                    SortOptionIndexCommand?.Execute(SortList.IndexOf(e.SelectedItem.ToString()));
+                }
+            };
+
+            this.Children.Add(SortButton,
+                heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(80)),
+                widthConstraint: Constraint.Constant(SizeUtils.GetWidthSize(300)),
+                yConstraint: Constraint.Constant(SizeUtils.GetHeightSize(762)),
+                xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(96 + 1130)));
         }
 
         void OnOptionsClicked(object sender, EventArgs e)
index 1807d517960e1e9f6a66255536ce2ef6da7d21e0..85f3acda257080c6fa707468b0bae5d6591d4f90 100644 (file)
@@ -1,37 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Grid xmlns="http://xamarin.com/schemas/2014/forms"
+<RelativeLayout xmlns="http://xamarin.com/schemas/2014/forms"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:Control="clr-namespace:TVApps.Controls"
       x:Class="TVApps.Views.FooterPinStatus">
 
-  <Grid.RowDefinitions>
-    <RowDefinition Height="625*" />
-    <RowDefinition Height="375*" />
-  </Grid.RowDefinitions>
-
-  <Grid.ColumnDefinitions>
-    <ColumnDefinition Width="500*" />
-    <ColumnDefinition Width="5885*" />
-    <ColumnDefinition Width="3115*" />
-    <ColumnDefinition Width="500*" />
-  </Grid.ColumnDefinitions>
-
-  <StackLayout Grid.Row="0" Grid.Column="1"
-               Orientation="Horizontal">
-    <Label x:Name="FooterAdditionalText"
-           FontSize="{Binding RegularFontSize}"
-           TextColor="White"
-           FontAttributes="Bold"
-           Text="{Binding SumOfCheckedApp}" />
-    <Label FontSize="{Binding RegularFontSize}"
-           TextColor="White"
-           Text=" Pinned" />
-  </StackLayout>
-
-  <StackLayout Grid.Row="0" Grid.Column="2"
-               HorizontalOptions="End"
-               Orientation="Horizontal">
-    <Control:TVButton Text="DONE"
-                      Command="{Binding ButtonPinDoneCommand}"/>
-  </StackLayout>
-</Grid>
\ No newline at end of file
+</RelativeLayout>
\ No newline at end of file
index e22237dbc9d9618fb6037f5e5c86a840355cd358..bd42dfe67f71c66f3829f608aa00185c2a0aeed0 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+using LibTVRefCommonPortable.Utils;
+using TVApps.Controls;
 using Xamarin.Forms;
 
 namespace TVApps.Views
@@ -21,8 +23,11 @@ namespace TVApps.Views
     /// <summary>
     /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Pin
     /// </summary>
-    public partial class FooterPinStatus : Grid
+    public partial class FooterPinStatus : RelativeLayout
     {
+        private TVButton DoneButton;
+        private Label SumOfCheckedAppLabel;
+
         /// <summary>
         /// Identifies the SumOfCheckedApp bindable property
         /// </summary>
@@ -43,6 +48,55 @@ namespace TVApps.Views
         public FooterPinStatus()
         {
             InitializeComponent();
+
+            CreateDoneButton();
+            CreateFooterAdditionalText();
+        }
+
+        private void CreateFooterAdditionalText()
+        {
+            SetBinding(FooterPinStatus.SumOfCheckedAppProperty, new Binding("SumOfCheckedApp"));
+
+            SumOfCheckedAppLabel = new Label()
+            {
+                Text = SumOfCheckedApp + " Pinned",
+                WidthRequest = SizeUtils.GetWidthSize(600),
+                HeightRequest = SizeUtils.GetHeightSize(32),
+                FontSize = SizeUtils.GetFontSize(28),
+                TextColor = Color.White,
+            };
+
+            this.Children.Add(SumOfCheckedAppLabel,
+                heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(32)),
+                widthConstraint: Constraint.Constant(SizeUtils.GetWidthSize(600)),
+                yConstraint: Constraint.Constant(SizeUtils.GetHeightSize(762)),
+                xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(96)));
+
+            PropertyChanged += FooterPinStatusPropertyChanged;
+        }
+
+        private void CreateDoneButton()
+        {
+            DoneButton = new TVButton()
+            {
+                Text = "DONE",
+            };
+
+            DoneButton.SetBinding(TVButton.CommandProperty, new Binding("ButtonPinDoneCommand"));
+
+            this.Children.Add(DoneButton,
+                heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(80)),
+                widthConstraint: Constraint.Constant(SizeUtils.GetWidthSize(300)),
+                yConstraint: Constraint.Constant(SizeUtils.GetHeightSize(762)),
+                xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(96 + 1130 + 300 + 2)));
+        }
+
+        private void FooterPinStatusPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName.Equals("SumOfCheckedApp"))
+            {
+                SumOfCheckedAppLabel.Text = SumOfCheckedApp + " Pinned";
+            }
         }
     }
 }
index e26930409066d4c491731865bc1269bf69f8cfbc..4887e6fee317a28c8cb2ff2b29b3d2b1924763c4 100755 (executable)
     <Grid.RowSpacing>0</Grid.RowSpacing>
     <Grid.ColumnSpacing>0</Grid.ColumnSpacing>
 
+    <Views:FooterNormalStatus Grid.Row="1"
+                              Grid.RowSpan="3"
+                              x:Name="FooterNormal"
+                              IsVisible="true" />
+
+    <Views:FooterPinStatus Grid.Row="1"
+                           Grid.RowSpan="3"
+                           x:Name="FooterPin"
+                           IsVisible="false" />
+
+    <Views:FooterDeleteStatus Grid.Row="1"
+                              Grid.RowSpan="3"
+                              x:Name="FooterDelete"
+                              IsVisible="false" />
+
     <Label Grid.Row="0"
            Style="{StaticResource titleText}"
            HorizontalTextAlignment="Center"
       </Controls:AppListView.ItemTemplate>
     </Controls:AppListView>
 
-    <Views:FooterNormalStatus Grid.Row="3"
-                                x:Name="FooterNormal"
-                                IsVisible="true" />
-
-    <Views:FooterPinStatus Grid.Row="3"
-                             x:Name="FooterPin"
-                             IsVisible="false" />
-
-    <Views:FooterDeleteStatus Grid.Row="3"
-                               x:Name="FooterDelete"
-                               IsVisible="false" />
-
     <BoxView x:Name="PageDimBox"
              Color="Black"
              Grid.Row="0"