[Tizen] animation callback dispose fix & remove version check
authorminho.sun <minho.sun@samsung.com>
Mon, 14 Aug 2017 09:48:24 +0000 (18:48 +0900)
committerminho.sun <minho.sun@samsung.com>
Mon, 14 Aug 2017 09:48:24 +0000 (18:48 +0900)
This reverts commit 2f5f1184676560a67ede87e0942589b459f95f9a.

Change-Id: I91616ed0b0fb67fa00e386d4adab23073e2000bf

src/Tizen.NUI/src/internal/Application.cs
src/Tizen.NUI/src/public/Animation.cs
src/Tizen.NUI/src/public/Window.cs

index d43c6ad..9a3c950 100755 (executable)
@@ -20,18 +20,6 @@ namespace Tizen.NUI
     using System;
     using System.Runtime.InteropServices;
 
-    //This version should be updated and synced for every Dali native release
-    internal static class Version
-    {
-        public const int ver1 = 1;
-        public const int ver2 = 2;
-        public const int ver3 = 46;
-        public const int nuiVer1 = 0;
-        public const int nuiVer2 = 2;
-        public const int nuiVer3 = 47;
-        public const string nuiRelease = "";
-    }
-
     /**
       * @brief Event arguments that passed via NUIApplicationInit signal
       *
@@ -1133,37 +1121,6 @@ namespace Tizen.NUI
 
         public static Application NewApplication(string stylesheet, Application.WindowMode windowMode)
         {
-            {
-                int ver1 = -1;
-                int ver2 = -1;
-                int ver3 = -1;
-
-                try
-                {
-                    if (NDalicManualPINVOKE.NativeVersionCheck(ref ver1, ref ver2, ref ver3))
-                    {
-                        if (ver1 != Version.ver1 || ver2 != Version.ver2 || ver3 != Version.ver3)
-                        {
-                            //throw new System.InvalidOperationException("Dali native version mismatch error! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3 + " but dali=" + ver1 + "." + ver2 + "." + ver3);
-                            NUILog.Error("Dali native version mismatch error! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease + " but native dali=" + ver1 + "." + ver2 + "." + ver3);
-                        }
-                    }
-                    else
-                    {
-                        //throw new System.InvalidOperationException("Dali native version mismatch error! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3 + " but dali=" + ver1 + "." + ver2 + "." + ver3);
-                        NUILog.Error("Dali native version mismatch error! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease + " but native dali=" + ver1 + "." + ver2 + "." + ver3);
-                    }
-                }
-                catch (Exception exc)
-                {
-                    //throw new System.InvalidOperationException("Dali native version is very old! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3);
-                    NUILog.Error("Dali native version is very old! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease);
-                    NUILog.Error("exception occured! =" + exc.Message);
-                }
-                NUILog.Debug(" Dali native version=" + ver1 + "." + ver2 + "." + ver3 + "      NUI version=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease);
-            }
-            NUILog.Debug(" NewApplication(string stylesheet, Application.WindowMode windowMode) is called! ");
-
             // register all Views with the type registry, so that can be created / styled via JSON
             //ViewRegistryHelper.Initialize(); //moved to Application side.
 
index d023cf3..6bdfc08 100755 (executable)
@@ -58,24 +58,11 @@ namespace Tizen.NUI
                 //Called by User
                 //Release your own managed resources here.
                 //You should release all of your own disposable objects here.
-                NUILog.Debug("Animation.Dispose(Explicit)! GetState=" + this.GetState());
-                if(this.GetState() != States.Stopped)
-                {
-                    this.Clear();
-                    this.Reset();
-                    NUILog.Error("Now Animation is playing! Clear and Reset here!");
-                }
+
             }
             else if(type == DisposeTypes.Implicit)
             {
-                NUILog.Debug("Animation.Dispose(Implicit)! GetState=" + this.GetState());
-                if(this.GetState() != States.Stopped)
-                {
-                    this.Clear();
-                    this.Reset();
-                    NUILog.Error("Now Animation is playing! Clear and Reset here!");
-                    //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
-                }
+
             }
 
             if (_animationFinishedEventCallback != null)
@@ -89,6 +76,14 @@ namespace Tizen.NUI
                 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
             }
 
+            if(this)
+            {
+                this.Clear();
+                this.Reset();
+                NUILog.Error("Now Animation is playing! Clear and Reset here!");
+                //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
+            }
+
             //Release your own unmanaged resources here.
             //You should not access any managed member here except static instance.
             //because the execution order of Finalizes is non-deterministic.
@@ -133,18 +128,11 @@ namespace Tizen.NUI
             {
                 if (_animationFinishedEventHandler == null)
                 {
-#if DEBUG_ON
-                    Tizen.Log.Debug("NUI", "con1) FinishedSignal().Empty = " + FinishedSignal().Empty());
-                    Tizen.Log.Debug("NUI", "con2) FinishedSignal().GetConnectionCount = " + FinishedSignal().GetConnectionCount());
-#endif
+                    NUILog.Debug("[add before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
                     _animationFinishedEventCallback = OnFinished;
                     FinishedSignal().Connect(_animationFinishedEventCallback);
-#if DEBUG_ON
-                    Tizen.Log.Debug("NUI", "con3) FinishedSignal().Empty = " + FinishedSignal().Empty());
-                    Tizen.Log.Debug("NUI", "con4) FinishedSignal().GetConnectionCount = " + FinishedSignal().GetConnectionCount());
-#endif
+                    NUILog.Debug("[add after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
                 }
-
                 _animationFinishedEventHandler += value;
             }
             remove
@@ -153,15 +141,9 @@ namespace Tizen.NUI
 
                 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
                 {
-#if DEBUG_ON
-                    Tizen.Log.Debug("NUI", "discon1) FinishedSignal().Empty = " + FinishedSignal().Empty());
-                    Tizen.Log.Debug("NUI", "discon2) FinishedSignal().GetConnectionCount = " + FinishedSignal().GetConnectionCount());
-#endif
+                    NUILog.Debug("[remove before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
                     FinishedSignal().Disconnect(_animationFinishedEventCallback);
-#if DEBUG_ON
-                    Tizen.Log.Debug("NUI", "discon3) FinishedSignal().Empty = " + FinishedSignal().Empty());
-                    Tizen.Log.Debug("NUI", "discon4) FinishedSignal().GetConnectionCount = " + FinishedSignal().GetConnectionCount());
-#endif
+                    NUILog.Debug("[remove after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
                 }
             }
         }
@@ -188,16 +170,10 @@ namespace Tizen.NUI
             {
                 if (_animationProgressReachedEventHandler == null)
                 {
-#if DEBUG_ON
-                    Tizen.Log.Debug("NUI", "con1) ProgressReachedSignal().Empty = " + ProgressReachedSignal().Empty());
-                    Tizen.Log.Debug("NUI", "con2) ProgressReachedSignal().GetConnectionCount = " + ProgressReachedSignal().GetConnectionCount());
-#endif
+                    NUILog.Debug("[add before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
                     _animationProgressReachedEventCallback = OnProgressReached;
                     ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
-#if DEBUG_ON
-                    Tizen.Log.Debug("NUI", "con3) ProgressReachedSignal().Empty = " + ProgressReachedSignal().Empty());
-                    Tizen.Log.Debug("NUI", "con4) ProgressReachedSignal().GetConnectionCount = " + ProgressReachedSignal().GetConnectionCount());
-#endif
+                    NUILog.Debug("[add after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
                 }
 
                 _animationProgressReachedEventHandler += value;
@@ -208,15 +184,9 @@ namespace Tizen.NUI
 
                 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
                 {
-#if DEBUG_ON
-                    Tizen.Log.Debug("NUI", "discon1) ProgressReachedSignal().Empty = " + ProgressReachedSignal().Empty());
-                    Tizen.Log.Debug("NUI", "discon2) ProgressReachedSignal().GetConnectionCount = " + ProgressReachedSignal().GetConnectionCount());
-#endif
+                    NUILog.Debug("[remove before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
                     ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
-#if DEBUG_ON
-                    Tizen.Log.Debug("NUI", "discon3) ProgressReachedSignal().Empty = " + ProgressReachedSignal().Empty());
-                    Tizen.Log.Debug("NUI", "discon4) ProgressReachedSignal().GetConnectionCount = " + ProgressReachedSignal().GetConnectionCount());
-#endif
+                    NUILog.Debug("[remove after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
                 }
             }
         }
index 53a1dca..020ea72 100755 (executable)
@@ -144,14 +144,20 @@ namespace Tizen.NUI
             return ret;
        }
 
-        [Obsolete("Please do not use! this will be internal method")]
+        /// <summary>
+        /// Sets whether window accepts focus or not.
+        /// </summary>
+        /// <param name="accept">If focus is accepted or not. Default is true.</param>
         public void SetAcceptFocus(bool accept)
         {
             NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        [Obsolete("Please do not use! this will be internal method")]
+        /// <summary>
+        /// Returns whether window accepts focus or not.
+        /// </summary>
+        /// <returns>True if the window accept focus, false otherwise</returns>
         public bool IsFocusAcceptable()
         {
             return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
@@ -1387,7 +1393,7 @@ namespace Tizen.NUI
         private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
         private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
 
-        [Obsolete("Please do not use! this will be deprecated")]
+        [Obsolete("Please do not use! this will be deprecated. Please use 'FocusChanged' event instead")]
         public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
         {
             add