From ad2a258efb729525fe65d9946ea0f163744c0c59 Mon Sep 17 00:00:00 2001 From: cskim Date: Fri, 14 Apr 2017 19:08:17 +0900 Subject: [PATCH] Remove multipin. Make the TVApps to exited when the backbutton is pressed in adding ping scenarion. Change-Id: I68d6e92e9125c68d13fb751dfb3bf475b6064cc4 --- LibTVRefCommonPortable/Utils/SizeUtils.cs | 4 +- TVApps/TVApps/ViewModels/AppsHolder.cs | 1 + TVApps/TVApps/ViewModels/MainPageViewModel.cs | 50 ++++++++----------- TVApps/TVApps/Views/FooterPinStatus.xaml | 7 +-- TVApps/TVApps/Views/MainPage.xaml | 1 + TVApps/TVApps/Views/MainPage.xaml.cs | 19 +++++++ 6 files changed, 46 insertions(+), 36 deletions(-) diff --git a/LibTVRefCommonPortable/Utils/SizeUtils.cs b/LibTVRefCommonPortable/Utils/SizeUtils.cs index daa4d6d..baa3969 100644 --- a/LibTVRefCommonPortable/Utils/SizeUtils.cs +++ b/LibTVRefCommonPortable/Utils/SizeUtils.cs @@ -146,7 +146,7 @@ namespace LibTVRefCommonPortable.Utils switch (ModelName) { case PlatformModel.Emulator: - DebuggingUtils.Dbg("Emulator, Font size = " + fontBaseSize + " => " + ((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio); + //DebuggingUtils.Dbg("Emulator, Font size = " + fontBaseSize + " => " + ((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio); return Convert.ToInt32(((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio); default: @@ -154,7 +154,7 @@ namespace LibTVRefCommonPortable.Utils case PlatformModel.TV: // TODO : Remove this if the TV/Other device's dpi is correctly changed. double tempAdjustmentRatio = 0.3D; - DebuggingUtils.Dbg("TV/Other, Font size = " + fontBaseSize + " => " + ((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio * tempAdjustmentRatio); + //DebuggingUtils.Dbg("TV/Other, Font size = " + fontBaseSize + " => " + ((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio * tempAdjustmentRatio); return Convert.ToInt32(((double)((double)fontBaseSize / (double)BaseScreenHeight) * (double)ScreenHeight) * ScaleRatio * tempAdjustmentRatio); } } diff --git a/TVApps/TVApps/ViewModels/AppsHolder.cs b/TVApps/TVApps/ViewModels/AppsHolder.cs index c29deab..8858546 100644 --- a/TVApps/TVApps/ViewModels/AppsHolder.cs +++ b/TVApps/TVApps/ViewModels/AppsHolder.cs @@ -187,6 +187,7 @@ namespace TVApps.ViewModels PinnedApps.Add(appID, appID); } + UpdatePinnedApps(); ViewModel.OnPropertyChanged("SumOfCheckedApp"); } diff --git a/TVApps/TVApps/ViewModels/MainPageViewModel.cs b/TVApps/TVApps/ViewModels/MainPageViewModel.cs index 6af495f..504b37b 100644 --- a/TVApps/TVApps/ViewModels/MainPageViewModel.cs +++ b/TVApps/TVApps/ViewModels/MainPageViewModel.cs @@ -21,6 +21,7 @@ using System.ComponentModel; using Xamarin.Forms; using System; using TVApps.Views; +using System.Runtime.CompilerServices; namespace TVApps.ViewModels { @@ -115,16 +116,10 @@ namespace TVApps.ViewModels public Command ButtonDeleteAppCommand { get; set; } /// - /// A command will be executed if the ok button in FooterPinStatus is clicked + /// A command will be executed if the done button in FooterPinStatus is clicked /// /// - public Command ButtonPinOkCommand { get; set; } - - /// - /// A command will be executed if the cancel button in FooterPinStatus is clicked - /// - /// - public Command ButtonPinCancelCommand { get; set; } + public Command ButtonPinDoneCommand { get; set; } /// /// Gets and Sets current status of MainPageViewModel @@ -231,11 +226,24 @@ namespace TVApps.ViewModels /// public event PropertyChangedEventHandler PropertyChanged; + private bool isPinAppRequested = false; /// /// A flag indicates whether pin app is requested or not /// If TV Home requests pin app to TV Apps, IsPinAppRequested will be true /// - private bool IsPinAppRequested; + public bool IsPinAppRequested + { + get + { + return isPinAppRequested; + } + + set + { + isPinAppRequested = value; + OnPropertyChanged(); + } + } /// /// Constructor @@ -262,32 +270,17 @@ namespace TVApps.ViewModels ChangeCurrentStatus(AppsStatus.Delete); }); - ButtonPinOkCommand = new Command(() => + ButtonPinDoneCommand = new Command(() => { - appsHolder.UpdatePinnedApps(); ChangeCurrentStatus(AppsStatus.Default); if (IsPinAppRequested) { - // TODO : check pinned apps and a number of pinned apps AppControlUtils.SendAppAddedNotificationToHome("org.tizen.settings"); AppControlUtils.SelfTerminate(); } }); - ButtonPinCancelCommand = new Command(() => - { - appsHolder.ResetPinnedApps(); - ChangeCurrentStatus(AppsStatus.Default); - - OnPropertyChanged("SumOfCheckedApp"); - - if (IsPinAppRequested) - { - AppControlUtils.SelfTerminate(); - } - }); - DeletePopupCommand = new Command>(async (arg) => { string answer; @@ -340,7 +333,6 @@ namespace TVApps.ViewModels App.SetPinAppRequestListener((s, e) => { - // TODO : check concurrency IsPinAppRequested = true; ChangeCurrentStatus(AppsStatus.Pin); }); @@ -426,13 +418,13 @@ namespace TVApps.ViewModels /// /// A method for invoking PropertyChanged event /// - /// The name of property - public void OnPropertyChanged(string name) + /// The name of property + public void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { - handler(this, new PropertyChangedEventArgs(name)); + handler(this, new PropertyChangedEventArgs(propertyName)); } } } diff --git a/TVApps/TVApps/Views/FooterPinStatus.xaml b/TVApps/TVApps/Views/FooterPinStatus.xaml index e14cdd2..d46001d 100644 --- a/TVApps/TVApps/Views/FooterPinStatus.xaml +++ b/TVApps/TVApps/Views/FooterPinStatus.xaml @@ -30,10 +30,7 @@ - - - + \ No newline at end of file diff --git a/TVApps/TVApps/Views/MainPage.xaml b/TVApps/TVApps/Views/MainPage.xaml index 19daedc..e269304 100755 --- a/TVApps/TVApps/Views/MainPage.xaml +++ b/TVApps/TVApps/Views/MainPage.xaml @@ -8,6 +8,7 @@ BackgroundColor="#000000" CurrentStatus="{Binding CurrentStatus}" IsEnabledDeletePopup="{Binding IsEnabledDeletePopup}" + IsPinAppRequested="{Binding IsPinAppRequested}" DeletePopupAppLabel="{Binding DeletePopupAppLabel}" DeletePopupCommand="{Binding DeletePopupCommand}"> diff --git a/TVApps/TVApps/Views/MainPage.xaml.cs b/TVApps/TVApps/Views/MainPage.xaml.cs index 0c9ad1c..3be3bb2 100644 --- a/TVApps/TVApps/Views/MainPage.xaml.cs +++ b/TVApps/TVApps/Views/MainPage.xaml.cs @@ -78,6 +78,20 @@ namespace TVApps.Views set { SetValue(IsEnabledDeletePopupProperty, value); } } + /// + /// Identifies the pin app control request received information bindable property + /// + public static readonly BindableProperty IsPinAppRequestedProperty = BindableProperty.Create("IsPinAppRequested", typeof(bool), typeof(MainPage), default(bool)); + + /// + /// Gets or sets whether pin app control request received information. + /// + public bool IsPinAppRequested + { + get { return (bool)GetValue(IsPinAppRequestedProperty); } + set { SetValue(IsPinAppRequestedProperty, value); } + } + /// /// Identifies the delete popup command bindable property /// @@ -242,6 +256,11 @@ namespace TVApps.Views /// protected override bool OnBackButtonPressed() { + if (IsPinAppRequested) + { + return false; + } + SynchronizationContext.Current.Post(async (o) => { await OnBackKeyPressedAtMain(); -- 2.34.1