Add comments for TVApps.Views, Renderers and Main
authorHeonjae Jang <heonjae.jang@samsung.com>
Wed, 29 Mar 2017 10:45:44 +0000 (19:45 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:51 +0000 (18:34 +0900)
Change-Id: Id415c82490af563fa088d6e9cafd63671487f600

TVApps/TVApps.TizenTV/Renderer/CustomButtonRenderer.cs
TVApps/TVApps.TizenTV/Renderer/NinePatchImageRenderer.cs
TVApps/TVApps.TizenTV/TVApps.TizenTV.cs
TVApps/TVApps/TVApps.cs
TVApps/TVApps/Views/FooterDeleteStatus.xaml.cs
TVApps/TVApps/Views/FooterNormalStatus.xaml.cs
TVApps/TVApps/Views/FooterPinStatus.xaml.cs
TVApps/TVApps/Views/MainPage.xaml.cs

index ab6f1af44ae38c3d76c6f6ed2b54520e3dd05dd7..bcf0504f6ceabd7d818f97e499e6e4396b1f986f 100644 (file)
@@ -24,8 +24,16 @@ using Xamarin.Forms.Platform.Tizen;
 [assembly: ExportRenderer(typeof(CustomButton), typeof(CustomButtonRenderer))]
 namespace TVApps.TizenTV.Renderer
 {
+    /// <summary>
+    /// A custom renderer for CustomButton
+    /// </summary>
+    /// <see cref="CustomButton"/>
     class CustomButtonRenderer : ButtonRenderer//ViewRenderer<Xamarin.Forms.Button, Button>
     {
+        /// <summary>
+        /// Register touch event callback for the Tap.
+        /// </summary>
+        /// <param name="args"> A button element changed event's argument </param>
         protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> args)
         {
             base.OnElementChanged(args);
@@ -45,6 +53,11 @@ namespace TVApps.TizenTV.Renderer
             Control.Released += KeyUp;
         }
 
+        /// <summary>
+        /// A action delegate invokes OnButtonUp event
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when Control(Native Button) is pressed</param>
         private void KeyUp(object sender, EventArgs e)
         {
             DbgPort.D("KeyUp");
@@ -52,6 +65,11 @@ namespace TVApps.TizenTV.Renderer
             BtnElement.OnButtonUp.Invoke(sender, e);
         }
 
+        /// <summary>
+        /// A action delegate invokes OnButtonDown event
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when Control(Native Button) is released</param>
         private void KeyDown(object sender, EventArgs e)
         {
             DbgPort.D("KeyDown");
index a83f448cda819d95f679a4d2f56a68f7c5179fd3..9b791b56335289d28fa7e947fe193d90201060c3 100644 (file)
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-using LibTVRefCommonTizen.Ports;
-using System;
 using System.ComponentModel;
 
 using TVApps.Controls;
@@ -25,33 +23,52 @@ using Xamarin.Forms.Platform.Tizen;
 [assembly: ExportRenderer(typeof(NinePatchImage), typeof(NinePatchImageRenderer))]
 namespace TVApps.TizenTV.Renderer
 {
+    /// <summary>
+    /// A custom renderer for NinePatchImage
+    /// </summary>
+    /// <see cref="NinePatchImage"/>
     class NinePatchImageRenderer : ImageRenderer
     {
-        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Image> e)
+        /// <summary>
+        /// Updates border when Element is changed
+        /// </summary>
+        /// <param name="args">A image element changed event's argument </param>
+        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Image> args)
         {
-            base.OnElementChanged(e);
+            base.OnElementChanged(args);
             UpdateBorder();
         }
 
-        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
+        /// <summary>
+        /// Updates border when ElementProperty is changed
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="args">A image element property changed event's argument </param>
+        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs args)
         {
-            if ((e.PropertyName == NinePatchImage.BorderBottomProperty.PropertyName)
-                || (e.PropertyName == NinePatchImage.BorderLeftProperty.PropertyName)
-                || (e.PropertyName == NinePatchImage.BorderRightProperty.PropertyName)
-                || (e.PropertyName == NinePatchImage.BorderTopProperty.PropertyName))
+            if ((args.PropertyName == NinePatchImage.BorderBottomProperty.PropertyName)
+                || (args.PropertyName == NinePatchImage.BorderLeftProperty.PropertyName)
+                || (args.PropertyName == NinePatchImage.BorderRightProperty.PropertyName)
+                || (args.PropertyName == NinePatchImage.BorderTopProperty.PropertyName))
             {
                 UpdateBorder();
             }
 
-            base.OnElementPropertyChanged(sender, e);
+            base.OnElementPropertyChanged(sender, args);
         }
 
+        /// <summary>
+        /// A method updates border of Control(Native Image)
+        /// </summary>
         void UpdateBorder()
         {
             var img = Element as NinePatchImage;
             Control.SetBorder(img.BorderLeft, img.BorderRight, img.BorderTop, img.BorderBottom);
         }
 
+        /// <summary>
+        /// A method updates border of Control(Native Image) after loading
+        /// </summary>
         protected override void UpdateAfterLoading()
         {
             base.UpdateAfterLoading();
index 6d9a57ef1f411758cb32fcc8f5be3663f25f92b9..b753b13f8a426f244f71753c46de6e001708cb61 100644 (file)
@@ -22,32 +22,42 @@ using System.Threading;
 
 namespace TVApps.TizenTV
 {
+    /// <summary>
+    /// TV Apps application main entry point
+    /// </summary>
     public class Program : Xamarin.Forms.Platform.Tizen.FormsApplication, IAppLifeControl
     {
+        /// <summary>
+        /// The application instance
+        /// </summary>
         private static Program instance;
+
+        /// <summary>
+        /// A interface for the platform notification
+        /// </summary>
         private IPlatformNotification notification;
-        private Timer timerForKeyGrab;
 
+        /// <summary>
+        /// Gets and Sets application resource path
+        /// </summary>
         public static string AppResourcePath
         {
             get;
             private set;
         }
 
+        /// <summary>
+        /// Gets and Sets application data path
+        /// </summary>
         public static string AppDataPath
         {
             get;
             private set;
         }
 
-        private void CallbackForKeyGrab(Object state)
-        {
-            MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true);
-            timerForKeyGrab.Dispose();
-            timerForKeyGrab = null;
-            DebuggingUtils.Dbg("KeyGrab finished");
-        }
-
+        /// <summary>
+        /// A method will be called when application is created
+        /// </summary>
         protected override void OnCreate()
         {
             base.OnCreate();
@@ -64,14 +74,19 @@ namespace TVApps.TizenTV
 
             MainWindow.KeyUp += KeyUpListener;
 
-            TimerCallback timerDelegate = new TimerCallback(CallbackForKeyGrab);
-            timerForKeyGrab = new Timer(timerDelegate, MainWindow, 3000, 0);
+            MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true);
         }
 
-        private void KeyUpListener(object sender, ElmSharp.EvasKeyEventArgs e)
+        /// <summary>
+        /// A method will be called when application receives KeyUp event
+        /// </summary>
+
+        /// <param name="sender">The source of the event</param>
+        /// <param name="args">A EvasKey event's argument</param>
+        private void KeyUpListener(object sender, ElmSharp.EvasKeyEventArgs args)
         {
-            DebuggingUtils.Dbg("[TVApps.TizenTV.cs] Key Pressed :" + e.KeyName);
-            if (e.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0)
+            DebuggingUtils.Dbg("[TVApps.TizenTV.cs] Key Pressed :" + args.KeyName);
+            if (args.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0)
             {
                 if (notification != null)
                 {
@@ -80,17 +95,22 @@ namespace TVApps.TizenTV
             }
         }
 
+        /// <summary>
+        /// A method will be called when application is terminated
+        /// </summary>
         protected override void OnTerminate()
         {
             base.OnTerminate();
 
             notification = null;
             PackageManagerPort.UnregisterCallbacks();
-            MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformBackButtonName);
             MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName);
-
         }
 
+        /// <summary>
+        /// A method will be called when application receives AppControl
+        /// </summary>
+        /// <param name="e">AppControl event argument</param>
         protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
         {
             DbgPort.D("OnAppControlReceived, " + e.ReceivedAppControl.Operation);
@@ -102,6 +122,10 @@ namespace TVApps.TizenTV
             }
         }
 
+        /// <summary>
+        /// The entry point for the application
+        /// </summary>
+        /// <param name="args">A list of command line arguments</param>
         static void Main(string[] args)
         {
             instance = new Program();
@@ -121,9 +145,11 @@ namespace TVApps.TizenTV
             Xamarin.Forms.Platform.Tizen.Forms.Init(instance, true);
 
             instance.Run(args);
-
         }
 
+        /// <summary>
+        /// A method terminates application
+        /// </summary>
         public void SelfTerminate()
         {
             instance.Exit();
index d5948b47719fd19016973d1014f1091b6058593c..2c8a4f667f961215d7ba5fec47e1a909c7bb0055 100755 (executable)
@@ -21,58 +21,114 @@ using System;
 
 namespace TVApps
 {
+    /// <summary>
+    /// A custom EventArgs with string field
+    /// </summary>
     public class TVAppsEventArgs : EventArgs
     {
         public string arg;
     }
 
+    /// <summary>
+    /// A class that represents TV Apps application.
+    /// </summary>
     public class App : Application, IPlatformNotification
     {
+        /// <summary>
+        /// A event handler for handling MenuKey event
+        /// </summary>
         private static EventHandler<TVAppsEventArgs> MenuKeyListener;
+
+        /// <summary>
+        /// A event handler for handling AppInstalled event
+        /// </summary>
         private static EventHandler<TVAppsEventArgs> AppInstalledListener;
+
+        /// <summary>
+        /// A event handler for handling AppUninstalled event
+        /// </summary>
         private static EventHandler<TVAppsEventArgs> AppUninstalledListener;
+
+        /// <summary>
+        /// A event handler for handling PinApp request for TV Home
+        /// </summary>
         private static EventHandler<TVAppsEventArgs> PinAppRequestListener;
 
+
+        /// <summary>
+        /// A constructor
+        /// Sets main page to MainPage instance
+        /// </summary>
+        /// <see cref="MainPage"/>
         public App()
         {
             MainPage = new MainPage();
         }
 
+        /// <summary>
+        /// This method is called when the application starts
+        /// </summary>
         protected override void OnStart()
         {
 
         }
 
+        /// <summary>
+        /// This method is called when the application enters the sleeping state
+        /// </summary>
         protected override void OnSleep()
         {
 
         }
 
+        /// <summary>
+        /// This method is called when the application resumes from a sleeping state
+        /// </summary>
         protected override void OnResume()
         {
 
         }
 
+        /// <summary>
+        /// A method adds EventHandler to MenuKeyListener
+        /// </summary>
+        /// <param name="listener">The EventHandler for adding</param>
         public static void SetMenuKeyListener(EventHandler<TVAppsEventArgs> listener)
         {
             MenuKeyListener += listener;
         }
 
+        /// <summary>
+        /// A method adds EventHandler to AppInstalledListener
+        /// </summary>
+        /// <param name="listener">The EventHandler for adding</param>
         public static void SetAppInstalledListener(EventHandler<TVAppsEventArgs> listener)
         {
             AppInstalledListener += listener;
         }
 
+        /// <summary>
+        /// A method adds EventHandler to AppUninstalledListener
+        /// </summary>
+        /// <param name="listener">The EventHandler for adding</param>
         public static void SetAppUninstalledListener(EventHandler<TVAppsEventArgs> listener)
         {
             AppUninstalledListener += listener;
         }
 
+        /// <summary>
+        /// A method adds EventHandler to PinAppRequestListener
+        /// </summary>
+        /// <param name="listener">The EventHandler for adding</param>
         public static void SetPinAppRequestListener(EventHandler<TVAppsEventArgs> listener)
         {
             PinAppRequestListener += listener;
         }
 
+        /// <summary>
+        /// A method will be called if a app is installed.
+        /// </summary>
+        /// <param name="pkgID">A package ID of newly installed.</param>
         public void OnAppInstalled(string pkgID)
         {
             DebuggingUtils.Dbg("[[[ App Installed ]]] " + pkgID);
@@ -82,6 +138,10 @@ namespace TVApps
             });
         }
 
+        /// <summary>
+        /// A method will be called if a app is uninstalled.
+        /// </summary>
+        /// <param name="pkgID">A package ID of uninstalled.</param>
         public void OnAppUninstalled(string pkgID)
         {
             DebuggingUtils.Dbg("[[[ App Uninstalled ]]] " + pkgID);
@@ -91,20 +151,33 @@ namespace TVApps
             });
         }
 
+        /// <summary>
+        /// A method will be called if the app gets a pin app App Control request.
+        /// </summary>
         public void OnPinAppRequestReceived()
         {
             DebuggingUtils.Dbg("[[[ Pin Add Request ]]] ");
             PinAppRequestListener.Invoke(this, new TVAppsEventArgs());
         }
 
+        /// <summary>
+        /// A method will be called if the app gets a app pinned notification App Control request.
+        /// </summary>
+        /// <param name="appID">A pinned app ID</param>/// <summary>
         public void OnAppPinnedNotificationReceived(string appID)
         {
         }
 
+        /// <summary>
+        /// A method will be called when the Home remote control key is pressed.
+        /// </summary>
         public void OnHomeKeyPressed()
         {
         }
 
+        /// <summary>
+        /// A method will be called when the Menu remote control key is pressed.
+        /// </summary>
         public void OnMenuKeyPressed()
         {
             DebuggingUtils.Dbg("[APPS] Menu Key is pressed");
index 867061831fb9c0386171a3426b4c602b6f9f772b..8631d95ef3934027f69edafe1049a127b4d35285 100644 (file)
  */
 
 using Xamarin.Forms;
-using TVApps.Controls;
 
 namespace TVApps.Views
 {
     /// <summary>
-    /// hahaha
+    /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Delete
     /// </summary>
     public partial class FooterDeleteStatus : Grid
     {
+        /// <summary>
+        /// A constructor
+        /// </summary>
         public FooterDeleteStatus()
         {
             InitializeComponent();
index 1f777c34a7dd865edaf82995d1e09550b061468d..744a4f4bdc93deb085630601227eb5c03ea9cf3d 100644 (file)
@@ -19,10 +19,13 @@ using Xamarin.Forms;
 namespace TVApps.Views
 {
     /// <summary>
-    /// hahaha
+    /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Default
     /// </summary>
     public partial class FooterNormalStatus : Grid
     {
+        /// <summary>
+        /// A constructor
+        /// </summary>
         public FooterNormalStatus()
         {
             InitializeComponent();
index d535e4adcb6fdca8c87b76dfcf574501565fcc48..e22237dbc9d9618fb6037f5e5c86a840355cd358 100644 (file)
@@ -19,17 +19,27 @@ using Xamarin.Forms;
 namespace TVApps.Views
 {
     /// <summary>
-    /// hahaha
+    /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Pin
     /// </summary>
     public partial class FooterPinStatus : Grid
     {
+        /// <summary>
+        /// Identifies the SumOfCheckedApp bindable property
+        /// </summary>
         public static readonly BindableProperty SumOfCheckedAppProperty = BindableProperty.Create("SumOfCheckedApp", typeof(int), typeof(FooterPinStatus), default(int));
+
+        /// <summary>
+        /// Gets or sets count of checked AppItemCell
+        /// </summary>
         public int SumOfCheckedApp
         {
             get { return (int)GetValue(SumOfCheckedAppProperty); }
             set { SetValue(SumOfCheckedAppProperty, value); }
         }
 
+        /// <summary>
+        /// A constructor
+        /// </summary>
         public FooterPinStatus()
         {
             InitializeComponent();
index 83b5481562c649cdc62433c9c77407e66adec06f..84d7a8677b7aaa7e4f2b836003736fce434b7f2a 100644 (file)
@@ -25,11 +25,18 @@ using System.Threading.Tasks;
 namespace TVApps.Views
 {
     /// <summary>
-    /// Root Page of TV Apps Application
+    /// A custom view for displaying main page of TV Apps
     /// </summary>
     public partial class MainPage : ContentPage
     {
+        /// <summary>
+        /// Identifies the CurrentStatus bindable property
+        /// </summary>
         public static readonly BindableProperty CurrentStatusProperty = BindableProperty.Create("CurrentStatus", typeof(AppsStatus), typeof(MainPage), default(AppsStatus));
+
+        /// <summary>
+        /// Gets or sets current status of MainPage
+        /// </summary>
         public AppsStatus CurrentStatus
         {
             get { return (AppsStatus)GetValue(CurrentStatusProperty); }
@@ -43,6 +50,9 @@ namespace TVApps.Views
         }
         */
 
+        /// <summary>
+        /// A method runs animation when TV Apps is started
+        /// </summary>
         private async void PlayShowAnimation()
         {
             await AppList.TranslateTo(0, 12, 0);
@@ -55,11 +65,15 @@ namespace TVApps.Views
             AppList.InitializeFocus();
         }
 
+        /// <summary>
+        /// A constructor
+        /// Adds PropertyChanged event handler and MenuKey event listener
+        /// </summary>
         public MainPage()
         {
             InitializeComponent();
-            PropertyChanged += MainPage_PropertyChanged;
-            SetCurrntStatus(AppsStatus.Default);
+            PropertyChanged += MainPagePropertyChanged;
+            SetCurrentStatus(AppsStatus.Default);
             PlayShowAnimation();
 
             // TODO: This code is temporary for menu option test
@@ -74,7 +88,12 @@ namespace TVApps.Views
             });
         }
 
-        private void SetCurrntStatus(AppsStatus status)
+        /// <summary>
+        /// A method sets current status of MainPage
+        /// Changes visibility of footers
+        /// </summary>
+        /// <param name="status">The next status name</param>
+        private void SetCurrentStatus(AppsStatus status)
         {
             switch (status)
             {
@@ -106,14 +125,24 @@ namespace TVApps.Views
             }
         }
 
-        private void MainPage_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        /// <summary>
+        /// This method is called when the properties of MainPage is changed
+        /// If CurrentStatus is changed, call SetCurrentStatus method
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when property of MainPage is changed</param>
+        private void MainPagePropertyChanged(object sender, PropertyChangedEventArgs e)
         {
             if (e.PropertyName.CompareTo("CurrentStatus") == 0)
             {
-                SetCurrntStatus(CurrentStatus);
+                SetCurrentStatus(CurrentStatus);
             }
         }
 
+        /// <summary>
+        /// A task for handling BackKey event
+        /// </summary>
+        /// <returns>Always returns true</returns>
         private async Task<bool> OnBackKeyPressedAtMain()
         {
             if (CurrentStatus != AppsStatus.Default)
@@ -138,6 +167,11 @@ namespace TVApps.Views
             return true;
         }
 
+        /// <summary>
+        /// This method is called when Back button is pressed
+        /// </summary>
+        /// <returns>Always returns true</returns>
+        /// <see cref="Page.OnBackButtonPressed"/>
         protected override bool OnBackButtonPressed()
         {
             SynchronizationContext.Current.Post(async (o) =>