From: Hyerim Kim Date: Wed, 3 May 2017 07:50:49 +0000 (+0900) Subject: Modifies Apps Additional Information X-Git-Tag: submit/tizen/20170808.015446~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb0a43c0326db149bb55fb2783514f9235af9536;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Modifies Apps Additional Information Modifies Apps item Context popup implementation Change-Id: I20678310064b84ea149ff23dee35c6771bd6ba4c Signed-off-by: Hyerim Kim --- diff --git a/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs old mode 100644 new mode 100755 index 56040fd..cfef3e3 --- a/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs +++ b/LibTVRefCommonPortable/DataModels/AppShortcutInfo.cs @@ -196,6 +196,9 @@ namespace LibTVRefCommonPortable.DataModels [XmlIgnore] public Command OptionMenuDeleteCommand { get; set; } + [XmlIgnore] + public Command ToDefaultCommand { get; set; } + /// /// A Constructor. /// Initializes AppShortcutInfo. @@ -211,6 +214,11 @@ namespace LibTVRefCommonPortable.DataModels { MessagingCenter.Send(this, "OptionMenuDelete", AppID); }); + + ToDefaultCommand = new Command(() => + { + MessagingCenter.Send(this, "ChangeToDefaultMode"); + }); } /// diff --git a/TVApps/TVApps/Controls/AppItemCell.xaml b/TVApps/TVApps/Controls/AppItemCell.xaml index ae81644..4183778 100755 --- a/TVApps/TVApps/Controls/AppItemCell.xaml +++ b/TVApps/TVApps/Controls/AppItemCell.xaml @@ -80,29 +80,6 @@ Unfocused="OnUnFocused" Clicked="OnClicked" Opacity="0" /> - - - - - - - 0 - private int height144 = SizeUtils.GetHeightSize(144); + private bool isPopupShowing = false; + /// /// A constructor /// Adds PropertyChanged event handler @@ -158,7 +185,6 @@ namespace TVApps.Controls ButtonTitle.FontSize = SizeUtils.GetFontSize(25); ButtonTitle.PropertyChanged += ButtonTitlePropertyChanged; - OptionMenuPinToggleButton.Text = IsPinned ? "UNPIN" : "PIN"; PropertyChanged += AppItemCellPropertyChanged; } @@ -173,7 +199,6 @@ namespace TVApps.Controls if (e.PropertyName.CompareTo("IsPinned") == 0) { PinnedIcon.FadeTo((IsPinned) ? 0.99 : 0.0, 300); - OptionMenuPinToggleButton.Text = (IsPinned) ? "UNPIN" : "PIN"; return; } @@ -244,9 +269,76 @@ namespace TVApps.Controls 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; } /// diff --git a/TVApps/TVApps/Controls/AppListView.xaml.cs b/TVApps/TVApps/Controls/AppListView.xaml.cs index 870cb86..1fc20a5 100755 --- a/TVApps/TVApps/Controls/AppListView.xaml.cs +++ b/TVApps/TVApps/Controls/AppListView.xaml.cs @@ -171,6 +171,9 @@ namespace TVApps.Controls 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(); diff --git a/TVApps/TVApps/ViewModels/AppsHolder.cs b/TVApps/TVApps/ViewModels/AppsHolder.cs index 1e16964..c41a961 100755 --- a/TVApps/TVApps/ViewModels/AppsHolder.cs +++ b/TVApps/TVApps/ViewModels/AppsHolder.cs @@ -231,6 +231,11 @@ namespace TVApps.ViewModels ViewModel.ChangeCurrentStatus(AppsStatus.Default); } + public void ChangeToDefaultStatus() + { + ViewModel.ChangeCurrentStatus(AppsStatus.Default); + } + /// /// Removes the pinned app by app ID /// diff --git a/TVApps/TVApps/ViewModels/MainPageViewModel.cs b/TVApps/TVApps/ViewModels/MainPageViewModel.cs index 837476b..2f3c4be 100755 --- a/TVApps/TVApps/ViewModels/MainPageViewModel.cs +++ b/TVApps/TVApps/ViewModels/MainPageViewModel.cs @@ -192,17 +192,6 @@ namespace TVApps.ViewModels } /// - /// Additional info layout's spacing size - /// - public int AdditionalInfoSpacing - { - get - { - return SizeUtils.GetWidthSize(12); - } - } - - /// /// Regular text font size /// int regularFontSize; @@ -374,6 +363,11 @@ namespace TVApps.ViewModels appsHolder.CheckDeleteApp(arg); }); + MessagingCenter.Subscribe(this, "ChangeToDefaultMode", (sender) => + { + appsHolder.ChangeToDefaultStatus(); + }); + TVHomeImpl.GetInstance.AppShortcutControllerInstance.AddFileSystemChangedListener((sender, arg) => { RefreshView(); diff --git a/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs b/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs index 7711085..85b378d 100755 --- a/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs +++ b/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs @@ -130,7 +130,7 @@ namespace TVApps.Views }; 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) => @@ -160,7 +160,9 @@ namespace TVApps.Views isPopupShowing = false; }; - popup.Show(sender as View); + View anchor = sender as View; + + popup.Show(anchor, anchor.Width/2, 0); isPopupShowing = true; } } diff --git a/TVApps/TVApps/Views/FooterPinStatus.xaml.cs b/TVApps/TVApps/Views/FooterPinStatus.xaml.cs index 42e456c..b53025a 100755 --- a/TVApps/TVApps/Views/FooterPinStatus.xaml.cs +++ b/TVApps/TVApps/Views/FooterPinStatus.xaml.cs @@ -15,9 +15,8 @@ */ using LibTVRefCommonPortable.Utils; -using System.Windows.Input; -using TVApps.Controls; using Xamarin.Forms; +using Xamarin.Forms.PlatformConfiguration.TizenSpecific; namespace TVApps.Views { @@ -27,8 +26,11 @@ 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; + /// /// Identifies the SumOfCheckedApp bindable property /// @@ -42,7 +44,34 @@ namespace TVApps.Views get { return (int)GetValue(SumOfCheckedAppProperty); } set { SetValue(SumOfCheckedAppProperty, value); } } - */ + + /// + /// Identifies the PinnedAppName bindable property + /// + public static readonly BindableProperty PinnedAppNameProperty = BindableProperty.Create("PinnedAppName", typeof(string), typeof(FooterPinStatus), null); + + /// + /// Gets or sets name of pinned app + /// + public string PinnedAppName + { + get { return (string)GetValue(PinnedAppNameProperty); } + set { SetValue(PinnedAppNameProperty, value); } + } + + /// + /// Identifies the UnpinnedAppName bindable property + /// + public static readonly BindableProperty UnpinnedAppNameProperty = BindableProperty.Create("UnpinnedAppName", typeof(string), typeof(FooterPinStatus), null); + + /// + /// Gets or sets name of unpinned app + /// + public string UnpinnedAppName + { + get { return (string)GetValue(UnpinnedAppNameProperty); } + set { SetValue(UnpinnedAppNameProperty, value); } + } /// /// A constructor @@ -52,32 +81,56 @@ namespace TVApps.Views 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().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().SetFontWeight(FontWeight.Light); + PropertyChanged += FooterPinStatusPropertyChanged; } - */ + private void CreateDoneButton() { @@ -92,7 +145,7 @@ namespace TVApps.Views 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() @@ -100,13 +153,32 @@ namespace TVApps.Views 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; } - }*/ + } } } diff --git a/TVApps/TVApps/Views/MainPage.xaml b/TVApps/TVApps/Views/MainPage.xaml index 0c9dc8f..6da560f 100755 --- a/TVApps/TVApps/Views/MainPage.xaml +++ b/TVApps/TVApps/Views/MainPage.xaml @@ -10,10 +10,7 @@ IsEnabledDeletePopup="{Binding IsEnabledDeletePopup}" IsPinAppRequested="{Binding IsPinAppRequested}" DeletePopupAppLabel="{Binding DeletePopupAppLabel}" - DeletePopupCommand="{Binding DeletePopupCommand}" - SumOfCheckedApp="{Binding SumOfCheckedApp}" - PinnedAppName="{Binding PinnedAppName}" - UnpinnedAppName="{Binding UnpinnedAppName}"> + DeletePopupCommand="{Binding DeletePopupCommand}"> @@ -29,16 +26,6 @@ - - @@ -60,7 +47,10 @@ + IsVisible="false" + PinnedAppName="{Binding PinnedAppName}" + UnpinnedAppName="{Binding UnpinnedAppName}" + SumOfCheckedApp="{Binding SumOfCheckedApp}"/> - - - diff --git a/TVApps/TVApps/Views/MainPage.xaml.cs b/TVApps/TVApps/Views/MainPage.xaml.cs index 2e41320..3ebef9b 100755 --- a/TVApps/TVApps/Views/MainPage.xaml.cs +++ b/TVApps/TVApps/Views/MainPage.xaml.cs @@ -39,7 +39,6 @@ namespace TVApps.Views private DropdownList sortList; private Button doneButton; private Button cancelButton; - private static int pinnedAppCount = 0; /// /// SubPanel icon's transition height value when it focused. @@ -116,48 +115,6 @@ namespace TVApps.Views set { SetValue(DeletePopupCommandProperty, value); } } - /// - /// Identifies the SumOfCheckedApp bindable property - /// - public static readonly BindableProperty SumOfCheckedAppProperty = BindableProperty.Create("SumOfCheckedApp", typeof(int), typeof(MainPage), default(int)); - - /// - /// Gets or sets count of checked AppItemCell - /// - public int SumOfCheckedApp - { - get { return (int)GetValue(SumOfCheckedAppProperty); } - set { SetValue(SumOfCheckedAppProperty, value); } - } - - /// - /// Identifies the PinnedAppName bindable property - /// - public static readonly BindableProperty PinnedAppNameProperty = BindableProperty.Create("PinnedAppName", typeof(string), typeof(MainPage), ""); - - /// - /// Gets or sets name of pinned app - /// - public string PinnedAppName - { - get { return (string)GetValue(PinnedAppNameProperty); } - set { SetValue(PinnedAppNameProperty, value); } - } - - /// - /// Identifies the PinnedAppName bindable property - /// - public static readonly BindableProperty UnpinnedAppNameProperty = BindableProperty.Create("UnpinnedAppName", typeof(string), typeof(MainPage), ""); - - /// - /// Gets or sets name of unpinned app - /// - public string UnpinnedAppName - { - get { return (string)GetValue(UnpinnedAppNameProperty); } - set { SetValue(UnpinnedAppNameProperty, value); } - } - private void PlayHideAnimation() { var animation = new Animation(); @@ -192,12 +149,7 @@ namespace TVApps.Views 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().SetFontWeight(FontWeight.Normal); BackKeyInfo.On().SetFontWeight(FontWeight.Normal); - AdditionalInfoIs.On().SetFontWeight(FontWeight.Light); PropertyChanged += MainPagePropertyChanged; SetCurrentStatus(AppsStatus.Default); @@ -233,8 +185,6 @@ namespace TVApps.Views await Task.Delay(1); AppList.InitializeFocus(); MakeFocusChaining(); - - pinnedAppCount = SumOfCheckedApp; } private void MakeFocusChaining() @@ -400,10 +350,9 @@ namespace TVApps.Views 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: @@ -456,29 +405,6 @@ namespace TVApps.Views AppList.InitializeFocus(); } } - else if (e.PropertyName.Equals("SumOfCheckedApp")) - { - if (CurrentStatus == AppsStatus.Pin) - { - AddtionalInfo.IsVisible = true; - TitleLabel.IsVisible = false; - AdditionalInfoText1.On().SetFontWeight(FontWeight.Medium); - AdditionalInfoText2.On().SetFontWeight(FontWeight.Light); - AdditionalInfoIs.On().SetFontWeight(FontWeight.Light); - if (pinnedAppCount > SumOfCheckedApp) - { - AdditionalInfoText1.Text = UnpinnedAppName; - AdditionalInfoText2.Text = "Unpinned"; - } - else - { - AdditionalInfoText1.Text = PinnedAppName; - AdditionalInfoText2.Text = "Pinned"; - } - - pinnedAppCount = SumOfCheckedApp; - } - } } ///