diff options
author | dongsug-song <35130733+dongsug-song@users.noreply.github.com> | 2019-09-25 16:52:31 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-25 16:52:31 +0900 |
commit | 66750919753250274542768d7b4aadb7c1813744 (patch) | |
tree | afc9089dd24c3467826887c55f361ed77b886396 | |
parent | 5cc361123465e81e17efe13bfd37d6472c61590b (diff) | |
download | tizenfx-66750919753250274542768d7b4aadb7c1813744.tar.gz tizenfx-66750919753250274542768d7b4aadb7c1813744.tar.bz2 tizenfx-66750919753250274542768d7b4aadb7c1813744.zip |
[NUI] Integration from dalihub (#1039)
* [NUI] Add UPATE_SIZE_HINT property
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Make public-API as Hidden-API before ACR
-View::RotateBy
-Touch::GetAngle
Required for handling rotation of objects.
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Modify BackgroundImageSynchronosLoading issue
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI]Fix UPDATE_SIZE_HINT crash issue
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Fix transition inheritance from parent
Change of logic so if child has a transition for the condition
then don't copy parents.
Previously only checked if transitions list was empty.
Change-Id: If168d493b70e236fc22845bb0a09e4e6ff5ca77a
* [NUI] Overriding Animation API
Change-Id: Ief7d52b1108729f0216c11d495770be2af2920d1
* [NUI] Layout Animation fix
Change-Id: I85fbb7af0e86860d3d2d667796b89ba29944b384
-rwxr-xr-x | src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs | 3 | ||||
-rwxr-xr-x | src/Tizen.NUI/src/internal/Layouting/LayoutController.cs | 90 | ||||
-rwxr-xr-x | src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs | 2 | ||||
-rwxr-xr-x | src/Tizen.NUI/src/public/BaseComponents/View.cs | 76 | ||||
-rwxr-xr-x | src/Tizen.NUI/src/public/Touch.cs | 4 |
5 files changed, 136 insertions, 39 deletions
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs index e765988da..5d8205d7c 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs @@ -49,6 +49,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_View_Property_DOWN_FOCUSABLE_ACTOR_ID_get")] public static extern int View_Property_DOWN_FOCUSABLE_ACTOR_ID_get(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_UPDATE_SIZE_HINT_get")] + public static extern int View_Property_UPDATE_SIZE_HINT_get(); } } }
\ No newline at end of file diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutController.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutController.cs index 249f99dc5..8b3017ecc 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutController.cs +++ b/src/Tizen.NUI/src/internal/Layouting/LayoutController.cs @@ -20,6 +20,7 @@ using System.Runtime.InteropServices; using System.Collections.Generic; using System.Diagnostics; using System; +using System.ComponentModel; namespace Tizen.NUI { @@ -38,6 +39,9 @@ namespace Tizen.NUI event Callback _instance; + // A Flag to check if it is already disposed. + private bool disposed = false; + private Window _window; Animation _coreAnimation; @@ -90,6 +94,40 @@ namespace Tizen.NUI } /// <summary> + /// Get the Layouting animation object that transitions layouts and content. + /// Use OverrideCoreAnimation to explicitly control Playback. + /// </summary> + /// <returns> The layouting core Animation. </returns> + [EditorBrowsable(EditorBrowsableState.Never)] + public Animation GetCoreAnimation() + { + return _coreAnimation; + } + + /// <summary> + /// Set or Get Layouting core animation override property. + /// Gives explicit control over the Layouting animation playback if set to True. + /// Reset to False if explicit control no longer required. + /// </summary> + [EditorBrowsable(EditorBrowsableState.Never)] + public bool OverrideCoreAnimation {get;set;} = false; + + /// <summary> + /// Destructor which adds LayoutController to the Dispose queue. + /// </summary> + ~LayoutController() + { + } + + /// <summary> + /// Explict Dispose. + /// </summary> + public void Dispose() + { + Dispose(DisposeTypes.Explicit); + } + + /// <summary> /// Add transition data for a LayoutItem to the transition stack. /// </summary> /// <param name="transitionDataEntry">Transition data for a LayoutItem.</param> @@ -252,7 +290,7 @@ namespace Tizen.NUI bool readyToPlay = SetupCoreAnimation(); - if (readyToPlay) + if (readyToPlay && OverrideCoreAnimation==false) { PlayAnimation(); } @@ -311,8 +349,8 @@ namespace Tizen.NUI /// </summary> private void PlayAnimation() { + Debug.WriteLineIf( LayoutDebugController, "LayoutController Playing, Core Duration:" + _coreAnimation.Duration); _coreAnimation.Play(); - Debug.WriteLineIf( LayoutDebugController, "LayoutController Core Duration:" + _coreAnimation.Duration); } private void AnimationFinished(object sender, EventArgs e) @@ -345,6 +383,8 @@ namespace Tizen.NUI // of the other stack. Then the main removal stack iterated when AnimationFinished // occurs again. } + Debug.WriteLineIf( LayoutDebugController, "LayoutController AnimationFinished"); + _coreAnimation?.Clear(); } /// <summary> @@ -356,9 +396,15 @@ namespace Tizen.NUI // Initialize animation for this layout run. bool animationPending = false; + Debug.WriteLineIf( LayoutDebugController, + "LayoutController SetupCoreAnimation for:" + _layoutTransitionDataQueue.Count); + if (_layoutTransitionDataQueue.Count > 0 ) // Something to animate { - _coreAnimation = new Animation(); + if (!_coreAnimation) + { + _coreAnimation = new Animation(); + } _coreAnimation.EndAction = Animation.EndActions.StopFinal; _coreAnimation.Finished += AnimationFinished; @@ -419,6 +465,13 @@ namespace Tizen.NUI sizeTransitionComponents.Delay, sizeTransitionComponents.Duration, sizeTransitionComponents.AlphaFunction); + + Debug.WriteLineIf( LayoutDebugController, + "LayoutController SetupAnimationForSize View:" + layoutPositionData.Item.Owner.Name + + " width:" + (layoutPositionData.Right-layoutPositionData.Left) + + " height:" + (layoutPositionData.Bottom-layoutPositionData.Top) + + " delay:" + sizeTransitionComponents.Delay + + " duration:" + sizeTransitionComponents.Duration ); } } @@ -493,22 +546,23 @@ namespace Tizen.NUI bool matchedCustomTransitions = false; - // Inherit parent transitions if none already set on View for the condition. - // Transitions set on View rather than LayoutItem so if the Layout changes the transition persist. TransitionList transitionsForCurrentCondition = new TransitionList(); + // Note, Transitions set on View rather than LayoutItem so if the Layout changes the transition persist. - ILayoutParent layoutParent = layoutPositionData.Item.GetParent(); - if (layoutParent !=null) + // Check if item to animate has it's own Transitions for this condition. + // If a key exists then a List of atleast 1 transition exists. + if (layoutPositionData.Item.Owner.LayoutTransitions.ContainsKey(conditionForAnimators)) { - // Check if item to animate has it's own Transitions for this condition. - // If a key exists then a List of atleast 1 transition exists. - if ( layoutPositionData.Item.Owner.LayoutTransitions.ContainsKey(conditionForAnimators)) - { - // Child has transitions for the condition - matchedCustomTransitions = layoutPositionData.Item.Owner.LayoutTransitions.TryGetValue(conditionForAnimators, out transitionsForCurrentCondition); - } - else + // Child has transitions for the condition + matchedCustomTransitions = layoutPositionData.Item.Owner.LayoutTransitions.TryGetValue(conditionForAnimators, out transitionsForCurrentCondition); + } + + if (!matchedCustomTransitions) + { + // Inherit parent transitions as none already set on View for the condition. + ILayoutParent layoutParent = layoutPositionData.Item.GetParent(); + if (layoutParent !=null) { // Item doesn't have it's own transitions for this condition so copy parents if // has a parent with transitions. @@ -520,13 +574,13 @@ namespace Tizen.NUI // Copy parent transitions to temporary TransitionList. List contains transitions for the current condition. LayoutTransitionsHelper.CopyTransitions(parentTransitionList, transitionsForCurrentCondition); - - matchedCustomTransitions = false; // Using parent transition as no custom match. } } } - // Position/Size transitions can be for a layout changing to another layout or an item being added or removed. + + // Position/Size transitions can be displayed for a layout changing to another layout or an item being added or removed. + // There can only be one position transition and one size position, they will be replaced if set multiple times. // transitionsForCurrentCondition represent all non position (custom) properties that should be animated. diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs index ba97aef14..c45dc445d 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs +++ b/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs @@ -529,7 +529,7 @@ namespace Tizen.NUI " left:" + _layoutPositionData.Left + " top:" + _layoutPositionData.Top + " right:" + _layoutPositionData.Right + - " bottom:" + _layoutPositionData.Right ); + " bottom:" + _layoutPositionData.Bottom ); Window.Instance.LayoutController.AddTransitionDataEntry(_layoutPositionData); diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 83739231f..3d3f64e17 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -127,6 +127,7 @@ namespace Tizen.NUI.BaseComponents if (newValue != null) { Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, new Tizen.NUI.PropertyValue((string)newValue)); + view.BackgroundImageSynchronosLoading = view._backgroundImageSynchronosLoading; } }, defaultValueCreator: (bindable) => @@ -1258,6 +1259,26 @@ namespace Tizen.NUI.BaseComponents Tizen.NUI.Object.GetProperty(view.swigCPtr, View.Property.MARGIN).Get(temp); return temp; }); + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty UpdateSizeHintProperty = BindableProperty.Create("UpdateSizeHint", typeof(Vector2), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty(view.swigCPtr, Interop.ViewProperty.View_Property_UPDATE_SIZE_HINT_get(), new Tizen.NUI.PropertyValue((Vector2)newValue)); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + + Vector2 temp = new Vector2(0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(view.swigCPtr, Interop.ViewProperty.View_Property_UPDATE_SIZE_HINT_get()).Get(temp); + return temp; + }); + /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty XamlStyleProperty = BindableProperty.Create("XamlStyle", typeof(Style), typeof(View), default(Style), propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable)._mergedStyle.Style = (Style)newvalue); @@ -3615,23 +3636,22 @@ namespace Tizen.NUI.BaseComponents } set { - if (value != _backgroundImageSynchronosLoading) + _backgroundImageSynchronosLoading = value; + string bgUrl = ""; + int visualType = 0; + Background.Find(Visual.Property.Type)?.Get(out visualType); + if (visualType == (int)Visual.Type.Image) + { + Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl); + } + + if (bgUrl.Length != 0) { - string bgUrl = ""; PropertyMap bgMap = this.Background; - int visualType = 0; - bgMap.Find(Visual.Property.Type)?.Get(out visualType); - if (visualType == (int)Visual.Type.Image) - { - bgMap.Find(ImageVisualProperty.URL)?.Get(out bgUrl); - } - if (bgUrl.Length != 0) - { - _backgroundImageSynchronosLoading = value; - bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading)); - this.Background = bgMap; - } + bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading)); + Background = bgMap; } + } } @@ -4053,7 +4073,6 @@ namespace Tizen.NUI.BaseComponents public override void Add(View child) { bool hasLayout = (_layout != null); - Log.Info("NUI", "Add:" + child.Name + " to View:" + Name + " which has layout[" + hasLayout + "] + \n"); if (null == child) { @@ -4100,7 +4119,6 @@ namespace Tizen.NUI.BaseComponents return; bool hasLayout = (_layout != null); - Log.Info("NUI","Removing View:" + child.Name + " layout[" + hasLayout.ToString() +"]\n"); // If View has a layout then do a deferred child removal // Actual child removal is performed by the layouting system so @@ -4855,21 +4873,27 @@ namespace Tizen.NUI.BaseComponents throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal void RotateBy(Degree angle, Vector3 axis) + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void RotateBy(Degree angle, Vector3 axis) { Interop.ActorInternal.Actor_RotateBy__SWIG_0(swigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal void RotateBy(Radian angle, Vector3 axis) + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void RotateBy(Radian angle, Vector3 axis) { Interop.ActorInternal.Actor_RotateBy__SWIG_1(swigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal void RotateBy(Rotation relativeRotation) + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void RotateBy(Rotation relativeRotation) { Interop.ActorInternal.Actor_RotateBy__SWIG_2(swigCPtr, Rotation.getCPtr(relativeRotation)); if (NDalicPINVOKE.SWIGPendingException.Pending) @@ -5941,6 +5965,20 @@ namespace Tizen.NUI.BaseComponents } } + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Vector2 UpdateSizeHint + { + get + { + return (Vector2)GetValue(UpdateSizeHintProperty); + } + set + { + SetValue(UpdateSizeHintProperty, value); + NotifyPropertyChanged(); + } + } private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>(); diff --git a/src/Tizen.NUI/src/public/Touch.cs b/src/Tizen.NUI/src/public/Touch.cs index 88344e573..35dc6a2b4 100755 --- a/src/Tizen.NUI/src/public/Touch.cs +++ b/src/Tizen.NUI/src/public/Touch.cs @@ -234,7 +234,9 @@ namespace Tizen.NUI return ret; } - internal Degree GetAngle(uint point) + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Degree GetAngle(uint point) { Degree ret = new Degree(Interop.Touch.Touch_GetAngle(swigCPtr, point), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); |