From: Eunki, Hong Date: Thu, 9 Nov 2023 01:37:38 +0000 (+0900) Subject: [NUI] Support LottieAnimationView file load asynchronously X-Git-Tag: accepted/tizen/8.0/unified/20240613.065534~130 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52ac1f7657b7d81c5a292165d95794e8d15500e0;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Support LottieAnimationView file load asynchronously Current LottieAnimationView implement their own ViewCreation logic. For example, ImageView.ResourceUrl = ~~ didn't change synchronously option. But LottieAnimationView.ResourceUrl = ~~~ make synchronously option as true hardly. So, there is no way to make asynchronously load lottie file. To support it, let we cherry-pick new option of SynchronousLoading. Signed-off-by: Eunki, Hong --- diff --git a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs index c50318d..b3ed780 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs @@ -61,6 +61,10 @@ namespace Tizen.NUI.BaseComponents currentStates.redrawInScalingDown = true; currentStates.desiredWidth = 0; currentStates.desiredHeight = 0; + currentStates.synchronousLoading = true; + + // Notify to base ImageView cache that default synchronousLoading for lottie file is true. + base.SynchronousLoading = currentStates.synchronousLoading; // Set changed flag as true when initalized state. // After some properties change, LottieAnimationView.UpdateImage will apply these inital values. @@ -170,13 +174,15 @@ namespace Tizen.NUI.BaseComponents using PropertyValue stopAction = new PropertyValue((int)currentStates.stopEndAction); using PropertyValue loopMode = new PropertyValue((int)currentStates.loopMode); using PropertyValue redrawInScalingDown = new PropertyValue(currentStates.redrawInScalingDown); + using PropertyValue synchronousLoading = new PropertyValue(currentStates.synchronousLoading); map.Add(Visual.Property.Type, type) .Add(ImageVisualProperty.URL, url) .Add(ImageVisualProperty.LoopCount, loopCnt) .Add(ImageVisualProperty.StopBehavior, stopAction) .Add(ImageVisualProperty.LoopingMode, loopMode) - .Add(ImageVisualProperty.RedrawInScalingDown, redrawInScalingDown); + .Add(ImageVisualProperty.RedrawInScalingDown, redrawInScalingDown) + .Add(ImageVisualProperty.SynchronousLoading, synchronousLoading); if (currentStates.desiredWidth > 0) { @@ -244,6 +250,24 @@ namespace Tizen.NUI.BaseComponents } /// + /// Gets or sets the SynchronousLoading for LottieAnimationView
+ /// We should set it before setup ResourceUrl, URL property.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public new bool SynchronousLoading + { + get + { + return currentStates.synchronousLoading; + } + set + { + currentStates.synchronousLoading = value; + base.SynchronousLoading = currentStates.synchronousLoading; + } + } + + /// /// Gets the playing state /// /// 7 @@ -805,6 +829,7 @@ namespace Tizen.NUI.BaseComponents UpdateImage(ImageVisualProperty.StopBehavior, new PropertyValue((int)currentStates.stopEndAction), false); UpdateImage(ImageVisualProperty.LoopingMode, new PropertyValue((int)currentStates.loopMode), false); UpdateImage(ImageVisualProperty.RedrawInScalingDown, new PropertyValue(currentStates.redrawInScalingDown), false); + UpdateImage(ImageVisualProperty.SynchronousLoading, new PropertyValue(currentStates.synchronousLoading), false); // Do not cache PlayRange and TotalFrameNumber into cachedImagePropertyMap. // (To keep legacy implements behaviour) @@ -1205,6 +1230,7 @@ namespace Tizen.NUI.BaseComponents internal string mark1, mark2; internal bool redrawInScalingDown; internal int desiredWidth, desiredHeight; + internal bool synchronousLoading; internal bool changed; }; private states currentStates;