<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- x:Class="TVApps.Controls.AppItemCell">
- <RelativeLayout BackgroundColor="#000000">
- <BoxView x:Name="ButtonBox"
- WidthRequest="240"
- HeightRequest="266"
- Opacity="0"/>
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="TVApps.Controls.AppItemCell">
+ <RelativeLayout BackgroundColor="#000000"
+ HeightRequest="266"
+ WidthRequest="240">
<Image x:Name="ButtonImage"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.6165}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.6833}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.0977}"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.1583}"
- Source="{Binding CurrentStateDescription.IconPath}" />
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6833}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6833}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1583}"
+ Source="{Binding CurrentStateDescription.IconPath}" />
<Image x:Name="DimImage"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.6165}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.6833}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.0977}"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.1583}"
- Source="img_tizen_apps_list_dimmed_check.png"
- IsVisible="{Binding IsChecked}"/>
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6833}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6833}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1583}"
+ Source="img_tizen_apps_list_dimmed_check.png"
+ Opacity="0"
+ Scale="0" />
<Image x:Name="CheckImage"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.6165}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.6833}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.0977}"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.1583}"
- Source="ic_tizen_apps_launcher_pinmark.png"
- IsVisible="{Binding IsChecked}" />
- <Label x:Name="ButtonTitle"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.78195}"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.1167}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.7667}"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.1203}"
- Opacity="1"
- FontSize="58"
- TextColor="White"
- LineBreakMode="TailTruncation"
- HorizontalTextAlignment="Center"
- Text="{Binding CurrentStateDescription.Label}" />
- <Image x:Name="PinnedIcon"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.1}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.1}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonTitle, Property=Y, Factor=1}"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonTitle, Property=X, Factor=1}"
- Source="ic_tizen_apps_launcher_checkmark.png"
- IsVisible="{Binding IsPinned}"/>
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.4}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.4}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.2417}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.3}"
+ Source="ic_tizen_apps_launcher_pinmark.png"
+ Opacity="0" />
+ <Grid x:Name="TextArea"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1333}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.7744}">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="6*" />
+ <RowDefinition Height="18*" />
+ <RowDefinition Height="8*" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="18" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="18" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowSpacing>0</Grid.RowSpacing>
+ <Grid.ColumnSpacing>10</Grid.ColumnSpacing>
+ <Image x:Name="PinnedIcon"
+ Grid.Row="1"
+ Grid.Column="1"
+ Source="ic_tizen_apps_launcher_checkmark.png"
+ Opacity="0"/>
+ <Label x:Name="ButtonTitle"
+ Grid.Row="0"
+ Grid.RowSpan="3"
+ Grid.Column="2"
+ Opacity="1"
+ FontSize="56"
+ TextColor="White"
+ LineBreakMode="TailTruncation"
+ HorizontalTextAlignment="Center"
+ Text="{Binding CurrentStateDescription.Label}" />
+ <BoxView Grid.Row="1"
+ Grid.Column="3"
+ Opacity="0" />
+ </Grid>
<Button x:Name = "ButtonFocusArea"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
Focused="OnFocused"
Unfocused="OnUnFocused"
Clicked="OnClicked"
Opacity="0" />
</RelativeLayout>
</ViewCell>
+
* limitations under the License.
*/
+using LibTVRefCommmonPortable.DataModels;
+using LibTVRefCommmonPortable.Utils;
using System;
using System.ComponentModel;
using System.Windows.Input;
set { SetValue(OnClickedCommandProperty, value); }
}
+ public static readonly BindableProperty IsPinnedProperty = BindableProperty.Create("IsPinned", typeof(bool), typeof(AppItemCell), default(bool));
+ public bool IsPinned
+ {
+ get { return (bool)GetValue(IsPinnedProperty); }
+ set { SetValue(IsPinnedProperty, value); }
+ }
+
+ public static readonly BindableProperty IsCheckedProperty = BindableProperty.Create("IsChecked", typeof(bool), typeof(AppItemCell), default(bool));
+ public bool IsChecked
+ {
+ get { return (bool)GetValue(IsCheckedProperty); }
+ set { SetValue(IsCheckedProperty, value); }
+ }
+
public AppItemCell()
{
InitializeComponent();
+ PropertyChanged += AppItemCell_PropertyChanged;
+ ButtonTitle.PropertyChanged += ButtonTitle_PropertyChanged;
+ }
+
+ private void AppItemCell_PropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ DebuggingUtils.Dbg(e.PropertyName);
+ if (e.PropertyName.CompareTo("IsPinned") == 0)
+ {
+ if (IsPinned)
+ {
+ PinnedIcon.FadeTo(0.99, 300);
+ }
+ else
+ {
+ PinnedIcon.FadeTo(0.0, 300);
+ }
+ return;
+ }
+ if (e.PropertyName.CompareTo("IsChecked") == 0)
+ {
+ if (IsChecked)
+ {
+ CheckImage.FadeTo(0.99, 300);
+ DimImage.FadeTo(0.99, 300);
+ DimImage.TranslateTo(0.0, 2.0, 300);
+ DimImage.ScaleTo(1.32, 300);
+ }
+ else
+ {
+ // TODO : Change Animation (Add Pin Contents Item : Unselected)
+ CheckImage.FadeTo(0.0, 300);
+ DimImage.FadeTo(0.0, 300);
+ DimImage.TranslateTo(0.0, 0.0, 300);
+ DimImage.ScaleTo(0.0, 300);
+ }
+ return;
+ }
+ }
+
+ private void ButtonTitle_PropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == "Width")
+ {
+ TextArea.ForceLayout();
+ }
}
private void OnClicked(object sender, EventArgs e)
private void OnFocused(object sender, EventArgs e)
{
ButtonImage.ScaleTo(1.32, 300);
- ButtonTitle.TranslateTo(0, 26, 300);
+ ButtonImage.TranslateTo(0.0, 2.0, 300);
+ TextArea.TranslateTo(0.0, 26.0, 300);
+
+ if (IsChecked)
+ {
+ DimImage.ScaleTo(1.32, 300);
+ DimImage.TranslateTo(0.0, 2.0, 300);
+ CheckImage.TranslateTo(0.0, 2.0, 300);
+ }
}
private void OnUnFocused(object sender, EventArgs e)
{
ButtonImage.ScaleTo(1.0, 300);
- ButtonTitle.TranslateTo(0, 0, 300);
+ ButtonImage.TranslateTo(0.0, 0.0, 300);
+ TextArea.TranslateTo(0.0, 0.0, 300);
+
+ if (IsChecked)
+ {
+ DimImage.ScaleTo(1.0, 300);
+ DimImage.TranslateTo(0.0, 0.0, 300);
+ CheckImage.TranslateTo(0.0, 0.0, 300);
+ }
}
}
}