[NUI][Xaml] Remove unused method
authorFang Xiaohui <xiaohui.fang@samsung.com>
Thu, 24 Mar 2022 01:30:07 +0000 (09:30 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 27 Apr 2022 02:44:42 +0000 (11:44 +0900)
src/Tizen.NUI/src/internal/XamlBinding/BindingExpression.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/TextField.cs
src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs
src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs
src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs
src/Tizen.NUI/src/public/XamlBinding/TypedBinding.cs

index 7eb889a..a239617 100755 (executable)
@@ -186,7 +186,7 @@ namespace Tizen.NUI.Binding
                     return;
                 }
 
-                target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted, false);
+                target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted);
             }
             else if (needsSetter && part.LastSetter != null && current != null)
             {
index a63a90f..b338296 100755 (executable)
@@ -37,6 +37,7 @@ namespace Tizen.NUI.BaseComponents
         private InputMethodContext inputMethodContext = null;
         private float fontSizeScale = 1.0f;
         private bool hasFontSizeChangedCallback = false;
+        private bool isSettingTextInCSharp = false;
 
         static TextEditor() { }
 
@@ -77,6 +78,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 SetVisible(false);
             }
+
+            TextChanged += TextEditorTextChanged;
         }
 
         internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
@@ -85,6 +88,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 SetVisible(false);
             }
+
+            TextChanged += TextEditorTextChanged;
         }
 
         /// <summary>
@@ -1843,32 +1848,6 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-        internal override bool IsBinded
-        {
-            get
-            {
-                return base.IsBinded;
-            }
-            set
-            {
-                base.IsBinded = value;
-
-                if (value == true)
-                {
-                    TextChanged += TextEditorTextChanged;
-                }
-                else
-                {
-                    TextChanged -= TextEditorTextChanged;
-                }
-            }
-        }
-
-        private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
-        {
-            ForceNotifyBindedInstance(TextProperty);
-        }
-
         /// <summary>
         /// The FontSizeScale property. <br />
         /// The default value is 1.0. <br />
@@ -2119,10 +2098,7 @@ namespace Tizen.NUI.BaseComponents
                 }
             }
 
-            if (IsBinded)
-            {
-                TextChanged -= TextEditorTextChanged;
-            }
+            TextChanged -= TextEditorTextChanged;
 
             base.Dispose(type);
         }
@@ -2209,6 +2185,14 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (!isSettingTextInCSharp)
+            {
+                ForceNotifyBindedInstance(TextProperty);
+            }
+        }
+
         internal new class Property
         {
             internal static readonly int TEXT = Interop.TextEditor.TextGet();
index 2ded6c4..06deef4 100755 (executable)
@@ -33,7 +33,9 @@ namespace Tizen.NUI.BaseComponents
             var textEditor = (TextEditor)bindable;
             if (newValue != null)
             {
+                textEditor.isSettingTextInCSharp = true;
                 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.TEXT, new Tizen.NUI.PropertyValue((string)newValue));
+                textEditor.isSettingTextInCSharp = false;
             }
         }),
         defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
index acc4180..bc460b0 100755 (executable)
@@ -38,6 +38,7 @@ namespace Tizen.NUI.BaseComponents
         private InputMethodContext inputMethodCotext = null;
         private float fontSizeScale = 1.0f;
         private bool hasFontSizeChangedCallback = false;
+        private bool isSettingTextInCSharp = false;
 
         static TextField() { }
 
@@ -77,6 +78,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 SetVisible(false);
             }
+
+            TextChanged += TextEditorTextChanged;
         }
 
         internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
@@ -85,6 +88,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 SetVisible(false);
             }
+
+            TextChanged += TextEditorTextChanged;
         }
 
         internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
@@ -95,6 +100,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 SetVisible(false);
             }
+
+            TextChanged += TextEditorTextChanged;
         }
 
         internal enum ExceedPolicyType
@@ -2017,32 +2024,6 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-        internal override bool IsBinded
-        {
-            get
-            {
-                return base.IsBinded;
-            }
-            set
-            {
-                base.IsBinded = value;
-
-                if (value == true)
-                {
-                    TextChanged += TextEditorTextChanged;
-                }
-                else
-                {
-                    TextChanged -= TextEditorTextChanged;
-                }
-            }
-        }
-
-        private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
-        {
-            ForceNotifyBindedInstance(TextProperty);
-        }
-
         /// <summary>
         /// Get the InputMethodContext instance.
         /// </summary>
@@ -2165,10 +2146,7 @@ namespace Tizen.NUI.BaseComponents
                 }
             }
 
-            if (IsBinded)
-            {
-                TextChanged -= TextEditorTextChanged;
-            }
+            TextChanged -= TextEditorTextChanged;
 
             base.Dispose(type);
         }
@@ -2259,6 +2237,14 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (!isSettingTextInCSharp)
+            {
+                ForceNotifyBindedInstance(TextProperty);
+            }
+        }
+
         internal new class Property
         {
             internal static readonly int TEXT = Interop.TextField.TextGet();
index 9ba8fd2..3db6918 100755 (executable)
@@ -84,7 +84,9 @@ namespace Tizen.NUI.BaseComponents
             var textField = (TextField)bindable;
             if (newValue != null)
             {
+                textField.isSettingTextInCSharp = true;
                 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue((string)newValue));
+                textField.isSettingTextInCSharp = false;
             }
         }),
         defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
index 9ec42de..e7c0855 100755 (executable)
@@ -667,7 +667,7 @@ namespace Tizen.NUI
             if (bindable == null)
                 throw new ArgumentNullException(nameof(bindable));
 
-            bindable.SetValueCore(property, value, SetValueFlags.None, SetValuePrivateFlags.ManuallySet, false);
+            bindable.SetValueCore(property, value, SetValueFlags.None, SetValuePrivateFlags.ManuallySet);
         }
         internal static void OnChildPropertyChanged(Binding.BindableObject bindable, object oldValue, object newValue)
         {
index 426fb55..3f5a40a 100755 (executable)
@@ -217,6 +217,51 @@ namespace Tizen.NUI.Binding
             set;
         }
 
+        /// This will be public opened in next ACR.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void ForceNotifyBindedInstance(BindableProperty property)
+        {
+            if (null != property)
+            {
+                BindablePropertyContext context = GetOrCreateContext(property);
+                BindingBase binding = context.Binding;
+
+                var currentlyApplying = applying;
+
+                if (binding != null && !currentlyApplying)
+                {
+                    applying = true;
+                    binding.Apply(true);
+                    applying = false;
+                }
+
+                OnPropertyChanged(property.PropertyName);
+
+                PropertyToGroup.TryGetValue(property, out HashSet<BindableProperty> propertyGroup);
+
+                if (null != propertyGroup)
+                {
+                    foreach (var relativeProperty in propertyGroup)
+                    {
+                        if (relativeProperty != property)
+                        {
+                            var relativeContext = GetOrCreateContext(relativeProperty);
+                            var relativeBinding = relativeContext.Binding;
+
+                            if (null != relativeBinding)
+                            {
+                                applying = true;
+                                relativeBinding.Apply(true);
+                                applying = false;
+                            }
+
+                            OnPropertyChanged(relativeProperty.PropertyName);
+                        }
+                    }
+                }
+            }
+        }
+
         /// <summary>
         /// Sets the value of the specified property.
         /// </summary>
@@ -260,48 +305,6 @@ namespace Tizen.NUI.Binding
             }
         }
 
-        /// This will be public opened in next ACR.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public void ForceNotifyBindedInstance(BindableProperty property)
-        {
-            if (null != property)
-            {
-                BindablePropertyContext context = GetOrCreateContext(property);
-
-                if (null != context?.Binding)
-                {
-                    applying = true;
-                    context.Binding.Apply(true);
-                    applying = false;
-                }
-
-                OnPropertyChanged(property.PropertyName);
-
-                PropertyToGroup.TryGetValue(property, out HashSet<BindableProperty> propertyGroup);
-
-                if (null != propertyGroup)
-                {
-                    foreach (var relativeProperty in propertyGroup)
-                    {
-                        if (relativeProperty != property)
-                        {
-                            var relativeContext = GetOrCreateContext(relativeProperty);
-                            var relativeBinding = relativeContext.Binding;
-
-                            if (null != relativeBinding)
-                            {
-                                applying = true;
-                                relativeBinding.Apply(true);
-                                applying = false;
-                            }
-
-                            OnPropertyChanged(relativeProperty.PropertyName);
-                        }
-                    }
-                }
-            }
-        }
-
         /// <summary>
         /// Sets the value of the propertyKey.
         /// </summary>
@@ -643,7 +646,7 @@ namespace Tizen.NUI.Binding
 
         internal void SetValueCore(BindablePropertyKey propertyKey, object value, SetValueFlags attributes = SetValueFlags.None)
         {
-            SetValueCore(propertyKey.BindableProperty, value, attributes, SetValuePrivateFlags.None, false);
+            SetValueCore(propertyKey.BindableProperty, value, attributes, SetValuePrivateFlags.None);
         }
 
         /// <summary>
@@ -655,10 +658,10 @@ namespace Tizen.NUI.Binding
         [EditorBrowsable(EditorBrowsableState.Never)]
         internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None)
         {
-            SetValueCore(property, value, attributes, SetValuePrivateFlags.Default, false);
+            SetValueCore(property, value, attributes, SetValuePrivateFlags.Default);
         }
 
-        internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, bool forceSendChangeSignal)
+        internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
         {
             bool checkAccess = (privateAttributes & SetValuePrivateFlags.CheckAccess) != 0;
             bool manuallySet = (privateAttributes & SetValuePrivateFlags.ManuallySet) != 0;
@@ -716,7 +719,7 @@ namespace Tizen.NUI.Binding
             else
             {
                 context.Attributes |= BindableContextAttributes.IsBeingSet;
-                SetValueActual(property, context, value, currentlyApplying, forceSendChangeSignal, attributes, silent);
+                SetValueActual(property, context, value, currentlyApplying, attributes, silent);
 
                 Queue<SetValueArgs> delayQueue = context.DelayedSetters;
                 if (delayQueue != null)
@@ -724,7 +727,7 @@ namespace Tizen.NUI.Binding
                     while (delayQueue.Count > 0)
                     {
                         SetValueArgs s = delayQueue.Dequeue();
-                        SetValueActual(s.Property, s.Context, s.Value, s.CurrentlyApplying, forceSendChangeSignal, s.Attributes);
+                        SetValueActual(s.Property, s.Context, s.Value, s.CurrentlyApplying, s.Attributes);
                     }
 
                     context.DelayedSetters = null;
@@ -752,7 +755,7 @@ namespace Tizen.NUI.Binding
             }
         }
 
-        internal virtual bool IsBinded
+        internal bool IsBinded
         {
             get;
             set;
@@ -890,11 +893,10 @@ namespace Tizen.NUI.Binding
                 return;
 
             SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearDynamicResource,
-                (fromStyle ? SetValuePrivateFlags.FromStyle : SetValuePrivateFlags.ManuallySet) | (checkAccess ? SetValuePrivateFlags.CheckAccess : 0),
-                false);
+                (fromStyle ? SetValuePrivateFlags.FromStyle : SetValuePrivateFlags.ManuallySet) | (checkAccess ? SetValuePrivateFlags.CheckAccess : 0));
         }
 
-        void SetValueActual(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, bool forceSendChangeSignal, SetValueFlags attributes, bool silent = false)
+        void SetValueActual(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, SetValueFlags attributes, bool silent = false)
         {
             object original = context.Value;
             bool raiseOnEqual = (attributes & SetValueFlags.RaiseOnEqual) != 0;
@@ -933,71 +935,36 @@ namespace Tizen.NUI.Binding
 
             PropertyToGroup.TryGetValue(property, out HashSet<BindableProperty> propertyGroup);
 
-            if (!silent)
+            if (!silent && (!same || raiseOnEqual))
             {
-                if ((!same || raiseOnEqual))
-                {
-                    property.PropertyChanged?.Invoke(this, original, value);
+                property.PropertyChanged?.Invoke(this, original, value);
 
-                    if (binding != null && !currentlyApplying)
-                    {
-                        applying = true;
-                        binding.Apply(true);
-                        applying = false;
-                    }
-
-                    OnPropertyChanged(property.PropertyName);
-
-                    if (null != propertyGroup)
-                    {
-                        foreach (var relativeProperty in propertyGroup)
-                        {
-                            if (relativeProperty != property)
-                            {
-                                var relativeContext = GetOrCreateContext(relativeProperty);
-                                var relativeBinding = relativeContext.Binding;
-
-                                if (null != relativeBinding)
-                                {
-                                    applying = true;
-                                    relativeBinding.Apply(true);
-                                    applying = false;
-                                }
-
-                                OnPropertyChanged(relativeProperty.PropertyName);
-                            }
-                        }
-                    }
-                }
-                else if (true == same && true == forceSendChangeSignal)
+                if (binding != null && !currentlyApplying)
                 {
-                    if (binding != null && !currentlyApplying)
-                    {
-                        applying = true;
-                        binding.Apply(true);
-                        applying = false;
-                    }
+                    applying = true;
+                    binding.Apply(true);
+                    applying = false;
+                }
 
-                    OnPropertyChanged(property.PropertyName);
+                OnPropertyChanged(property.PropertyName);
 
-                    if (null != propertyGroup)
+                if (null != propertyGroup)
+                {
+                    foreach (var relativeProperty in propertyGroup)
                     {
-                        foreach (var relativeProperty in propertyGroup)
+                        if (relativeProperty != property)
                         {
-                            if (relativeProperty != property)
-                            {
-                                var relativeContext = GetOrCreateContext(relativeProperty);
-                                var relativeBinding = relativeContext.Binding;
-
-                                if (null != relativeBinding)
-                                {
-                                    applying = true;
-                                    relativeBinding.Apply(true);
-                                    applying = false;
-                                }
+                            var relativeContext = GetOrCreateContext(relativeProperty);
+                            var relativeBinding = relativeContext.Binding;
 
-                                OnPropertyChanged(relativeProperty.PropertyName);
+                            if (null != relativeBinding)
+                            {
+                                applying = true;
+                                relativeBinding.Apply(true);
+                                applying = false;
                             }
+
+                            OnPropertyChanged(relativeProperty.PropertyName);
                         }
                     }
                 }
index 7061209..6c68f43 100755 (executable)
@@ -247,7 +247,7 @@ namespace Tizen.NUI.Binding.Internals
                     // Log.Warning("Binding", "{0} can not be converted to type '{1}'", value, property.ReturnType);
                     return;
                 }
-                target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted, false);
+                target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted);
                 return;
             }