From: neostom432 <31119276+neostom432@users.noreply.github.com>
Date: Thu, 20 Feb 2020 01:13:22 +0000 (+0900)
Subject: [NUI] Add property LayoutWithTransition to LayoutItem (#1426)
X-Git-Tag: accepted/tizen/unified/20210219.040944~847
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=058e2211d27577afe9cde9a5db8f63c3b38688bf;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
[NUI] Add property LayoutWithTransition to LayoutItem (#1426)
Not every developer wants default transition effect in Layout.
For them, make property which can enable or disable transition effect.
Currently, default is false but can be changed.
This property only effects to chilren of Layout Owner.
---
diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutController.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutController.cs
index a4f2cb8..93fbef9 100755
--- a/src/Tizen.NUI/src/internal/Layouting/LayoutController.cs
+++ b/src/Tizen.NUI/src/internal/Layouting/LayoutController.cs
@@ -525,8 +525,8 @@ namespace Tizen.NUI
}
// Set up a default transitions, will be overwritten if inherited from parent or set explicitly.
- TransitionComponents positionTransitionComponents = CreateDefaultTransitionComponent(0, 0);
- TransitionComponents sizeTransitionComponents = CreateDefaultTransitionComponent(0, 0);
+ TransitionComponents positionTransitionComponents = CreateDefaultTransitionComponent(0, 300);
+ TransitionComponents sizeTransitionComponents = CreateDefaultTransitionComponent(0, 300);
bool matchedCustomTransitions = false;
diff --git a/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs
index 52138ca..bc3ec4e 100755
--- a/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs
+++ b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs
@@ -88,15 +88,27 @@ namespace Tizen.NUI
{
if( childLayout == layoutItem )
{
- if (! childLayout.IsReplaceFlag())
- {
- Window.Instance.LayoutController.AddToRemovalStack(childLayout);
- }
childLayout.ClearReplaceFlag();
LayoutChildren.Remove(childLayout);
- childLayout.ConditionForAnimation = childLayout.ConditionForAnimation | TransitionCondition.Remove;
- // Add LayoutItem to the transition stack so can animate it out.
- Window.Instance.LayoutController.AddTransitionDataEntry(new LayoutData(layoutItem, ConditionForAnimation, 0,0,0,0));
+
+ if (LayoutWithTransition)
+ {
+ if (!childLayout.IsReplaceFlag())
+ {
+ Window.Instance.LayoutController.AddToRemovalStack(childLayout);
+ }
+
+ childLayout.ConditionForAnimation = childLayout.ConditionForAnimation | TransitionCondition.Remove;
+ // Add LayoutItem to the transition stack so can animate it out.
+ Window.Instance.LayoutController.AddTransitionDataEntry(new LayoutData(layoutItem, ConditionForAnimation, 0, 0, 0, 0));
+ }
+ else
+ {
+ Interop.Actor.Actor_Remove(View.getCPtr(childLayout.Owner.Parent), View.getCPtr(childLayout.Owner));
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
// Reset condition for animation ready for next transition when required.
// SetFrame usually would do this but this LayoutItem is being removed.
childLayout.ConditionForAnimation = TransitionCondition.Unspecified;
diff --git a/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs b/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs
index b57889b..8d722f8 100755
--- a/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs
+++ b/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs
@@ -19,6 +19,7 @@
using System;
using System.Diagnostics;
using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
namespace Tizen.NUI
{
@@ -65,6 +66,14 @@ namespace Tizen.NUI
public View Owner{get; set;} // Should not keep a View alive.
///
+ /// [Draft] Use transition for layouting child
+ ///
+ /// 6
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool LayoutWithTransition{get; set;}
+
+ ///
/// [Draft] Margin for this LayoutItem
///
/// 6
@@ -136,6 +145,7 @@ namespace Tizen.NUI
private void Initialize()
{
+ LayoutWithTransition = false;
_layoutPositionData = new LayoutData(this,TransitionCondition.Unspecified,0,0,0,0);
_padding = new Extents(0,0,0,0);
_margin = new Extents(0,0,0,0);
@@ -518,7 +528,16 @@ namespace Tizen.NUI
" right:" + _layoutPositionData.Right +
" bottom:" + _layoutPositionData.Bottom );
- Window.Instance.LayoutController.AddTransitionDataEntry(_layoutPositionData);
+ if (Owner.Parent != null && Owner.Parent.Layout != null && Owner.Parent.Layout.LayoutWithTransition)
+ {
+ Window.Instance.LayoutController.AddTransitionDataEntry(_layoutPositionData);
+ }
+ else
+ {
+ Owner.Size = new Size(right - left, bottom - top, Owner.Position.Z);
+ Owner.Position = new Position(left, top, Owner.Position.Z);
+ }
+
// Reset condition for animation ready for next transition when required.
ConditionForAnimation = TransitionCondition.Unspecified;