Support TranslatablePlaceholderTextFocused to TextField
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 4 Mar 2021 08:05:31 +0000 (17:05 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 11 Mar 2021 05:48:48 +0000 (14:48 +0900)
PlaceholderTextFoused can set the SID value by this patch

Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
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
src/Tizen.NUI/src/public/BaseComponents/TextFieldSelectorData.cs

index d969960..fabc858 100755 (executable)
@@ -51,6 +51,18 @@ namespace Tizen.NUI.BaseComponents
             var textFieldStyle = (TextFieldStyle)bindable;
             return textFieldStyle.translatablePlaceholderTextSelector;
         });
+        /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty TranslatablePlaceholderTextFocusedSelectorProperty = BindableProperty.Create("TranslatablePlaceholderTextFocusedSelector", typeof(Selector<string>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var textFieldStyle = (TextFieldStyle)bindable;
+            textFieldStyle.translatablePlaceholderTextFocusedSelector = ((Selector<string>)newValue)?.Clone();
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var textFieldStyle = (TextFieldStyle)bindable;
+            return textFieldStyle.translatablePlaceholderTextFocusedSelector;
+        });
         /// 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 TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
@@ -517,6 +529,7 @@ namespace Tizen.NUI.BaseComponents
         private bool? matchSystemLanguageDirection;
         private Selector<string> translatableTextSelector;
         private Selector<string> translatablePlaceholderTextSelector;
+        private Selector<string> translatablePlaceholderTextFocusedSelector;
         private Selector<string> textSelector;
         private Selector<string> fontFamilySelector;
         private Selector<Color> textColorSelector;
@@ -567,6 +580,18 @@ namespace Tizen.NUI.BaseComponents
             set => SetValue(TranslatablePlaceholderTextSelectorProperty, value);
         }
 
+        /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Selector<string> TranslatablePlaceholderTextFocused
+        {
+            get
+            {
+                Selector<string> tmp = (Selector<string>)GetValue(TranslatablePlaceholderTextFocusedSelectorProperty);
+                return (null != tmp) ? tmp : translatablePlaceholderTextFocusedSelector = new Selector<string>();
+            }
+            set => SetValue(TranslatablePlaceholderTextFocusedSelectorProperty, value);
+        }
+
         /// 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<string> Text
index 5e57074..da4f0f6 100755 (executable)
@@ -32,6 +32,7 @@ namespace Tizen.NUI.BaseComponents
     {
         private string textFieldTextSid = null;
         private string textFieldPlaceHolderTextSid = null;
+        private string textFieldPlaceHolderTextFocusedSid = null;
         private bool systemlangTextFlag = false;
         private InputMethodContext inputMethodCotext = null;
         private TextFieldSelectorData selectorData;
@@ -183,6 +184,45 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// The TranslatablePlaceholderTextFocused property.<br />
+        /// The text can set the SID value.<br />
+        /// </summary>
+        /// <exception cref='ArgumentNullException'>
+        /// ResourceManager about multilingual is null.
+        /// </exception>
+        /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string TranslatablePlaceholderTextFocused
+        {
+            get
+            {
+                return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
+            }
+            set
+            {
+                SetValue(TranslatablePlaceholderTextFocusedProperty, value);
+                selectorData?.TranslatablePlaceholderTextFocused.UpdateIfNeeds(this, value);
+            }
+        }
+        private string translatablePlaceholderTextFocused
+        {
+            get
+            {
+                return textFieldPlaceHolderTextFocusedSid;
+            }
+            set
+            {
+                if (NUIApplication.MultilingualResourceManager == null)
+                {
+                    throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
+                }
+                textFieldPlaceHolderTextFocusedSid = value;
+                PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
+                NotifyPropertyChanged();
+            }
+        }
+
+        /// <summary>
         /// The Text property.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
@@ -1450,6 +1490,10 @@ namespace Tizen.NUI.BaseComponents
             {
                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
             }
+            if (textFieldPlaceHolderTextFocusedSid != null)
+            {
+                PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
+            }
         }
 
         internal new class Property
index 5ea8eb5..70764f6 100755 (executable)
@@ -60,6 +60,23 @@ namespace Tizen.NUI.BaseComponents
             var textField = (TextField)bindable;
             return textField.translatablePlaceholderText;
         });
+        /// <summary>
+        /// TranslatablePlaceholderTextFocused property
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty TranslatablePlaceholderTextFocusedProperty = BindableProperty.Create(nameof(TranslatablePlaceholderTextFocused), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var textField = (TextField)bindable;
+            if (newValue != null)
+            {
+                textField.translatablePlaceholderTextFocused = (string)newValue;
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var textField = (TextField)bindable;
+            return textField.translatablePlaceholderTextFocused;
+        });
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
@@ -991,6 +1008,16 @@ namespace Tizen.NUI.BaseComponents
             var textField = (TextField)bindable;
             return textField.SelectorData.TranslatablePlaceholderText.Get(textField);
         });
+        internal static readonly BindableProperty TranslatablePlaceholderTextFocusedSelectorProperty = BindableProperty.Create("TranslatablePlaceholderTextFocusedSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var textField = (TextField)bindable;
+            textField.SelectorData.TranslatablePlaceholderTextFocused.Update(textField, (Selector<string>)newValue, true);
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var textField = (TextField)bindable;
+            return textField.SelectorData.TranslatablePlaceholderTextFocused.Get(textField);
+        });
         internal static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var textField = (TextField)bindable;
index 7488882..cabfa80 100755 (executable)
@@ -28,6 +28,7 @@ namespace Tizen.NUI.BaseComponents
         public TriggerableSelector<Color> TextColor { get; } = new TriggerableSelector<Color>(TextField.TextColorProperty, GetTextColor);
         public TriggerableSelector<float?> PointSize { get; } = new TriggerableSelector<float?>(TextField.PointSizeProperty);
         public TriggerableSelector<string> TranslatablePlaceholderText { get; } = new TriggerableSelector<string>(TextField.TranslatablePlaceholderTextProperty);
+        public TriggerableSelector<string> TranslatablePlaceholderTextFocused { get; } = new TriggerableSelector<string>(TextField.TranslatablePlaceholderTextFocusedProperty);
         public TriggerableSelector<Vector4> PlaceholderTextColor { get; } = new TriggerableSelector<Vector4>(TextField.PlaceholderTextColorProperty, delegate (View view)
         {
             Vector4 color = new Vector4();
@@ -56,6 +57,7 @@ namespace Tizen.NUI.BaseComponents
             TextColor.Reset(view);
             PointSize.Reset(view);
             TranslatablePlaceholderText.Reset(view);
+            TranslatablePlaceholderTextFocused.Reset(view);
             PlaceholderTextColor.Reset(view);
             PrimaryCursorColor.Reset(view);
         }