From 91b8ede39d1808850fe3d601652ab5d08a8f5c6e Mon Sep 17 00:00:00 2001 From: "Geunsun, Lee" Date: Mon, 17 Apr 2017 18:29:28 +0900 Subject: [PATCH] Modify Apps footer GUI Change-Id: Id8d4d746ce0285d6544184b5c4f951675bed0f1f --- TVApps/TVApps/ViewModels/MainPageViewModel.cs | 49 +++------------- TVApps/TVApps/Views/FooterDeleteStatus.xaml | 19 +------ .../TVApps/Views/FooterDeleteStatus.xaml.cs | 18 +++++- TVApps/TVApps/Views/FooterNormalStatus.xaml | 35 ++---------- .../TVApps/Views/FooterNormalStatus.xaml.cs | 54 +++++++++++++++++- TVApps/TVApps/Views/FooterPinStatus.xaml | 34 +---------- TVApps/TVApps/Views/FooterPinStatus.xaml.cs | 56 ++++++++++++++++++- TVApps/TVApps/Views/MainPage.xaml | 27 +++++---- 8 files changed, 155 insertions(+), 137 deletions(-) diff --git a/TVApps/TVApps/ViewModels/MainPageViewModel.cs b/TVApps/TVApps/ViewModels/MainPageViewModel.cs index 504b37b..21b6b4d 100644 --- a/TVApps/TVApps/ViewModels/MainPageViewModel.cs +++ b/TVApps/TVApps/ViewModels/MainPageViewModel.cs @@ -132,22 +132,7 @@ namespace TVApps.ViewModels /// public Command DeletePopupCommand { get; set; } - /// - /// Gets and Sets current sorting option of AppsHolder - /// - /// - private SortingOptions SortingOption - { - get - { - return appsHolder.SortingOption; - } - - set - { - appsHolder.SortingOption = value; - } - } + public Command SortOptionIndexCommand { get; set; } /// /// Title text font size @@ -191,31 +176,6 @@ namespace TVApps.ViewModels } } - /// - /// Gets and Sets current sorting option index - /// If change SortingOption index, AppsHolder sorts list - /// - 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); - } - } - } - } - /// /// Gets or Sets ShortcutInfo of Focused AppItemCell /// @@ -281,6 +241,11 @@ namespace TVApps.ViewModels } }); + SortOptionIndexCommand = new Command((sortingOption) => + { + appsHolder.SortApps((SortingOptions)Enum.ToObject(typeof(SortingOptions), sortingOption)); + }); + DeletePopupCommand = new Command>(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); } diff --git a/TVApps/TVApps/Views/FooterDeleteStatus.xaml b/TVApps/TVApps/Views/FooterDeleteStatus.xaml index a2ce87b..977ee0d 100644 --- a/TVApps/TVApps/Views/FooterDeleteStatus.xaml +++ b/TVApps/TVApps/Views/FooterDeleteStatus.xaml @@ -1,22 +1,7 @@  - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/TVApps/TVApps/Views/FooterDeleteStatus.xaml.cs b/TVApps/TVApps/Views/FooterDeleteStatus.xaml.cs index 8631d95..0c6926f 100644 --- a/TVApps/TVApps/Views/FooterDeleteStatus.xaml.cs +++ b/TVApps/TVApps/Views/FooterDeleteStatus.xaml.cs @@ -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 /// /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Delete /// - public partial class FooterDeleteStatus : Grid + public partial class FooterDeleteStatus : RelativeLayout { + private TVButton CancelButton; /// /// A constructor /// 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))); } } } diff --git a/TVApps/TVApps/Views/FooterNormalStatus.xaml b/TVApps/TVApps/Views/FooterNormalStatus.xaml index 5ef0dd3..849808c 100644 --- a/TVApps/TVApps/Views/FooterNormalStatus.xaml +++ b/TVApps/TVApps/Views/FooterNormalStatus.xaml @@ -1,37 +1,10 @@  - + DeleteAppCommand="{Binding ButtonDeleteAppCommand}" + SortOptionIndexCommand="{Binding SortOptionIndexCommand}"> - - - - - - - - - - - - - - - - Recently Installed - Recently Used - A - Z - Z - A - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs b/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs index ec7e207..7b67ddb 100644 --- a/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs +++ b/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs @@ -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 { /// /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Default /// - public partial class FooterNormalStatus : Grid + public partial class FooterNormalStatus : RelativeLayout { private bool isPopupShowing = false; + private DropdownList SortButton; + private TVButton OptionButton; + /// /// A command will be executed if the Pin option is selected /// @@ -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); } + } + /// /// A constructor /// 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 SortList = new List { "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) diff --git a/TVApps/TVApps/Views/FooterPinStatus.xaml b/TVApps/TVApps/Views/FooterPinStatus.xaml index 1807d51..85f3acd 100644 --- a/TVApps/TVApps/Views/FooterPinStatus.xaml +++ b/TVApps/TVApps/Views/FooterPinStatus.xaml @@ -1,37 +1,7 @@  - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/TVApps/TVApps/Views/FooterPinStatus.xaml.cs b/TVApps/TVApps/Views/FooterPinStatus.xaml.cs index e22237d..bd42dfe 100644 --- a/TVApps/TVApps/Views/FooterPinStatus.xaml.cs +++ b/TVApps/TVApps/Views/FooterPinStatus.xaml.cs @@ -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 /// /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Pin /// - public partial class FooterPinStatus : Grid + public partial class FooterPinStatus : RelativeLayout { + private TVButton DoneButton; + private Label SumOfCheckedAppLabel; + /// /// Identifies the SumOfCheckedApp bindable property /// @@ -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"; + } } } } diff --git a/TVApps/TVApps/Views/MainPage.xaml b/TVApps/TVApps/Views/MainPage.xaml index e269304..4887e6f 100755 --- a/TVApps/TVApps/Views/MainPage.xaml +++ b/TVApps/TVApps/Views/MainPage.xaml @@ -38,6 +38,21 @@ 0 0 + + + + + +