[NUI] Add ImageList property (#2449)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Fri, 25 Dec 2020 03:03:34 +0000 (12:03 +0900)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Mon, 11 Jan 2021 05:49:43 +0000 (14:49 +0900)
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
Co-authored-by: YeongJong Lee <cleanlyj@naver.com>
src/Tizen.NUI.Components/Controls/Loading.cs
src/Tizen.NUI.Components/Style/LoadingStyle.cs

index 0674415..c61528a 100755 (executable)
@@ -29,7 +29,7 @@ namespace Tizen.NUI.Components
     /// <since_tizen> 6 </since_tizen>
     public class Loading : Control
     {
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>The ImageArray bindable property.</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty ImageArrayProperty = BindableProperty.Create(nameof(ImageArray), typeof(string[]), typeof(Loading), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -37,7 +37,7 @@ namespace Tizen.NUI.Components
             if (newValue != null)
             {
                 instance.loadingStyle.Images = (string[])newValue;
-                instance.imageVisual.URLS = new List<string>((string[])newValue);
+                instance.imageVisual.URLS = instance.loadingStyle.ImageList as List<string>;
             }
         },
         defaultValueCreator: (bindable) =>
@@ -45,7 +45,23 @@ namespace Tizen.NUI.Components
             var instance = (Loading)bindable;
             return instance.loadingStyle.Images;
         });
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>The ImageList bindable property.</summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty ImageListProperty = BindableProperty.Create(nameof(ImageList), typeof(IList<string>), typeof(Loading), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var instance = (Loading)bindable;
+            if (newValue != null)
+            {
+                var newValueList = newValue as List<string>;
+                instance.loadingStyle.ImageList = newValueList;
+                instance.imageVisual.URLS = newValueList;
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            return ((Loading)bindable).loadingStyle.ImageList;
+        });
+        /// <summary>The Size bindable property.</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public new static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(Size), typeof(Loading), new Size(0, 0), propertyChanged: (bindable, oldValue, newValue) =>
          {
@@ -62,7 +78,7 @@ namespace Tizen.NUI.Components
             var instance = (View)bindable;
             return instance.Size;
         });
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>The FrameRate bindable property.</summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty FrameRateProperty = BindableProperty.Create(nameof(FrameRate), typeof(int), typeof(Loading), (int)(1000 / 16.6f), propertyChanged: (bindable, oldValue, newValue) =>
           {
@@ -160,6 +176,18 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
+        /// Gets loading image resource array.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public IList<string> ImageList
+        {
+            get
+            {
+                return GetValue(ImageListProperty) as List<string>;
+            }
+        }
+
+        /// <summary>
         /// Gets or sets loading size.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
@@ -250,7 +278,8 @@ namespace Tizen.NUI.Components
         {
             if (null != loadingStyle.Images)
             {
-                imageVisual.URLS = new List<string>(loadingStyle.Images);
+                loadingStyle.ImageList = new List<string>(loadingStyle.Images);
+                imageVisual.URLS = loadingStyle.ImageList as List<string>;
             }
             if (null != loadingStyle.FrameRate?.All && 0 != loadingStyle.FrameRate.All.Value)
             {
index 9fd3e97..a24a54b 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System.Collections.Generic;
 using System.ComponentModel;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
@@ -52,15 +53,34 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty ImagesProperty = BindableProperty.Create(nameof(Images), typeof(string[]), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            ((LoadingStyle)bindable).images = (string[])((string[])newValue)?.Clone();
+            ((LoadingStyle)bindable).images = new List<string>((string[])newValue);
         },
         defaultValueCreator: (bindable) =>
         {
+            if (((LoadingStyle)bindable).images == null)
+            {
+                ((LoadingStyle)bindable).images = new List<string>();
+            }
+            return ((LoadingStyle)bindable).images?.ToArray();
+        });
+
+        /// <summary>The Images bindable property.</summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty ImageListProperty = BindableProperty.Create(nameof(ImageList), typeof(IList<string>), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            ((LoadingStyle)bindable).images = newValue as List<string>;
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            if(((LoadingStyle)bindable).images == null)
+            {
+                ((LoadingStyle)bindable).images = new List<string>();
+            }
             return ((LoadingStyle)bindable).images;
         });
 
         private Selector<int?> frameRate;
-        private string[] images;
+        private List<string> images;
 
         static LoadingStyle() { }
 
@@ -90,6 +110,16 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
+        /// Gets loading image resources.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public IList<string> ImageList
+        {
+            get => GetValue(ImageListProperty) as List<string>;
+            internal set => SetValue(ImageListProperty, value);
+        }
+
+        /// <summary>
         /// Gets or sets loading image size.
         /// </summary>
         /// <since_tizen> 8 </since_tizen>