[NUI] Make Transition public API
authorseungho <sbsh.baek@samsung.com>
Wed, 14 Apr 2021 05:58:20 +0000 (14:58 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 28 Apr 2021 03:36:30 +0000 (12:36 +0900)
Signed-off-by: seungho <sbsh.baek@samsung.com>
src/Tizen.NUI.Components/Controls/Navigation/ContentPage.cs
src/Tizen.NUI.Components/Controls/Navigation/Navigator.cs
src/Tizen.NUI.Components/Controls/Navigation/Page.cs
src/Tizen.NUI/src/public/Animation/Animation.cs
src/Tizen.NUI/src/public/Animation/TransitionOptions.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Common/TimePeriod.cs
src/Tizen.NUI/src/public/Transition/Transition.cs
src/Tizen.NUI/src/public/Transition/TransitionBase.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/PageTransitionSample.cs

index 3367c99..b526142 100755 (executable)
@@ -23,7 +23,7 @@ namespace Tizen.NUI.Components
     /// The ContentPage class is a class which is a formatted full screen page.
     /// ContentPage contains title app bar and content.
     /// </summary>
-    [EditorBrowsable(EditorBrowsableState.Never)]
+    /// <since_tizen> 9 </since_tizen>
     public class ContentPage : Page
     {
         private AppBar appBar = null;
@@ -32,7 +32,7 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Creates a new instance of a ContentPage.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public ContentPage() : base()
         {
             Layout = new AbsoluteLayout();
@@ -110,7 +110,7 @@ namespace Tizen.NUI.Components
         /// Content is positioned below AppBar.
         /// Content is resized to fill the full screen except AppBar.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public View Content
         {
             get
index aa42472..dd74203 100755 (executable)
@@ -24,30 +24,43 @@ namespace Tizen.NUI.Components
 {
     /// <summary>
     /// The Navigator is a class which navigates pages with stack methods such as Push and Pop.
-    ///
+    /// </summary>
+    /// <remarks>
     /// With Transition class, Navigator supports smooth transition of View pair between two Pages
-    /// by using PushWithTransition(Page) and PopWithTransition() methods.
-    /// If there is View pair of current top Page and next top Page those have same View.TransitionOptions.TransitionTag,
+    /// by using <see cref="PushWithTransition(Page)"/> and <see cref="PopWithTransition()"/> methods.
+    /// If current top Page and next top Page have <see cref="View"/>s those have same TransitionTag,
     /// Navigator creates smooth transition motion for them.
     /// Navigator.Transition property can be used to set properties of the Transition such as TimePeriod and AlphaFunction.
     /// When all transitions are finished, Navigator calls a callback methods those connected on the "TransitionFinished" event.
-    /// 
+    /// </remarks>
     /// <example>
     /// <code>
-    /// Navigator.Transition = new Transition()
+    /// Navigator navigator = new Navigator()
     /// {
-    ///     TimePeriod = new TimePeriod(0.5),
+    ///     TimePeriod = new TimePeriod(500),
     ///     AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOutSine)
-    /// }
+    /// };
+    ///
+    /// View view = new View()
+    /// {
+    ///     TransitionOptions = new TransitionOptions()
+    ///     {
+    ///         /* Set properties for the transition of this View */
+    ///     }
+    /// };
+    ///
+    /// ContentPage newPage = new ContentPage()
+    /// {
+    ///     Content = view,
+    /// };
     ///
     /// Navigator.PushWithTransition(newPage);
     /// </code>
     /// </example>
-    /// </summary>
-    [EditorBrowsable(EditorBrowsableState.Never)]
+    /// <since_tizen> 9 </since_tizen>
     public class Navigator : Control
     {
-        private static readonly float DefaultTransitionDuration = 0.5f;
+        private static readonly int DefaultTransitionDuration = 500;
 
         //This will be replaced with view transition class instance.
         private Animation curAnimation = null;
@@ -73,16 +86,16 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Creates a new instance of a Navigator.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public Navigator() : base()
         {
             Layout = new AbsoluteLayout();
         }
         
         /// <summary>
-        /// An event for the page disappearing signal which can be used to subscribe or unsubscribe the event handler provided by the user.
+        /// An event fired when Transition has been finished.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public event EventHandler<EventArgs> TransitionFinished;
 
         /// <summary>
@@ -92,9 +105,9 @@ namespace Tizen.NUI.Components
         public List<Page> NavigationPages { get; } = new List<Page>();
 
         /// <summary>
-        /// Transition properties for the transition of View pair those have same transition tag.
+        /// Transition properties for the transition of View pair having same transition tag.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public Transition Transition
         {
             set
@@ -113,7 +126,7 @@ namespace Tizen.NUI.Components
         /// </summary>
         /// <param name="page">The page to push to Navigator.</param>
         /// <exception cref="ArgumentNullException">Thrown when the argument page is null.</exception>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public void PushWithTransition(Page page)
         {
             if (!transitionFinished)
@@ -158,7 +171,7 @@ namespace Tizen.NUI.Components
         /// </summary>
         /// <returns>The popped page.</returns>
         /// <exception cref="InvalidOperationException">Thrown when there is no page in Navigator.</exception>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public Page PopWithTransition()
         {
             if (!transitionFinished)
@@ -570,8 +583,9 @@ namespace Tizen.NUI.Components
             };
 
             // default entering/exit transition - fast fade (half duration compaired with that of view pair transition)
-            float duration = (transition.TimePeriod.DurationSeconds + transition.TimePeriod.DelaySeconds) * 0.8f;
-            Animation fade = new Animation(duration);
+            int duration = (transition.TimePeriod.DurationMilliseconds + transition.TimePeriod.DelayMilliseconds);
+            float durationSeconds = (float)duration / 1000.0f;
+            Animation fade = new Animation(0.8f * durationSeconds);
             fade.AnimateTo(currentTopPage, "Opacity", 0.0f);
             KeyFrames keyframes = new KeyFrames();
             keyframes.Add(0.0f, 0.0f);
index 5601fad..012af9c 100755 (executable)
@@ -38,7 +38,7 @@ namespace Tizen.NUI.Components
     /// <summary>
     /// The Page class is a class which is an element of navigation.
     /// </summary>
-    [EditorBrowsable(EditorBrowsableState.Never)]
+    /// <since_tizen> 9 </since_tizen>
     public abstract class Page : Control
     {
         private Navigator navigator = null;
@@ -46,7 +46,7 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Creates a new instance of a Page.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public Page() : base()
         {
         }
index c363f7d..0ef29f9 100755 (executable)
@@ -693,7 +693,7 @@ namespace Tizen.NUI
                 }
 
                 var current = result;
-                using (var time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)))
+                using (var time = new TimePeriod(startTime, endTime - startTime))
                     while (current != null)
                     {
                         var targetValue = current.RefineValue(relativeValue) ?? throw new ArgumentException("Invalid " + nameof(relativeValue));
@@ -849,7 +849,7 @@ namespace Tizen.NUI
                 }
 
                 var current = result;
-                using (var time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)))
+                using (var time = new TimePeriod(startTime, endTime - startTime))
                     while (current != null)
                     {
                         var targetValue = current.RefineValue(destinationValue) ?? throw new ArgumentException("Invalid " + nameof(destinationValue));
@@ -939,7 +939,7 @@ namespace Tizen.NUI
                 }
 
                 var current = result;
-                using (var time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)))
+                using (var time = new TimePeriod(startTime, endTime - startTime))
                     while (current != null)
                     {
                         // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
@@ -985,7 +985,7 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
         {
-            TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
+            TimePeriod time = new TimePeriod(startTime, endTime - startTime);
             if (alphaFunction == null)
             {
                 Animate(view, path, forward, time);
index 1d2cdd3..803c4b2 100755 (executable)
@@ -24,11 +24,10 @@ namespace Tizen.NUI
     /// <summary>
     /// This TransitionOptions class is a class to control Transition motion.
     /// This class includes multiple options for the Transition.
-    /// NUI supports a kind of Transitions such as App transition, Page transition, and so on.
-    /// Some of options could be used only for the App transition or Page transition, but others could be used for multiple purpose.
+    /// NUI supports various kinds of Transitions such as App transition, Page transition, and so on.
     /// </summary>
     /// <seealso cref="NUIApplication.TransitionOptions" />
-    [EditorBrowsable(EditorBrowsableState.Never)]
+    /// <since_tizen> 9 </since_tizen>
     public class TransitionOptions : IDisposable
     {
         private bool disposed = false;
@@ -51,7 +50,7 @@ namespace Tizen.NUI
         /// <summary>
         /// Initializes the TransitionOptions class.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public TransitionOptions()
         {
         }
@@ -105,18 +104,20 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// During the Page transition, if two Views each of on the old top Page
-        /// and new top Page have same TransitionTag, the View on the old top Page
-        /// will be transition to the one of new top Page.
+        /// String tag to find View pair to be used in Page transition.
+        /// If there is a View have same TransitionTag in a next or previous Page.
+        /// The View will be pair for transition.
+        /// This is property for Page Transition.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public string TransitionTag { set; get; } = null;
 
         /// <summary>
+        /// Property for Page transition.
         /// A View could be transition with its child Views or without them.
         /// Default value is false
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public bool TransitionWithChild { set; get; } = false;
 
         /// <summary>
index 2cf66b7..e340ba6 100755 (executable)
@@ -2763,11 +2763,9 @@ namespace Tizen.NUI.BaseComponents
 
         /// <summary>
         /// Set or Get TransitionOptions for the page transition.
+        /// This property is used to define how this view will be transition during Page switching.
         /// </summary>
-        /// <remarks>
-        /// Hidden-API (Inhouse-API).
-        /// </remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public TransitionOptions TransitionOptions
         {
             set
index 336ce2b..e2b62a9 100755 (executable)
@@ -20,7 +20,11 @@ using global::System.ComponentModel;
 
 namespace Tizen.NUI
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
+    /// <summary>
+    /// TimePeriod is used to define delay and duration of a process such as <see cref="Transition"/>.
+    /// TimePeriod is composed of Delay and Duration in milliseconds
+    /// </summary>
+    /// <since_tizen> 9 </since_tizen>
     public class TimePeriod : Disposable
     {
         internal TimePeriod(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
@@ -37,48 +41,72 @@ namespace Tizen.NUI
             Interop.TimePeriod.DeleteTimePeriod(swigCPtr);
         }
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public TimePeriod(float durationSeconds) : this(Interop.TimePeriod.NewTimePeriod(durationSeconds), true)
+        /// <summary>
+        /// The constructor.
+        /// Creates an time peroid object with the user-defined alpha function.
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public TimePeriod(int durationMilliSeconds) : this(Interop.TimePeriod.NewTimePeriod((float)durationMilliSeconds / 1000.0f), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public TimePeriod(float delaySeconds, float durationSeconds) : this(Interop.TimePeriod.NewTimePeriod(delaySeconds, durationSeconds), true)
+        /// <summary>
+        /// The constructor.
+        /// Creates an time peroid object with the user-defined alpha function.
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public TimePeriod(float delayMilliSeconds, float durationMilliSeconds) : this(Interop.TimePeriod.NewTimePeriod((float)delayMilliSeconds / 1000.0f, (float)durationMilliSeconds / 1000.0f), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public float DelaySeconds
+        /// <summary>
+        /// A delay before the time period in milliseconds
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public int DelayMilliseconds
         {
             set
             {
-                Interop.TimePeriod.DelaySecondsSet(SwigCPtr, value);
+                Interop.TimePeriod.DelaySecondsSet(SwigCPtr, MilliSecondsToSeconds(value));
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             get
             {
-                float ret = Interop.TimePeriod.DelaySecondsGet(SwigCPtr);
+                int ret = SecondsToMilliSeconds(Interop.TimePeriod.DelaySecondsGet(SwigCPtr));
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;
             }
         }
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public float DurationSeconds
+        /// <summary>
+        /// The duration of the time period in milliseconds
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public int DurationMilliseconds
         {
             set
             {
-                Interop.TimePeriod.DurationSecondsSet(SwigCPtr, value);
+                Interop.TimePeriod.DurationSecondsSet(SwigCPtr, MilliSecondsToSeconds(value));
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             get
             {
-                float ret = Interop.TimePeriod.DurationSecondsGet(SwigCPtr);
+                int ret = SecondsToMilliSeconds(Interop.TimePeriod.DurationSecondsGet(SwigCPtr));
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;
             }
         }
+
+        private float MilliSecondsToSeconds(int millisec)
+        {
+            return (float)millisec / 1000.0f;
+        }
+
+        private int SecondsToMilliSeconds(float sec)
+        {
+            return (int)(sec * 1000);
+        }
     }
 }
index eca93cd..9cea5de 100644 (file)
@@ -22,14 +22,15 @@ namespace Tizen.NUI
     using Tizen.NUI.BaseComponents;
 
     /// <summary>
-    /// Transition class is a cluster of properties for the transition of View Pair.
-    /// Transition class will be used as a property of Navigator.Transition.
-    /// During page Transition each of View pair those have same TransitionTag will be move with same Navigator.Transition property.
+    /// Transition class is a cluster of properties for the transition of View pair.
     /// </summary>
-    [EditorBrowsable(EditorBrowsableState.Never)]
+    /// <since_tizen> 9 </since_tizen>
     public class Transition : TransitionBase
     {
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <summary>
+        /// Create a Transition for the View pair.
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
         public Transition()
         {
         }
index 04aaf60..7d7f137 100644 (file)
@@ -22,22 +22,28 @@ namespace Tizen.NUI
     using Tizen.NUI.BaseComponents;
 
     /// <summary>
-    /// TransitionBase class is a base class for each Transitions.
+    /// TransitionBase class is a base class for all Transition.
     /// Each Transition child classes inherits this base class.
     /// </summary>
-    [EditorBrowsable(EditorBrowsableState.Never)]
+    /// <since_tizen> 9 </since_tizen>
     public class TransitionBase : Disposable
     {
-        private static readonly float DefaultDuration = 0.5f;
-        protected internal AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default);
-        protected internal TimePeriod timePeriod = new TimePeriod(DefaultDuration);
+        private static readonly int DefaultDuration = 500;
+        private AlphaFunction alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default);
+        private TimePeriod timePeriod = new TimePeriod(DefaultDuration);
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <summary>
+        /// Create a TransitionBase
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
         public TransitionBase()
         {
         }
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <summary>
+        /// Set/Get the alpha function for a transition.
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
         public AlphaFunction AlphaFunction
         {
             set
@@ -50,7 +56,10 @@ namespace Tizen.NUI
             }
         }
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <summary>
+        /// Set/Get time period that contains delay and duration.
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
         public TimePeriod TimePeriod
         {
             set
@@ -68,6 +77,7 @@ namespace Tizen.NUI
             return new TransitionItemBase(target, isEntering, timePeriod, alphaFunction);
         }
 
+        [EditorBrowsable(EditorBrowsableState.Never)]
         protected override void Dispose(DisposeTypes type)
         {
             alphaFunction.Dispose();
index 3375fc7..42f9115 100755 (executable)
@@ -47,7 +47,7 @@ namespace Tizen.NUI.Samples
                 HeightResizePolicy = ResizePolicyType.FillToParent,
                 Transition = new Transition()
                 {
-                    TimePeriod = new TimePeriod(0.4f),
+                    TimePeriod = new TimePeriod(400),
                     AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOutSine),
                 },
             };