[XmlIgnore]
public Command OptionMenuDeleteCommand { get; set; }
+ [XmlIgnore]
+ public Command ToDefaultCommand { get; set; }
+
/// <summary>
/// A Constructor.
/// Initializes AppShortcutInfo.
{
MessagingCenter.Send<AppShortcutInfo, string>(this, "OptionMenuDelete", AppID);
});
+
+ ToDefaultCommand = new Command(() =>
+ {
+ MessagingCenter.Send<AppShortcutInfo>(this, "ChangeToDefaultMode");
+ });
}
/// <summary>
Unfocused="OnUnFocused"
Clicked="OnClicked"
Opacity="0" />
-
- <Grid x:Name="OptionMenuArea"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.4235}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.8666}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.0667}">
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <Grid.RowSpacing>0</Grid.RowSpacing>
- <Button x:Name="OptionMenuPinToggleButton"
- Grid.Row="0"
- Command="{Binding OptionMenuPinToggleCommand}"
- IsEnabled="false"
- Text="UNPIN" />
- <Button x:Name="OptionMenuDeleteButton"
- Grid.Row="1"
- Command="{Binding OptionMenuDeleteCommand}"
- IsEnabled="false"
- Text="DELETE" />
- </Grid>
-
</RelativeLayout>
</ViewCell>
using System.Windows.Input;
using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
+using Tizen.Xamarin.Forms.Extension;
namespace TVApps.Controls
{
set { SetValue(IsFocusedProperty, value); }
}
+ public static readonly BindableProperty PinCommandProperty = BindableProperty.Create("PinCommand", typeof(ICommand), typeof(AppItemCell));
+
+ public ICommand PinCommand
+ {
+ get { return (ICommand)GetValue(PinCommandProperty); }
+ set { SetValue(PinCommandProperty, value); }
+ }
+
+ public static readonly BindableProperty DeleteCommandProperty = BindableProperty.Create("DeleteCommand", typeof(ICommand), typeof(AppItemCell));
+
+ public ICommand DeleteCommand
+ {
+ get { return (ICommand)GetValue(DeleteCommandProperty); }
+ set { SetValue(DeleteCommandProperty, value); }
+ }
+
+ public static readonly BindableProperty ToDefaultCommandProperty = BindableProperty.Create("ToDefaultCommand", typeof(ICommand), typeof(AppItemCell));
+
+ public ICommand ToDefaultCommand
+ {
+ get { return (ICommand)GetValue(ToDefaultCommandProperty); }
+ set { SetValue(ToDefaultCommandProperty, value); }
+ }
+
/// <summary>
/// 2 px height size
/// </summary>
/// </summary>
private int height144 = SizeUtils.GetHeightSize(144);
+ private bool isPopupShowing = false;
+
/// <summary>
/// A constructor
/// Adds PropertyChanged event handler
ButtonTitle.FontSize = SizeUtils.GetFontSize(25);
ButtonTitle.PropertyChanged += ButtonTitlePropertyChanged;
- OptionMenuPinToggleButton.Text = IsPinned ? "UNPIN" : "PIN";
PropertyChanged += AppItemCellPropertyChanged;
}
if (e.PropertyName.CompareTo("IsPinned") == 0)
{
PinnedIcon.FadeTo((IsPinned) ? 0.99 : 0.0, 300);
- OptionMenuPinToggleButton.Text = (IsPinned) ? "UNPIN" : "PIN";
return;
}
ButtonImage.TranslateTo(0, (isShow) ? -height90 : 0, 334);
TextArea.TranslateTo(0, (isShow) ? -height19 : height19, 167);
TextArea.FadeTo((isShow) ? 0.0 : 0.99, 100);
- OptionMenuArea.TranslateTo(0, (isShow) ? -height144 : 0, 334);
- OptionMenuPinToggleButton.IsEnabled = (isShow) ? true : false;
- OptionMenuDeleteButton.IsEnabled = (isShow) ? true : false;
+
+ if (isShow)
+ {
+ ShowContextPopup();
+ }
+ }
+
+ private void ShowContextPopup()
+ {
+ if (isPopupShowing)
+ {
+ return;
+ }
+
+ ContextPopup popup = new ContextPopup
+ {
+ IsAutoHidingEnabled = true,
+ Orientation = ContextPopupOrientation.Vertical,
+ DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Down, ContextPopupDirection.Right, ContextPopupDirection.Left, ContextPopupDirection.Up),
+ };
+
+ if (IsPinned)
+ {
+ popup.Items.Add(new ContextPopupItem("UNPIN"));
+ }
+ else
+ {
+ popup.Items.Add(new ContextPopupItem("PIN"));
+ }
+
+ popup.Items.Add(new ContextPopupItem("DELETE"));
+
+ //TODO: need to change the event callback
+ popup.SelectedIndexChanged += (s, args) =>
+ {
+ var ctxPopup = s as ContextPopup;
+
+ DebuggingUtils.Dbg("selected item : " + (ctxPopup.SelectedItem as ContextPopupItem).Label + " (" + ctxPopup.SelectedIndex + ")");
+ switch (ctxPopup.SelectedIndex)
+ {
+ case 0:
+ //PIN
+ PinCommand?.Execute("");
+ break;
+ case 1:
+ //DELETE
+ DeleteCommand?.Execute("");
+ break;
+ default:
+ break;
+ }
+
+ popup.Dismiss();
+ };
+
+ popup.Dismissed += (s, args) =>
+ {
+ var ctxPopup = s as ContextPopup;
+
+ if (ctxPopup.SelectedIndex != 0 || ctxPopup.SelectedIndex != 1)
+ {
+ ToDefaultCommand?.Execute("");
+ }
+
+ isPopupShowing = false;
+ ShowOptionMenu(false);
+ };
+
+ popup.Show(this.View, this.View.Width / 2, this.View.Height - height144);
+ isPopupShowing = true;
}
/// <summary>
viewCell.SetBinding(AppItemCell.IsShowOptionsProperty, new Binding("BindingContext.IsShowOptions", source: viewCell.View));
viewCell.SetBinding(AppItemCell.IsDimProperty, new Binding("BindingContext.IsDim", source: viewCell.View));
viewCell.SetBinding(AppItemCell.IsFocusedProperty, new Binding("BindingContext.IsFocused", mode: BindingMode.TwoWay, source: viewCell.View));
+ viewCell.SetBinding(AppItemCell.PinCommandProperty, new Binding("BindingContext.OptionMenuPinToggleCommand", source: viewCell.View));
+ viewCell.SetBinding(AppItemCell.DeleteCommandProperty, new Binding("BindingContext.OptionMenuDeleteCommand", source: viewCell.View));
+ viewCell.SetBinding(AppItemCell.ToDefaultCommandProperty, new Binding("BindingContext.ToDefaultCommand", source: viewCell.View));
viewCell.OnClickedCommand = new Command(() =>
{
item.DoAction();
ViewModel.ChangeCurrentStatus(AppsStatus.Default);
}
+ public void ChangeToDefaultStatus()
+ {
+ ViewModel.ChangeCurrentStatus(AppsStatus.Default);
+ }
+
/// <summary>
/// Removes the pinned app by app ID
/// </summary>
}
/// <summary>
- /// Additional info layout's spacing size
- /// </summary>
- public int AdditionalInfoSpacing
- {
- get
- {
- return SizeUtils.GetWidthSize(12);
- }
- }
-
- /// <summary>
/// Regular text font size
/// </summary>
int regularFontSize;
appsHolder.CheckDeleteApp(arg);
});
+ MessagingCenter.Subscribe<AppShortcutInfo>(this, "ChangeToDefaultMode", (sender) =>
+ {
+ appsHolder.ChangeToDefaultStatus();
+ });
+
TVHomeImpl.GetInstance.AppShortcutControllerInstance.AddFileSystemChangedListener((sender, arg) =>
{
RefreshView();
};
popup.Items.Add(new ContextPopupItem("PIN"));
- popup.Items.Add(new ContextPopupItem("DELETE"));
+ popup.Items.Add(new ContextPopupItem(" DELETE "));
//TODO: need to change the event callback
popup.SelectedIndexChanged += (s, args) =>
isPopupShowing = false;
};
- popup.Show(sender as View);
+ View anchor = sender as View;
+
+ popup.Show(anchor, anchor.Width/2, 0);
isPopupShowing = true;
}
}
*/
using LibTVRefCommonPortable.Utils;
-using System.Windows.Input;
-using TVApps.Controls;
using Xamarin.Forms;
+using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
namespace TVApps.Views
{
public partial class FooterPinStatus : RelativeLayout
{
private Button DoneButton;
- //private Label SumOfCheckedAppLabel;
- /*
+ private Xamarin.Forms.Label AppNameLabel;
+ private Xamarin.Forms.Label AfterLabel;
+ private static int pinnedAppCount = 0;
+ public StackLayout additionalInfo;
+
/// <summary>
/// Identifies the SumOfCheckedApp bindable property
/// </summary>
get { return (int)GetValue(SumOfCheckedAppProperty); }
set { SetValue(SumOfCheckedAppProperty, value); }
}
- */
+
+ /// <summary>
+ /// Identifies the PinnedAppName bindable property
+ /// </summary>
+ public static readonly BindableProperty PinnedAppNameProperty = BindableProperty.Create("PinnedAppName", typeof(string), typeof(FooterPinStatus), null);
+
+ /// <summary>
+ /// Gets or sets name of pinned app
+ /// </summary>
+ public string PinnedAppName
+ {
+ get { return (string)GetValue(PinnedAppNameProperty); }
+ set { SetValue(PinnedAppNameProperty, value); }
+ }
+
+ /// <summary>
+ /// Identifies the UnpinnedAppName bindable property
+ /// </summary>
+ public static readonly BindableProperty UnpinnedAppNameProperty = BindableProperty.Create("UnpinnedAppName", typeof(string), typeof(FooterPinStatus), null);
+
+ /// <summary>
+ /// Gets or sets name of unpinned app
+ /// </summary>
+ public string UnpinnedAppName
+ {
+ get { return (string)GetValue(UnpinnedAppNameProperty); }
+ set { SetValue(UnpinnedAppNameProperty, value); }
+ }
/// <summary>
/// A constructor
InitializeComponent();
CreateDoneButton();
- //CreateFooterAdditionalText();
+ CreateFooterAdditionalText();
+
+ pinnedAppCount = SumOfCheckedApp;
}
- /*
private void CreateFooterAdditionalText()
{
- SetBinding(FooterPinStatus.SumOfCheckedAppProperty, new Binding("SumOfCheckedApp"));
+ SetBinding(FooterPinStatus.PinnedAppNameProperty, new Binding("PinnedAppName"));
+ SetBinding(FooterPinStatus.UnpinnedAppNameProperty, new Binding("UnpinnedAppName"));
- SumOfCheckedAppLabel = new Label()
+ additionalInfo = new StackLayout()
{
- Text = SumOfCheckedApp + " Pinned",
- WidthRequest = SizeUtils.GetWidthSize(600),
- HeightRequest = SizeUtils.GetHeightSize(32),
- FontSize = SizeUtils.GetFontSize(28),
- TextColor = Color.White,
+ Orientation = StackOrientation.Horizontal,
+ Spacing = SizeUtils.GetWidthSize(8),
+ HorizontalOptions = LayoutOptions.Start
};
- this.Children.Add(SumOfCheckedAppLabel,
- heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(32)),
+ this.Children.Add(additionalInfo,
+ heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(128)),
widthConstraint: Constraint.Constant(SizeUtils.GetWidthSize(600)),
yConstraint: Constraint.Constant(SizeUtils.GetHeightSize(762)),
xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(96)));
+ additionalInfo.IsVisible = false;
+
+ AppNameLabel = new Xamarin.Forms.Label()
+ {
+ HeightRequest = SizeUtils.GetHeightSize(36),
+ FontSize = SizeUtils.GetFontSize(32),
+ FontFamily = "BreezeSans",
+ TextColor = Color.White,
+ Opacity = 0.7,
+ HorizontalTextAlignment = TextAlignment.Start,
+ };
+ AppNameLabel.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Medium);
+
+ AfterLabel = new Xamarin.Forms.Label()
+ {
+ HeightRequest = SizeUtils.GetHeightSize(36),
+ FontSize = SizeUtils.GetFontSize(32),
+ FontFamily = "BreezeSans",
+ TextColor = Color.White,
+ Opacity = 0.7,
+ HorizontalTextAlignment = TextAlignment.Start
+ };
+ AfterLabel.On<Xamarin.Forms.PlatformConfiguration.Tizen>().SetFontWeight(FontWeight.Light);
+
PropertyChanged += FooterPinStatusPropertyChanged;
}
- */
+
private void CreateDoneButton()
{
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)));
+ xConstraint: Constraint.Constant(SizeUtils.GetWidthSize(96 + 1332 + 96)));
}
public Button GetDoneButton()
return DoneButton;
}
- /*
private void FooterPinStatusPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName.Equals("SumOfCheckedApp"))
{
- SumOfCheckedAppLabel.Text = SumOfCheckedApp + " Pinned";
+ if (pinnedAppCount > SumOfCheckedApp)
+ {
+ AppNameLabel.Text = UnpinnedAppName;
+ AfterLabel.Text = "is Unpinned";
+ }
+ else
+ {
+ AppNameLabel.Text = PinnedAppName;
+ AfterLabel.Text = "is Pinned";
+ }
+
+ if (AppNameLabel.Text == null)
+ {
+ pinnedAppCount = SumOfCheckedApp;
+ return;
+ }
+
+ additionalInfo.Children.Add(AppNameLabel);
+ additionalInfo.Children.Add(AfterLabel);
+ additionalInfo.IsVisible = true;
+ pinnedAppCount = SumOfCheckedApp;
}
- }*/
+ }
}
}
IsEnabledDeletePopup="{Binding IsEnabledDeletePopup}"
IsPinAppRequested="{Binding IsPinAppRequested}"
DeletePopupAppLabel="{Binding DeletePopupAppLabel}"
- DeletePopupCommand="{Binding DeletePopupCommand}"
- SumOfCheckedApp="{Binding SumOfCheckedApp}"
- PinnedAppName="{Binding PinnedAppName}"
- UnpinnedAppName="{Binding UnpinnedAppName}">
+ DeletePopupCommand="{Binding DeletePopupCommand}">
<ContentPage.BindingContext>
<ViewModels:MainPageViewModel />
</ContentPage.BindingContext>
<Setter Property="FontFamily" Value="BreezeSans" />
<Setter Property="Opacity" Value="0.08" />
</Style>
- <Style x:Key="AddionalInfoTextMedium" TargetType="Label" >
- <Setter Property="TextColor" Value="#FFFFFF" />
- <Setter Property="FontFamily" Value="BreezeSans" />
- <Setter Property="Opacity" Value="0.7" />
- </Style>
- <Style x:Key="AddionalInfoTextLight" TargetType="Label" >
- <Setter Property="TextColor" Value="#FFFFFF" />
- <Setter Property="FontFamily" Value="BreezeSans" />
- <Setter Property="Opacity" Value="0.7" />
- </Style>
</ResourceDictionary>
</ContentPage.Resources>
<Views:FooterPinStatus Grid.Row="1"
Grid.RowSpan="3"
x:Name="FooterPin"
- IsVisible="false" />
+ IsVisible="false"
+ PinnedAppName="{Binding PinnedAppName}"
+ UnpinnedAppName="{Binding UnpinnedAppName}"
+ SumOfCheckedApp="{Binding SumOfCheckedApp}"/>
<Views:FooterDeleteStatus Grid.Row="1"
Grid.RowSpan="3"
Text="APPS"
x:Name="TitleLabel"/>
- <StackLayout Grid.Row="0"
- x:Name="AddtionalInfo"
- IsVisible="false"
- Orientation="Horizontal"
- HorizontalOptions="CenterAndExpand"
- Spacing="{Binding AdditionalInfoSpacing}">
- <Label x:Name="AdditionalInfoText1"
- Style="{StaticResource AddionalInfoTextMedium}"
- HorizontalTextAlignment="Center"
- VerticalOptions="CenterAndExpand"
- FontSize="{Binding AddtionalInfoTextSize}" />
- <Label x:Name="AdditionalInfoIs" Text="is"
- Style="{StaticResource AddionalInfoTextLight}"
- HorizontalTextAlignment="Center"
- VerticalOptions="CenterAndExpand"
- FontSize="{Binding AddtionalInfoTextSize}" />
- <Label x:Name="AdditionalInfoText2"
- Style="{StaticResource AddionalInfoTextLight}"
- HorizontalTextAlignment="Center"
- VerticalOptions="CenterAndExpand"
- FontSize="{Binding AddtionalInfoTextSize}" />
- </StackLayout>
-
<Grid Grid.Row="0" x:Name="Header">
<Grid.RowDefinitions>
<RowDefinition Height="37*" />
private DropdownList sortList;
private Button doneButton;
private Button cancelButton;
- private static int pinnedAppCount = 0;
/// <summary>
/// SubPanel icon's transition height value when it focused.
set { SetValue(DeletePopupCommandProperty, value); }
}
- /// <summary>
- /// Identifies the SumOfCheckedApp bindable property
- /// </summary>
- public static readonly BindableProperty SumOfCheckedAppProperty = BindableProperty.Create("SumOfCheckedApp", typeof(int), typeof(MainPage), default(int));
-
- /// <summary>
- /// Gets or sets count of checked AppItemCell
- /// </summary>
- public int SumOfCheckedApp
- {
- get { return (int)GetValue(SumOfCheckedAppProperty); }
- set { SetValue(SumOfCheckedAppProperty, value); }
- }
-
- /// <summary>
- /// Identifies the PinnedAppName bindable property
- /// </summary>
- public static readonly BindableProperty PinnedAppNameProperty = BindableProperty.Create("PinnedAppName", typeof(string), typeof(MainPage), "");
-
- /// <summary>
- /// Gets or sets name of pinned app
- /// </summary>
- public string PinnedAppName
- {
- get { return (string)GetValue(PinnedAppNameProperty); }
- set { SetValue(PinnedAppNameProperty, value); }
- }
-
- /// <summary>
- /// Identifies the PinnedAppName bindable property
- /// </summary>
- public static readonly BindableProperty UnpinnedAppNameProperty = BindableProperty.Create("UnpinnedAppName", typeof(string), typeof(MainPage), "");
-
- /// <summary>
- /// Gets or sets name of unpinned app
- /// </summary>
- public string UnpinnedAppName
- {
- get { return (string)GetValue(UnpinnedAppNameProperty); }
- set { SetValue(UnpinnedAppNameProperty, value); }
- }
-
private void PlayHideAnimation()
{
var animation = new Animation();
BackKeyInfoImage.HeightRequest = backKeyImageSize;
BackKeyInfo.FontSize = SizeUtils.GetFontSize(28);
BackKeyInfo.Margin = new Thickness(SizeUtils.GetWidthSize(6), 0, 0, 0);
- AdditionalInfoText1.FontSize = SizeUtils.GetFontSize(32);
- AdditionalInfoText2.FontSize = SizeUtils.GetFontSize(32);
-
- TitleLabel.On<Tizen>().SetFontWeight(FontWeight.Normal);
BackKeyInfo.On<Tizen>().SetFontWeight(FontWeight.Normal);
- AdditionalInfoIs.On<Tizen>().SetFontWeight(FontWeight.Light);
PropertyChanged += MainPagePropertyChanged;
SetCurrentStatus(AppsStatus.Default);
await Task.Delay(1);
AppList.InitializeFocus();
MakeFocusChaining();
-
- pinnedAppCount = SumOfCheckedApp;
}
private void MakeFocusChaining()
case AppsStatus.Default:
FooterNormal.IsVisible = true;
FooterPin.IsVisible = false;
+ FooterPin.additionalInfo.IsVisible = false;
FooterDelete.IsVisible = false;
BackKeyInfo.Text = "Quit";
- AddtionalInfo.IsVisible = false;
- TitleLabel.IsVisible = true;
AppList.InitializeFocus();
break;
case AppsStatus.Pin:
AppList.InitializeFocus();
}
}
- else if (e.PropertyName.Equals("SumOfCheckedApp"))
- {
- if (CurrentStatus == AppsStatus.Pin)
- {
- AddtionalInfo.IsVisible = true;
- TitleLabel.IsVisible = false;
- AdditionalInfoText1.On<Tizen>().SetFontWeight(FontWeight.Medium);
- AdditionalInfoText2.On<Tizen>().SetFontWeight(FontWeight.Light);
- AdditionalInfoIs.On<Tizen>().SetFontWeight(FontWeight.Light);
- if (pinnedAppCount > SumOfCheckedApp)
- {
- AdditionalInfoText1.Text = UnpinnedAppName;
- AdditionalInfoText2.Text = "Unpinned";
- }
- else
- {
- AdditionalInfoText1.Text = PinnedAppName;
- AdditionalInfoText2.Text = "Pinned";
- }
-
- pinnedAppCount = SumOfCheckedApp;
- }
- }
}
/// <summary>