From 3f081c3f9b31ca4d3f084376c1c37837c9af3511 Mon Sep 17 00:00:00 2001 From: dongsug-song <35130733+dongsug-song@users.noreply.github.com> Date: Fri, 26 Jul 2019 10:41:03 +0900 Subject: [PATCH] [NUI] Add StopBehavior, LoopMode of AnimatedVectorImageView (#946) --- .../src/internal/DaliEnumConstants.cs | 12 +- .../BaseComponents/AnimatedVectorImageView.cs | 230 +++++++++++++----- .../BaseComponents/VectorAnimationView.cs | 105 ++++++-- src/Tizen.NUI/src/public/NUIConstants.cs | 22 ++ 4 files changed, 286 insertions(+), 83 deletions(-) diff --git a/src/Tizen.NUI/src/internal/DaliEnumConstants.cs b/src/Tizen.NUI/src/internal/DaliEnumConstants.cs index 966cf10f8..a6af93c0f 100755 --- a/src/Tizen.NUI/src/internal/DaliEnumConstants.cs +++ b/src/Tizen.NUI/src/internal/DaliEnumConstants.cs @@ -220,7 +220,7 @@ namespace Tizen.NUI internal class NUILog { - [Conditional("DEBUG_ON")] + [Conditional("NUI_DEBUG_ON")] public static void Debug(string msg, [CallerLineNumber] int lineNum = 0, [CallerMemberName] string caller = null, @@ -240,4 +240,12 @@ namespace Tizen.NUI } } -} // namesapce Dali +#if !(NUI_DEBUG_ON) + internal class tlog + { + internal static void Fatal(string tag, string msg) { } + internal static void Error(string tag, string msg) { } + } +#endif + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs index 5467107a7..5d8e98de0 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs @@ -18,7 +18,9 @@ using global::System; using global::System.Runtime.InteropServices; using System.ComponentModel; -using tizenlog = Tizen.Log; +#if (NUI_DEBUG_ON) +using tlog = Tizen.Log; +#endif namespace Tizen.NUI.BaseComponents { @@ -37,12 +39,12 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public AnimatedVectorImageView() : base() { - NUILog.Debug($"AnimatedVectorImageView() constructor!"); + tlog.Fatal(tag, $" <<< AnimatedVectorImageView() constructor GetId={GetId()} >>>"); currentStates.url = ""; currentStates.frame = -1; currentStates.loopCount = 0; - currentStates.loopMode = LoopModes.Forward; - //currentStates.stopEndAction = EndActions.Cancel; + currentStates.loopMode = LoopingModeType.Restart; + currentStates.stopEndAction = StopBehaviorType.CurrentFrame; currentStates.framePlayRangeMin = -1; currentStates.framePlayRangeMax = -1; currentStates.changed = false; @@ -59,6 +61,7 @@ namespace Tizen.NUI.BaseComponents public AnimatedVectorImageView(float scale) : this() { currentStates.scale = scale; + tlog.Fatal(tag, $" <<< AnimatedVectorImageView(scale={scale}) constructor GetId={GetId()} >>>"); } /// @@ -74,7 +77,7 @@ namespace Tizen.NUI.BaseComponents return; } - NUILog.Debug($"Dispose(type={type})!"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.Dispose(type={type})!"); if (type == DisposeTypes.Explicit) { @@ -92,10 +95,11 @@ namespace Tizen.NUI.BaseComponents { VisualEventSignal().Disconnect(visualEventSignalCallback); finishedEventHandler = null; - NUILog.Debug($"disconnect event signal"); + tlog.Fatal(tag, $"disconnect event signal"); } base.Dispose(type); + tlog.Fatal(tag, $" [{GetId()}]AnimatedVectorImageView.Dispose(type={type}) >>>"); } #endregion Constructor, Distructor, Dispose @@ -110,23 +114,25 @@ namespace Tizen.NUI.BaseComponents { set { - NUILog.Debug($"URL set! value={value}"); string ret = (value == null ? "" : value); currentStates.url = ret; currentStates.changed = true; + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.URL SET url={currentStates.url} >>>"); + PropertyMap map = new PropertyMap(); map.Add(Visual.Property.Type, new PropertyValue((int)DevelVisual.Type.AnimatedVectorImage)) .Add(ImageVisualProperty.URL, new PropertyValue(currentStates.url)) - .Add(ImageVisualProperty.LoopCount, new PropertyValue(currentStates.loopCount)); - //.Add(ImageVisualProperty.StopEndAction, new PropertyValue((int)currentStates.stopEndAction)) - //.Add(ImageVisualProperty.LoopMode, new PropertyValue((int)currentStates.loopMode)); + .Add(ImageVisualProperty.LoopCount, new PropertyValue(currentStates.loopCount)) + .Add(ImageVisualProperty.StopBehavior, new PropertyValue((int)currentStates.stopEndAction)) + .Add(ImageVisualProperty.LoopingMode, new PropertyValue((int)currentStates.loopMode)); Image = map; } get { - string ret = ResourceUrl; - NUILog.Debug($"URL get! base ret={ret}, Name={Name}"); + string ret = currentStates.url; + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.URL GET"); + PropertyMap map = Image; if (map != null) { @@ -135,12 +141,12 @@ namespace Tizen.NUI.BaseComponents { if (val.Get(out ret)) { - NUILog.Debug($"gotten url={ret}"); + tlog.Fatal(tag, $" gotten url={ret} >>>"); return ret; } } } - tizenlog.Error(tag, "[ERROR] fail to get URL from dali"); + tlog.Error(tag, $" [ERROR][{GetId()}](AnimatedVectorImageView) Fail to get URL from dali >>>"); return ret; } } @@ -167,7 +173,7 @@ namespace Tizen.NUI.BaseComponents } } } - tizenlog.Error(tag, $"[ERROR] fail to get PlayState from dali"); + tlog.Error(tag, $" [ERROR][{GetId()}](AnimatedVectorImageView) Fail to get PlayState from dali"); return (PlayStateType)ret; } } @@ -190,13 +196,13 @@ namespace Tizen.NUI.BaseComponents { if (val.Get(out ret)) { - NUILog.Debug($"TotalFrameNumber get! ret={ret}"); + //tlog.Fatal(tag, $"TotalFrameNumber get! ret={ret}"); currentStates.totalFrame = ret; return ret; } } } - tizenlog.Error(tag, $"[ERROR] fail to get TotalFrameNumber from dali"); + tlog.Error(tag, $" [ERROR][{GetId()}](AnimatedVectorImageView) Fail to get TotalFrameNumber from dali"); return ret; } } @@ -211,7 +217,7 @@ namespace Tizen.NUI.BaseComponents set { currentStates.frame = value; - NUILog.Debug($"set CurrentFrameNumber={currentStates.frame}"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.CurrentFrameNumber SET frame={currentStates.frame} >>>"); DoAction(vectorImageVisualIndex, (int)actionType.jumpTo, new PropertyValue(currentStates.frame)); } get @@ -225,12 +231,12 @@ namespace Tizen.NUI.BaseComponents { if (val.Get(out ret)) { - NUILog.Debug($"CurrentFrameNumber get! val={ret}"); + //tlog.Fatal(tag, $"CurrentFrameNumber get! val={ret}"); return ret; } } } - tizenlog.Error(tag, $"[ERROR] fail to get CurrentFrameNumber from dali!! ret={ret}"); + tlog.Error(tag, $" [ERROR][{GetId()}](AnimatedVectorImageView) Fail to get CurrentFrameNumber from dali!! ret={ret}"); return ret; } } @@ -240,43 +246,41 @@ namespace Tizen.NUI.BaseComponents /// // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) [EditorBrowsable(EditorBrowsableState.Never)] - public LoopModes LoopMode + public LoopingModeType LoopMode { set { - currentStates.loopMode = (LoopModes)value; + currentStates.loopMode = (LoopingModeType)value; currentStates.changed = true; - - NUILog.Debug($"LoopMode set val={currentStates.loopMode}"); - //PropertyMap map = new PropertyMap(); - //map.Add(ImageVisualProperty.LoopMode, new PropertyValue((int)currentStates.loopMode)); - //DoAction(vectorImageVisualIndex, (int)actionType.updateProperty, new PropertyValue(map)); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.LoopMode SET loopMode={currentStates.loopMode} >>>"); + PropertyMap map = new PropertyMap(); + map.Add(ImageVisualProperty.LoopingMode, new PropertyValue((int)currentStates.loopMode)); + DoAction(vectorImageVisualIndex, (int)actionType.updateProperty, new PropertyValue(map)); } get { - NUILog.Debug($"LoopMode get!"); + //tlog.Fatal(tag, $"LoopMode get!"); PropertyMap map = base.Image; var ret = 0; - //if (map != null) - //{ - // PropertyValue val = map.Find(ImageVisualProperty.LoopMode); - // if (val != null) - // { - // if (val.Get(out ret)) - // { - // NUILog.Debug($"gotten LoopMode={ret}"); - // if (ret != (int)currentStates.loopMode && ret > 0) - // { - // NUILog.Debug($"different LoopMode! gotten={ret}, loopMode={currentStates.loopMode}"); - // return (int)currentStates.loopMode; - // } - // return ret; - // } - // } - //} - tizenlog.Error(tag, "[ERROR] fail to get loopMode from dali"); - return (LoopModes)ret; + if (map != null) + { + PropertyValue val = map.Find(ImageVisualProperty.LoopingMode); + if (val != null) + { + if (val.Get(out ret)) + { + //tlog.Fatal(tag, $"gotten LoopMode={ret}"); + if (ret != (int)currentStates.loopMode && ret > 0) + { + tlog.Fatal(tag, $" [ERROR][{GetId()}](AnimatedVectorImageView) different LoopMode! gotten={ret}, loopMode={currentStates.loopMode}"); + } + return (LoopingModeType)ret; + } + } + } + tlog.Error(tag, $" [ERROR][{GetId()}](AnimatedVectorImageView) Fail to get loopMode from dali"); + return currentStates.loopMode; } } @@ -291,14 +295,14 @@ namespace Tizen.NUI.BaseComponents { currentStates.changed = true; currentStates.loopCount = value; - NUILog.Debug($"LoopCount set! currentStates.loopCount={currentStates.loopCount}"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.LoopCount SET currentStates.loopCount={currentStates.loopCount} >>>"); PropertyMap map = new PropertyMap(); map.Add(ImageVisualProperty.LoopCount, new PropertyValue(currentStates.loopCount)); DoAction(vectorImageVisualIndex, (int)actionType.updateProperty, new PropertyValue(map)); } get { - NUILog.Debug($"LoopCount get!"); + //tlog.Fatal(tag, $"LoopCount get!"); PropertyMap map = base.Image; var ret = 0; if (map != null) @@ -308,19 +312,62 @@ namespace Tizen.NUI.BaseComponents { if (val.Get(out ret)) { - NUILog.Debug($"gotten loop count={ret}"); + //tlog.Fatal(tag, $"gotten loop count={ret}"); if (ret != currentStates.loopCount && ret > 0) { - NUILog.Debug($"[ERR] different loop count! gotten={ret}, loopCount={currentStates.loopCount}"); + tlog.Fatal(tag, $"[ERROR][{GetId()}](AnimatedVectorImageView) different loop count! gotten={ret}, loopCount={currentStates.loopCount}"); } return currentStates.loopCount; } } } - tizenlog.Error(tag, $"[ERROR] fail to get LoopCount from dali currentStates.loopCount={currentStates.loopCount}"); + tlog.Error(tag, $"[ERROR][{GetId()}](AnimatedVectorImageView) Fail to get LoopCount from dali currentStates.loopCount={currentStates.loopCount}"); return currentStates.loopCount; } } + + /// + /// Stop Behavior (Stop End Action) + /// + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public StopBehaviorType StopBehavior + { + set + { + currentStates.stopEndAction = (StopBehaviorType)value; + currentStates.changed = true; + + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.StopBehavior SET val={currentStates.stopEndAction} >>>"); + PropertyMap map = new PropertyMap(); + map.Add(ImageVisualProperty.StopBehavior, new PropertyValue((int)currentStates.stopEndAction)); + DoAction(vectorImageVisualIndex, (int)actionType.updateProperty, new PropertyValue(map)); + } + get + { + //tlog.Fatal(tag, $"StopBehavior get!"); + PropertyMap map = base.Image; + var ret = 0; + if (map != null) + { + PropertyValue val = map.Find(ImageVisualProperty.StopBehavior); + if (val != null) + { + if (val.Get(out ret)) + { + //tlog.Fatal(tag, $"gotten StopBehavior={ret}"); + if (ret != (int)currentStates.stopEndAction) + { + tlog.Fatal(tag, $"[ERROR][{GetId()}](AnimatedVectorImageView) different StopBehavior! gotten={ret}, StopBehavior={currentStates.stopEndAction}"); + } + return (StopBehaviorType)ret; + } + } + } + tlog.Error(tag, $"[ERROR][{GetId()}](AnimatedVectorImageView) Fail to get StopBehavior from dali"); + return currentStates.stopEndAction; + } + } #endregion Property @@ -334,7 +381,7 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public void SetPlayRange(int startFrame, int endFrame) { - NUILog.Debug($"SetPlayRange(startFrame={startFrame}, endFrame={endFrame})"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.SetPlayRange({startFrame}, {endFrame})"); currentStates.changed = true; currentStates.framePlayRangeMin = startFrame; @@ -347,7 +394,7 @@ namespace Tizen.NUI.BaseComponents PropertyMap map = new PropertyMap(); map.Add(ImageVisualProperty.PlayRange, new PropertyValue(array)); DoAction(vectorImageVisualIndex, (int)actionType.updateProperty, new PropertyValue(map)); - NUILog.Debug($"currentStates.framePlayRangeMin={currentStates.framePlayRangeMin}, currentStates.framePlayRangeMax={currentStates.framePlayRangeMax})"); + tlog.Fatal(tag, $" [{GetId()}](AnimatedVectorImageView) currentStates=({currentStates.framePlayRangeMin}, {currentStates.framePlayRangeMax}) >>>"); } /// @@ -357,7 +404,7 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public new void Play() { - NUILog.Debug($"Play() called!"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.Play() called >>>"); debugPrint(); base.Play(); } @@ -369,7 +416,7 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public new void Pause() { - NUILog.Debug($"Pause() called!"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.Pause() called >>>"); debugPrint(); base.Pause(); } @@ -381,7 +428,7 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public new void Stop() { - NUILog.Debug($"Stop()!"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.Stop() called >>>"); debugPrint(); base.Stop(); } @@ -400,7 +447,7 @@ namespace Tizen.NUI.BaseComponents { if (finishedEventHandler == null) { - NUILog.Debug($"Finished()! add!"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.Finished eventhandler added >>>"); visualEventSignalCallback = onVisualEventSignal; VisualEventSignal().Connect(visualEventSignalCallback); } @@ -408,7 +455,7 @@ namespace Tizen.NUI.BaseComponents } remove { - NUILog.Debug($"Finished()! remove!"); + tlog.Fatal(tag, $" <<< [{GetId()}]AnimatedVectorImageView.Finished eventhandler removed >>>"); finishedEventHandler -= value; if (finishedEventHandler == null && visualEventSignalCallback != null) { @@ -470,6 +517,54 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] Paused = 2 } + + /// + /// @brief Enumeration for what to do when the animation is stopped. + /// + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public enum StopBehaviorType + { + /// + /// When the animation is stopped, the current frame is shown. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + CurrentFrame, + /// + /// When the animation is stopped, the first frame is shown. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + FirstFrame, + /// + /// When the animation is stopped, the last frame is shown. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + LastFrame + } + + /// + /// @brief Enumeration for what looping mode is in. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + public enum LoopingModeType + { + /// + /// When the animation arrives at the end in looping mode, the animation restarts from the beginning. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + Restart, + /// + /// When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + AutoReverse + } #endregion Event, Enum, Struct, ETC @@ -529,8 +624,8 @@ namespace Tizen.NUI.BaseComponents internal string url; internal int frame; internal int loopCount; - internal LoopModes loopMode; - //internal EndActions stopEndAction; + internal LoopingModeType loopMode; + internal StopBehaviorType stopEndAction; internal int framePlayRangeMin; internal int framePlayRangeMax; internal bool changed; @@ -557,12 +652,13 @@ namespace Tizen.NUI.BaseComponents } } - private const string tag = "NUI"; + private const string tag = "NUITEST"; private const int vectorImageVisualIndex = 10000000 + 1000 + 2; private event EventHandler finishedEventHandler; private void OnFinished() { + tlog.Fatal(tag, $" <<<[{GetId()}] OnFinished() called >>>"); finishedEventHandler?.Invoke(this, null); } @@ -575,11 +671,11 @@ namespace Tizen.NUI.BaseComponents View v = Registry.GetManagedBaseHandleFromNativePtr(targetView) as View; if (v != null) { - NUILog.Debug($"targetView is not null! name={v.Name}"); + tlog.Fatal(tag, $"targetView is not null! name={v.Name}"); } else { - NUILog.Debug($"target is something created from dali"); + tlog.Fatal(tag, $"target is something created from dali"); } } VisualEventSignalArgs e = new VisualEventSignalArgs(); @@ -587,7 +683,7 @@ namespace Tizen.NUI.BaseComponents e.SignalId = signalId; visualEventSignalHandler?.Invoke(this, e); - NUILog.Debug($"@@ onVisualEventSignal()! visualIndex={visualIndex}, signalId={signalId}"); + tlog.Fatal(tag, $" [{GetId()}] onVisualEventSignal()! visualIndex={visualIndex}, signalId={signalId}"); } [UnmanagedFunctionPointer(CallingConvention.StdCall)] @@ -598,8 +694,8 @@ namespace Tizen.NUI.BaseComponents private void debugPrint() { - NUILog.Debug($"======= currentStates"); - NUILog.Debug($"url={currentStates.url}, loopCount={currentStates.loopCount}, framePlayRangeMin={currentStates.framePlayRangeMin}, framePlayRangeMax={currentStates.framePlayRangeMax} \n"); + tlog.Fatal(tag, $" <<< [{GetId()}] get currentStates : url={currentStates.url}, loopCount={currentStates.loopCount}, framePlayRangeMin/Max({currentStates.framePlayRangeMin},{currentStates.framePlayRangeMax}) "); + tlog.Fatal(tag, $" get from Property : StopBehavior={StopBehavior}, LoopMode={LoopMode}, LoopCount={LoopCount} >>>"); } #endregion Private } diff --git a/src/Tizen.NUI/src/public/BaseComponents/VectorAnimationView.cs b/src/Tizen.NUI/src/public/BaseComponents/VectorAnimationView.cs index 5d95c5c6b..0affe61b8 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/VectorAnimationView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/VectorAnimationView.cs @@ -17,6 +17,9 @@ using global::System; using System.ComponentModel; +#if (NUI_DEBUG_ON) +using tlog = Tizen.Log; +#endif namespace Tizen.NUI.BaseComponents { @@ -35,6 +38,7 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public VectorAnimationViewTBD() : base() { + tlog.Fatal(tag, $"<<< VectorAnimationView() constuctor objId={GetId()} >>>"); } /// @@ -45,6 +49,7 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public VectorAnimationViewTBD(float scale) : base(scale) { + tlog.Fatal(tag, $"<<< VectorAnimationView(scale={scale}) constuctor objId={GetId()}>>>"); } /// @@ -59,7 +64,7 @@ namespace Tizen.NUI.BaseComponents { return; } - NUILog.Debug($"Dispose(type={type})!"); + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.Dispose(type={type})"); if (type == DisposeTypes.Explicit) { @@ -73,6 +78,8 @@ namespace Tizen.NUI.BaseComponents //because the execution order of Finalizes is non-deterministic. base.Dispose(type); + + tlog.Fatal(tag, $"[{GetId()}] VectorAnimationView.Dispose() >>>"); } #endregion Constructor, Distructor, Dispose @@ -87,15 +94,18 @@ namespace Tizen.NUI.BaseComponents { set { + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.ResourceURL SET"); + if (value == mResourceURL) { - NUILog.Debug($"set same URL! just return!"); - return; + tlog.Fatal(tag, $"set same URL! "); + //return; } - NUILog.Debug($"Object : {GetId()} URL : {ResourceURL} New URL: {value}"); mResourceURL = (value == null) ? "" : value; URL = mResourceURL; mIsMinMaxSet = false; + + tlog.Fatal(tag, $" [{GetId()}] VectorAnimationView.ResourceURL SET mResourceURL={mResourceURL}) >>>"); } get => mResourceURL; } @@ -113,8 +123,13 @@ namespace Tizen.NUI.BaseComponents { set { + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.RepeatCount SET"); + mRepeatCount = (value < -1) ? -1 : value; - LoopCount = mRepeatCount; + //LoopCount = mRepeatCount; + LoopCount = (mRepeatCount < 0) ? mRepeatCount : mRepeatCount + 1; + + tlog.Fatal(tag, $"[{GetId()}] VectorAnimationView.RepeatCount SET mRepeatCount={mRepeatCount} >>>"); } get => mRepeatCount; } @@ -129,6 +144,8 @@ namespace Tizen.NUI.BaseComponents { set { + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.CurrentFrame SET"); + if (mResourceURL == null || mResourceURL == String.Empty) { throw new InvalidOperationException("Resource Url not yet Set"); @@ -144,12 +161,14 @@ namespace Tizen.NUI.BaseComponents { value = mFrameCount - 1; } - NUILog.Debug($"Object : {GetId()} URL : {ResourceURL} New Frame: {value}, Old Frame : {mCurrentFrame}"); + mCurrentFrame = value; AnimationState = AnimationStates.Paused; SetPlayRange(mCurrentFrame, mCurrentFrame); CurrentFrameNumber = mCurrentFrame; + + tlog.Fatal(tag, $" [{GetId()}] VectorAnimationView.CurrentFrame SET mCurrentFrame={mCurrentFrame}) >>>"); } get => mCurrentFrame; } @@ -163,8 +182,23 @@ namespace Tizen.NUI.BaseComponents { set { + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.RepeatMode SET"); mRepeatMode = value; - LoopMode = (AnimatedVectorImageView.LoopModes)mRepeatMode; + + switch (mRepeatMode) + { + case RepeatModes.Restart: + LoopMode = LoopingModeType.Restart; + break; + case RepeatModes.Reverse: + LoopMode = LoopingModeType.AutoReverse; + break; + default: + LoopMode = LoopingModeType.Restart; + break; + } + + tlog.Fatal(tag, $" [{GetId()}] VectorAnimationView.RepeatMode SET mRepeatMode={mRepeatMode}) >>>"); } get => mRepeatMode; } @@ -192,6 +226,8 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public void SetMinAndMaxFrame(int minFrame, int maxFrame) { + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.SetMinAndMaxFrame({minFrame}, {maxFrame})"); + mMinFrame = (minFrame) > 0 ? minFrame : 0; mMaxFrame = (maxFrame) > 0 ? maxFrame : 0; mIsMinMaxSet = true; @@ -211,9 +247,12 @@ namespace Tizen.NUI.BaseComponents { return; } - NUILog.Debug($"SetMinAndMaxFrame({mMinFrame}, {mMaxFrame})"); + base.Stop(); SetPlayRange(mMinFrame, mMaxFrame); + CurrentFrameNumber = mMinFrame; + + tlog.Fatal(tag, $" [{GetId()}] VectorAnimationView.SetMinAndMaxFrame(m: {mMinFrame}, {mMaxFrame}) >>>"); } /// @@ -223,6 +262,8 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public new void Play() { + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.Play()"); + if (mResourceURL == null || mResourceURL == String.Empty) { throw new InvalidOperationException("Resource Url not yet Set"); @@ -230,15 +271,21 @@ namespace Tizen.NUI.BaseComponents if (mIsMinMaxSet) { + //if(mRepeatCount > 0 ) + //{ + // StopBehavior = StopBehaviorType.FirstFrame; + //} SetPlayRange(mMinFrame, mMaxFrame); } else { - SetPlayRange(0, TotalFrameNumber - 1); + //SetPlayRange(0, TotalFrameNumber - 1); } base.Play(); AnimationState = AnimationStates.Playing; + + tlog.Fatal(tag, $" [{GetId()}] VectorAnimationView.Play(mIsMinMaxSet={mIsMinMaxSet}) >>>"); } /// @@ -248,6 +295,8 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public new void Pause() { + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.Pause() AnimationState={AnimationState}"); + if (mResourceURL == null || mResourceURL == String.Empty) { throw new InvalidOperationException("Resource Url not yet Set"); @@ -255,6 +304,8 @@ namespace Tizen.NUI.BaseComponents base.Pause(); AnimationState = AnimationStates.Paused; + + tlog.Fatal(tag, $" [{GetId()}] VectorAnimationView.Pause() >>>"); } /// @@ -269,6 +320,8 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public void Stop(EndActions endAction = EndActions.Cancel) { + tlog.Fatal(tag, $"<<< [{GetId()}] VectorAnimationView.Stop({endAction})"); + if (mResourceURL == null || mResourceURL == String.Empty) { throw new InvalidOperationException("Resource Url not yet Set"); @@ -279,17 +332,38 @@ namespace Tizen.NUI.BaseComponents return; } - if (endAction == EndActions.Discard) + if (mEndAction != endAction) { - CurrentFrame = mMinFrame; - } - else if (endAction == EndActions.StopFinal) + mEndAction = endAction; + switch (endAction) { - CurrentFrame = mMaxFrame; + case EndActions.Cancel: + StopBehavior = StopBehaviorType.CurrentFrame; + break; + case EndActions.Discard: + StopBehavior = StopBehaviorType.FirstFrame; + break; + case EndActions.StopFinal: + StopBehavior = StopBehaviorType.LastFrame; + break; + default: + tlog.Fatal(tag, $" [{GetId()}] no endAction : default set"); + break; } + } + //if (endAction == EndActions.Discard) + //{ + // CurrentFrame = mMinFrame; + //} + //else if (endAction == EndActions.StopFinal) + //{ + // CurrentFrame = mMaxFrame; + //} AnimationState = AnimationStates.Stopped; base.Stop(); + + tlog.Fatal(tag, $" [{GetId()}] VectorAnimationView.Stop(endaction={endAction}) >>>"); } #endregion Method @@ -372,6 +446,9 @@ namespace Tizen.NUI.BaseComponents private int mMinFrame = -1, mMaxFrame = -1; private bool mIsMinMaxSet = false; private int mCurrentFrame = -1; + private EndActions mEndAction = EndActions.Cancel; + + private string tag = "NUITEST"; #endregion Private } } diff --git a/src/Tizen.NUI/src/public/NUIConstants.cs b/src/Tizen.NUI/src/public/NUIConstants.cs index 2fadd2d36..f64ebe0e1 100755 --- a/src/Tizen.NUI/src/public/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/NUIConstants.cs @@ -1851,6 +1851,28 @@ namespace Tizen.NUI /// [EditorBrowsable(EditorBrowsableState.Never)] public static readonly int TotalFrameNumber = NDalic.IMAGE_VISUAL_ORIENTATION_CORRECTION + 7; + + /// + /// @brief The stop behavior the AnimatedVectorImageVisual will use. + /// @details Name "stopBehavior", Type StopBehavior::Type (Property::INTEGER) + /// @note Default value is StopBehavior::CURRENT_FRAME. + /// + /// + /// Inhouse API + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly int StopBehavior = NDalic.IMAGE_VISUAL_ORIENTATION_CORRECTION + 8; + + /// + /// @brief The looping mode the AnimatedVectorImageVisual will use. + /// @details Name "loopingMode", Type LoopingMode::Type (Property::INTEGER) + /// @note Default value is LoopingMode::RESTART. + /// + /// + /// Inhouse API + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly int LoopingMode = NDalic.IMAGE_VISUAL_ORIENTATION_CORRECTION + 9; } /// -- 2.34.1