[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 d20632c92db0ec1b9d92c11f1a4b9c6bd392ce5f..5ec42c53d52d35a5f273297cc362d57235a0e969 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)]