[NUI] Fix textfield color issue (#1213)
authorXianbing Teng <xb.teng@samsung.com>
Thu, 19 Dec 2019 09:15:30 +0000 (17:15 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 19 Dec 2019 09:15:30 +0000 (18:15 +0900)
src/Tizen.NUI.Components/Controls/InputField.cs
src/Tizen.NUI/src/public/BaseComponents/Style/TextFieldStyle.cs
src/Tizen.NUI/src/public/BaseComponents/TextField.cs
src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs

index 52615e4..9e18669 100755 (executable)
@@ -159,10 +159,11 @@ namespace Tizen.NUI.Components
             set
             {
                 CreateTextFieldAttributes();
-                if (null != inputFieldAttrs?.InputBoxAttributes)
+                if (null != inputFieldAttrs?.InputBoxAttributes && null != value)
                 {
-                    inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor = value;
-                    if (null != textField) textField.PlaceholderTextColor = value;
+                    Vector4 color = new Vector4(value.R, value.G, value.B, value.A);
+                    inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor = color;
+                    if (null != textField) textField.PlaceholderTextColor = color;
                 }
             }
         }
@@ -182,10 +183,11 @@ namespace Tizen.NUI.Components
             set
             {
                 CreateTextFieldAttributes();
-                if (null == inputFieldAttrs?.InputBoxAttributes)
+                if (null != inputFieldAttrs?.InputBoxAttributes && null != value)
                 {
-                    inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor = value;
-                    if (null != textField) textField.PrimaryCursorColor = value;
+                    Vector4 color = new Vector4(value.R, value.G, value.B, value.A);
+                    inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor = color;
+                    if (null != textField) textField.PrimaryCursorColor = color;
                 }
             }
         }
index 0a13350..645957e 100755 (executable)
@@ -155,14 +155,14 @@ namespace Tizen.NUI.BaseComponents
         });
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Color>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        public static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Vector4>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var textFieldStyle = (TextFieldStyle)bindable;
             if (null == textFieldStyle.placeholderTextColorSelector)
             {
-                textFieldStyle.placeholderTextColorSelector = new Selector<Color>();
+                textFieldStyle.placeholderTextColorSelector = new Selector<Vector4>();
             }
-            textFieldStyle.placeholderTextColorSelector.Clone((Selector<Color>)newValue);
+            textFieldStyle.placeholderTextColorSelector.Clone((Selector<Vector4>)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
@@ -171,14 +171,14 @@ namespace Tizen.NUI.BaseComponents
         });
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Color>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        public static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Vector4>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var textFieldStyle = (TextFieldStyle)bindable;
             if (null == textFieldStyle.primaryCursorColorSelector)
             {
-                textFieldStyle.primaryCursorColorSelector = new Selector<Color>();
+                textFieldStyle.primaryCursorColorSelector = new Selector<Vector4>();
             }
-            textFieldStyle.primaryCursorColorSelector.Clone((Selector<Color>)newValue);
+            textFieldStyle.primaryCursorColorSelector.Clone((Selector<Vector4>)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
@@ -1087,14 +1087,14 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-        private Selector<Color> placeholderTextColorSelector;
+        private Selector<Vector4> placeholderTextColorSelector;
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public Selector<Color> PlaceholderTextColor
+        public Selector<Vector4> PlaceholderTextColor
         {
             get
             {
-                return (Selector<Color>)GetValue(PlaceholderTextColorSelectorProperty);
+                return (Selector<Vector4>)GetValue(PlaceholderTextColorSelectorProperty);
             }
             set
             {
@@ -1102,18 +1102,18 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-        private Selector<Color> primaryCursorColorSelector;
+        private Selector<Vector4> primaryCursorColorSelector;
         /// <summary>
         /// Gets or sets primary cursor color.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public Selector<Color> PrimaryCursorColor
+        public Selector<Vector4> PrimaryCursorColor
         {
             get
             {
-                return (Selector<Color>)GetValue(PrimaryCursorColorSelectorProperty);
+                return (Selector<Vector4>)GetValue(PrimaryCursorColorSelectorProperty);
             }
             set
             {
index 3ac0e1c..cd58f5b 100755 (executable)
@@ -1460,20 +1460,20 @@ namespace Tizen.NUI.BaseComponents
             var textField = (TextField)bindable;
             return textField.textColorSelector;
         });
-        internal static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Color>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+        internal static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var textField = (TextField)bindable;
-            textField.placeholderTextColorSelector.Clone((Selector<Color>)newValue);
+            textField.placeholderTextColorSelector.Clone((Selector<Vector4>)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
             var textField = (TextField)bindable;
             return textField.placeholderTextColorSelector;
         });
-        internal static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Color>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+        internal static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var textField = (TextField)bindable;
-            textField.primaryCursorColorSelector.Clone((Selector<Color>)newValue);
+            textField.primaryCursorColorSelector.Clone((Selector<Vector4>)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
@@ -1559,27 +1559,27 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-        private TriggerableSelector<Color> _placeholderTextColorSelector;
-        private TriggerableSelector<Color> placeholderTextColorSelector
+        private TriggerableSelector<Vector4> _placeholderTextColorSelector;
+        private TriggerableSelector<Vector4> placeholderTextColorSelector
         {
             get
             {
                 if (null == _placeholderTextColorSelector)
                 {
-                    _placeholderTextColorSelector = new TriggerableSelector<Color>(this, PlaceholderTextColorProperty);
+                    _placeholderTextColorSelector = new TriggerableSelector<Vector4>(this, PlaceholderTextColorProperty);
                 }
                 return _placeholderTextColorSelector;
             }
         }
 
-        private TriggerableSelector<Color> _primaryCursorColorSelector;
-        private TriggerableSelector<Color> primaryCursorColorSelector
+        private TriggerableSelector<Vector4> _primaryCursorColorSelector;
+        private TriggerableSelector<Vector4> primaryCursorColorSelector
         {
             get
             {
                 if (null == _primaryCursorColorSelector)
                 {
-                    _primaryCursorColorSelector = new TriggerableSelector<Color>(this, PrimaryCursorColorProperty);
+                    _primaryCursorColorSelector = new TriggerableSelector<Vector4>(this, PrimaryCursorColorProperty);
                 }
                 return _primaryCursorColorSelector;
             }
index 8fad3fb..f084ccb 100755 (executable)
@@ -262,9 +262,7 @@ namespace Tizen.NUI.BaseComponents
             var textField = (TextField)bindable;
             if (newValue != null)
             {
-                Color color = (Color)newValue;
-                Vector4 vector = new Vector4(color.R, color.G, color.B, color.A);
-                Tizen.NUI.Object.SetProperty(textField.swigCPtr, TextField.Property.PLACEHOLDER_TEXT_COLOR, new Tizen.NUI.PropertyValue(vector));
+                Tizen.NUI.Object.SetProperty(textField.swigCPtr, TextField.Property.PLACEHOLDER_TEXT_COLOR, new Tizen.NUI.PropertyValue((Vector4)newValue));
             }
         },
         defaultValueCreator: (bindable) =>
@@ -315,9 +313,7 @@ namespace Tizen.NUI.BaseComponents
             var textField = (TextField)bindable;
             if (newValue != null)
             {
-                Color color = (Color)newValue;
-                Vector4 vector = new Vector4(color.R, color.G, color.B, color.A);
-                Tizen.NUI.Object.SetProperty(textField.swigCPtr, TextField.Property.PRIMARY_CURSOR_COLOR, new Tizen.NUI.PropertyValue(vector));
+                Tizen.NUI.Object.SetProperty(textField.swigCPtr, TextField.Property.PRIMARY_CURSOR_COLOR, new Tizen.NUI.PropertyValue((Vector4)newValue));
             }
         },
         defaultValueCreator: (bindable) =>