[NUI] Replace GetValueByDescription in TextLabel Alignment
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Thu, 9 Jun 2022 04:15:39 +0000 (13:15 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 10 Jun 2022 05:42:51 +0000 (14:42 +0900)
Horizontal/VerticalAlignment of TextLabelBindableProperty calls
GetValueByDescription to convert DALi property to NUI property.

To improve performance, GetValueByDescription in TextLabel Alignment has
been replaced with string compare.

src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs

index d20632c..5ec42c5 100755 (executable)
@@ -174,7 +174,24 @@ namespace Tizen.NUI.BaseComponents
             {
                 NUILog.Error("HorizontalAlignment get error!");
             }
-            return temp.GetValueByDescription<HorizontalAlignment>();
+
+            if (System.String.IsNullOrEmpty(temp))
+            {
+                return HorizontalAlignment.Begin; // Return default value.
+            }
+
+            if (temp.Equals("BEGIN"))
+            {
+                return HorizontalAlignment.Begin;
+            }
+            else if (temp.Equals("CENTER"))
+            {
+                return HorizontalAlignment.Center;
+            }
+            else
+            {
+                return HorizontalAlignment.End;
+            }
         }));
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -195,7 +212,23 @@ namespace Tizen.NUI.BaseComponents
                 NUILog.Error("VerticalAlignment get error!");
             }
 
-            return temp.GetValueByDescription<VerticalAlignment>();
+            if (System.String.IsNullOrEmpty(temp))
+            {
+                return VerticalAlignment.Top; // Return default value.
+            }
+
+            if (temp.Equals("TOP"))
+            {
+                return VerticalAlignment.Top;
+            }
+            else if (temp.Equals("CENTER"))
+            {
+                return VerticalAlignment.Center;
+            }
+            else
+            {
+                return VerticalAlignment.Bottom;
+            }
         }));
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]