Remove multipin.
authorcskim <charles0.kim@samsung.com>
Fri, 14 Apr 2017 10:08:17 +0000 (19:08 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:52 +0000 (18:34 +0900)
Make the TVApps to exited when the backbutton is pressed in adding ping scenarion.

Change-Id: I68d6e92e9125c68d13fb751dfb3bf475b6064cc4

LibTVRefCommonPortable/Utils/SizeUtils.cs
TVApps/TVApps/ViewModels/AppsHolder.cs
TVApps/TVApps/ViewModels/MainPageViewModel.cs
TVApps/TVApps/Views/FooterPinStatus.xaml
TVApps/TVApps/Views/MainPage.xaml
TVApps/TVApps/Views/MainPage.xaml.cs

index daa4d6da418638fd4729cdbe0cfb0b25afe8d281..baa3969066d5a1e1a86ebe51622ee26810dd50e1 100644 (file)
@@ -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);
             }
         }
index c29deabacb4fa53dc4842fb40d9348bbef7684b5..8858546a604947a947436215eed0d82db3a1b1ed 100644 (file)
@@ -187,6 +187,7 @@ namespace TVApps.ViewModels
                 PinnedApps.Add(appID, appID);
             }
 
+            UpdatePinnedApps();
             ViewModel.OnPropertyChanged("SumOfCheckedApp");
         }
 
index 6af495f3781d24c5694e10489c0d75779fd3239c..504b37be810e3f8c63a8f10a8fc7583fc8300fd7 100644 (file)
@@ -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; }
 
         /// <summary>
-        /// 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
         /// </summary>
         /// <see cref="FooterPinStatus"/>
-        public Command ButtonPinOkCommand { get; set; }
-
-        /// <summary>
-        /// A command will be executed if the cancel button in FooterPinStatus is clicked
-        /// </summary>
-        /// <see cref="FooterPinStatus"/>
-        public Command ButtonPinCancelCommand { get; set; }
+        public Command ButtonPinDoneCommand { get; set; }
 
         /// <summary>
         /// Gets and Sets current status of MainPageViewModel
@@ -231,11 +226,24 @@ namespace TVApps.ViewModels
         /// </summary>
         public event PropertyChangedEventHandler PropertyChanged;
 
+        private bool isPinAppRequested = false;
         /// <summary>
         /// A flag indicates whether pin app is requested or not
         /// If TV Home requests pin app to TV Apps, IsPinAppRequested will be true
         /// </summary>
-        private bool IsPinAppRequested;
+        public bool IsPinAppRequested
+        {
+            get
+            {
+                return isPinAppRequested;
+            }
+
+            set
+            {
+                isPinAppRequested = value;
+                OnPropertyChanged();
+            }
+        }
 
         /// <summary>
         /// 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<Dictionary<string, string>>(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
         /// <summary>
         /// A method for invoking PropertyChanged event
         /// </summary>
-        /// <param name="name">The name of property</param>
-        public void OnPropertyChanged(string name)
+        /// <param name="propertyName">The name of property</param>
+        public void OnPropertyChanged([CallerMemberName] string propertyName = null)
         {
             PropertyChangedEventHandler handler = PropertyChanged;
             if (handler != null)
             {
-                handler(this, new PropertyChangedEventArgs(name));
+                handler(this, new PropertyChangedEventArgs(propertyName));
             }
         }
     }
index e14cdd2adfe2041db48cfc0d21d49543c63f1437..d46001d2158570edb13a6a9a1b06067f63b7e299 100644 (file)
 
   <StackLayout Grid.Row="0" Grid.Column="2"
                Orientation="Horizontal">
-    <Control:TVButton Text="OK"
-                      Command="{Binding ButtonPinOkCommand}"/>
-
-    <Control:TVButton Text="CANCEL"
-                      Command="{Binding ButtonPinCancelCommand}"/>
+    <Control:TVButton Text="DONE"
+                      Command="{Binding ButtonPinDoneCommand}"/>
   </StackLayout>
 </Grid>
\ No newline at end of file
index 19daedcd5efaa89064bce233e710d9ab481fe672..e26930409066d4c491731865bc1269bf69f8cfbc 100755 (executable)
@@ -8,6 +8,7 @@
              BackgroundColor="#000000"
              CurrentStatus="{Binding CurrentStatus}"
              IsEnabledDeletePopup="{Binding IsEnabledDeletePopup}"
+             IsPinAppRequested="{Binding IsPinAppRequested}"
              DeletePopupAppLabel="{Binding DeletePopupAppLabel}"
              DeletePopupCommand="{Binding DeletePopupCommand}">
   <ContentPage.BindingContext>
index 0c9ad1ca0fc0e166815c7e7b123dbebab511028d..3be3bb292db0583bee8fc2839aaf3152d940d7a7 100644 (file)
@@ -78,6 +78,20 @@ namespace TVApps.Views
             set { SetValue(IsEnabledDeletePopupProperty, value); }
         }
 
+        /// <summary>
+        /// Identifies the pin app control request received information bindable property
+        /// </summary>
+        public static readonly BindableProperty IsPinAppRequestedProperty = BindableProperty.Create("IsPinAppRequested", typeof(bool), typeof(MainPage), default(bool));
+
+        /// <summary>
+        /// Gets or sets whether pin app control request received information.
+        /// </summary>
+        public bool IsPinAppRequested
+        {
+            get { return (bool)GetValue(IsPinAppRequestedProperty); }
+            set { SetValue(IsPinAppRequestedProperty, value); }
+        }
+
         /// <summary>
         /// Identifies the delete popup command bindable property
         /// </summary>
@@ -242,6 +256,11 @@ namespace TVApps.Views
         /// <see cref="Page.OnBackButtonPressed"/>
         protected override bool OnBackButtonPressed()
         {
+            if (IsPinAppRequested)
+            {
+                return false;
+            }
+
             SynchronizationContext.Current.Post(async (o) =>
             {
                 await OnBackKeyPressedAtMain();