[NUI] Add IsUsingXaml at NUIWidgetApplication and change AnimatedVectorImageView...
authordongsug.song <dongsug.song@samsung.com>
Mon, 8 Apr 2024 12:19:16 +0000 (21:19 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 17 Apr 2024 02:35:20 +0000 (11:35 +0900)
src/Tizen.NUI/src/public/Application/NUIWidgetApplication.cs
src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs
src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageViewBindableProperty.cs

index 81ab91c..612fabe 100755 (executable)
@@ -95,6 +95,17 @@ namespace Tizen.NUI
             core?.AddWidgetInfo(widgetTypes);
         }
 
+        /// <summary>
+        /// Set to true if XAML is used. 
+        /// This must be called before or immediately after the NUIWidgetApplication constructor is called.
+        /// The default value is true.
+        /// </summary>
+        /// <remarks>
+        /// This must be called before or immediately after the NUIWidgetApplication constructor is called.
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        static public bool IsUsingXaml { get; set; } = true;
+
         internal WidgetApplication ApplicationHandle
         {
             get
index d285024..a7b39c8 100755 (executable)
@@ -17,6 +17,8 @@
 
 using global::System;
 using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
 
 namespace Tizen.NUI.BaseComponents
 {
@@ -27,6 +29,28 @@ namespace Tizen.NUI.BaseComponents
     public partial class AnimatedVectorImageView : LottieAnimationView
     {
         #region Constructor, Destructor, Dispose
+
+        static AnimatedVectorImageView()
+        {
+            if (NUIApplication.IsUsingXaml)
+            {
+                ResourceURLProperty = BindableProperty.Create(nameof(ResourceURL), typeof(string), typeof(AnimatedVectorImageView), string.Empty,
+                    propertyChanged: SetInternalResourceURLProperty, defaultValueCreator: GetInternalResourceURLProperty);
+
+                ResourceUrlProperty = BindableProperty.Create(nameof(ResourceUrl), typeof(string), typeof(AnimatedVectorImageView), string.Empty,
+                    propertyChanged: SetInternalResourceUrlProperty, defaultValueCreator: GetInternalResourceUrlProperty);
+
+                RepeatCountProperty = BindableProperty.Create(nameof(RepeatCount), typeof(int), typeof(AnimatedVectorImageView), 0,
+                    propertyChanged: SetInternalRepeatCountProperty, defaultValueCreator: GetInternalRepeatCountProperty);
+
+                CurrentFrameProperty = BindableProperty.Create(nameof(CurrentFrame), typeof(int), typeof(AnimatedVectorImageView), 0,
+                    propertyChanged: SetInternalCurrentFrameProperty, defaultValueCreator: GetInternalCurrentFrameProperty);
+
+                RepeatModeProperty = BindableProperty.Create(nameof(RepeatMode), typeof(RepeatModes), typeof(AnimatedVectorImageView), default(RepeatModes),
+                    propertyChanged: SetInternalRepeatModeProperty, defaultValueCreator: GetInternalRepeatModeProperty);
+            }
+        }
+
         /// <summary>
         /// Construct VectorAnimationView.
         /// </summary>
@@ -80,11 +104,25 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return GetValue(ResourceURLProperty) as string;
+                if (NUIApplication.IsUsingXaml)
+                {
+                    return GetValue(ResourceURLProperty) as string;
+                }
+                else
+                {
+                    return GetInternalResourceURLProperty(this) as string;
+                }
             }
             set
             {
-                SetValue(ResourceURLProperty, value);
+                if (NUIApplication.IsUsingXaml)
+                {
+                    SetValue(ResourceURLProperty, value);
+                }
+                else
+                {
+                    SetInternalResourceURLProperty(this, null, value);
+                }
                 NotifyPropertyChanged();
             }
         }
@@ -117,11 +155,25 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return GetValue(ResourceUrlProperty) as string;
+                if (NUIApplication.IsUsingXaml)
+                {
+                    return GetValue(ResourceUrlProperty) as string;
+                }
+                else
+                {
+                    return GetInternalResourceUrlProperty(this) as string;
+                }
             }
             set
             {
-                SetValue(ResourceUrlProperty, value);
+                if (NUIApplication.IsUsingXaml)
+                {
+                    SetValue(ResourceUrlProperty, value);
+                }
+                else
+                {
+                    SetInternalResourceUrlProperty(this, null, value);
+                }
                 NotifyPropertyChanged();
             }
         }
@@ -154,15 +206,29 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return (int)GetValue(RepeatCountProperty);
+                if (NUIApplication.IsUsingXaml)
+                {
+                    return (int)GetValue(RepeatCountProperty);
+                }
+                else
+                {
+                    return (int)GetInternalRepeatCountProperty(this);
+                }
             }
             set
             {
-                SetValue(RepeatCountProperty, value);
+                if (NUIApplication.IsUsingXaml)
+                {
+                    SetValue(RepeatCountProperty, value);
+                }
+                else
+                {
+                    SetInternalRepeatCountProperty(this, null, value);
+                }
                 NotifyPropertyChanged();
             }
         }
-
+        
         private int InternalRepeatCount
         {
             set
@@ -201,11 +267,25 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return (int)GetValue(CurrentFrameProperty);
+                if (NUIApplication.IsUsingXaml)
+                {
+                    return (int)GetValue(CurrentFrameProperty);
+                }
+                else
+                {
+                    return (int)GetInternalCurrentFrameProperty(this);
+                }
             }
             set
             {
-                SetValue(CurrentFrameProperty, value);
+                if (NUIApplication.IsUsingXaml)
+                {
+                    SetValue(CurrentFrameProperty, value);
+                }
+                else
+                {
+                    SetInternalCurrentFrameProperty(this, null, value);
+                }
                 NotifyPropertyChanged();
             }
         }
@@ -245,11 +325,25 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return (RepeatModes)GetValue(RepeatModeProperty);
+                if (NUIApplication.IsUsingXaml)
+                {
+                    return (RepeatModes)GetValue(RepeatModeProperty);
+                }
+                else
+                {
+                    return (RepeatModes)GetInternalRepeatModeProperty(this);
+                }
             }
             set
             {
-                SetValue(RepeatModeProperty, value);
+                if (NUIApplication.IsUsingXaml)
+                {
+                    SetValue(RepeatModeProperty, value);
+                }
+                else
+                {
+                    SetInternalRepeatModeProperty(this, null, value);
+                }
                 NotifyPropertyChanged();
             }
         }
index af678e9..3e12d1d 100755 (executable)
@@ -26,84 +26,98 @@ namespace Tizen.NUI.BaseComponents
         /// ResourceURLProperty
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty ResourceURLProperty = BindableProperty.Create(nameof(ResourceURL), typeof(string), typeof(AnimatedVectorImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+        public static readonly BindableProperty ResourceURLProperty = null;
+
+        internal static void SetInternalResourceURLProperty(BindableObject bindable, object oldValue, object newValue)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             instance.InternalResourceURL = (string)newValue;
-        },
-        defaultValueCreator: (bindable) =>
+        }
+        
+        internal static object GetInternalResourceURLProperty(BindableObject bindable)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             return instance.InternalResourceURL;
-        });
+        }
 
         /// <summary>
         /// ResourceUrlProperty
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static new readonly BindableProperty ResourceUrlProperty = BindableProperty.Create(nameof(ResourceUrl), typeof(string), typeof(AnimatedVectorImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+        public static new readonly BindableProperty ResourceUrlProperty = null;
+        
+        internal static void SetInternalResourceUrlProperty(BindableObject bindable, object oldValue, object newValue)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             instance.InternalResourceUrl = (string)newValue;
-        },
-        defaultValueCreator: (bindable) =>
+        }
+
+        internal static object GetInternalResourceUrlProperty(BindableObject bindable)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             return instance.InternalResourceUrl;
-        });
+        }
 
         /// <summary>
         /// RepeatCountProperty
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty RepeatCountProperty = BindableProperty.Create(nameof(RepeatCount), typeof(int), typeof(AnimatedVectorImageView), 0, propertyChanged: (bindable, oldValue, newValue) =>
+        public static readonly BindableProperty RepeatCountProperty = null;
+        
+        internal static void SetInternalRepeatCountProperty(BindableObject bindable, object oldValue, object newValue)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             if (newValue != null)
             {
                 instance.InternalRepeatCount = (int)newValue;
             }
-        },
-        defaultValueCreator: (bindable) =>
+        }
+        internal static object GetInternalRepeatCountProperty(BindableObject bindable)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             return instance.InternalRepeatCount;
-        });
+        }
 
         /// <summary>
         /// CurrentFrameProperty
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static new readonly BindableProperty CurrentFrameProperty = BindableProperty.Create(nameof(CurrentFrame), typeof(int), typeof(AnimatedVectorImageView), 0, propertyChanged: (bindable, oldValue, newValue) =>
+        public static new readonly BindableProperty CurrentFrameProperty = null;
+        
+        internal static void SetInternalCurrentFrameProperty(BindableObject bindable, object oldValue, object newValue)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             if (newValue != null)
             {
                 instance.InternalCurrentFrame = (int)newValue;
             }
-        },
-        defaultValueCreator: (bindable) =>
+        }
+        
+        internal static object GetInternalCurrentFrameProperty(BindableObject bindable)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             return instance.InternalCurrentFrame;
-        });
+        }
 
         /// <summary>
         /// RepeatModeProperty
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty RepeatModeProperty = BindableProperty.Create(nameof(RepeatMode), typeof(RepeatModes), typeof(AnimatedVectorImageView), default(RepeatModes), propertyChanged: (bindable, oldValue, newValue) =>
+        public static readonly BindableProperty RepeatModeProperty = null;
+        
+        static internal void SetInternalRepeatModeProperty(BindableObject bindable, object oldValue, object newValue)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             if (newValue != null)
             {
                 instance.InternalRepeatMode = (Tizen.NUI.BaseComponents.AnimatedVectorImageView.RepeatModes)newValue;
             }
-        },
-        defaultValueCreator: (bindable) =>
+        }
+        
+        static internal object GetInternalRepeatModeProperty(BindableObject bindable)
         {
             var instance = (Tizen.NUI.BaseComponents.AnimatedVectorImageView)bindable;
             return instance.InternalRepeatMode;
-        });
+        }
     }
 }