/// </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
}
}
- /// <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>
}
});
+ SortOptionIndexCommand = new Command<int>((sortingOption) =>
+ {
+ appsHolder.SortApps((SortingOptions)Enum.ToObject(typeof(SortingOptions), sortingOption));
+ });
+
DeletePopupCommand = new Command<Dictionary<string, string>>(async (arg) =>
{
string answer;
appsHolder = new AppsHolder(this);
// TODO : set default value as RecentlyInstalled
- SortingOption = SortingOptions.Ascending;
+ appsHolder.SortingOption = SortingOptions.Ascending;
ChangeCurrentStatus(AppsStatus.Default);
}
<?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
* limitations under the License.
*/
+using LibTVRefCommonPortable.Utils;
+using TVApps.Controls;
using Xamarin.Forms;
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)));
}
}
}
<?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
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>
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)
<?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
* limitations under the License.
*/
+using LibTVRefCommonPortable.Utils;
+using TVApps.Controls;
using Xamarin.Forms;
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>
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";
+ }
}
}
}
<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"