From 861484e073a09ce20520f36a338e0227c79d1267 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Thu, 9 Jun 2022 13:15:39 +0900 Subject: [PATCH] [NUI] Replace GetValueByDescription in TextLabel Alignment 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. --- .../BaseComponents/TextLabelBindableProperty.cs | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs index d20632c..5ec42c5 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs @@ -174,7 +174,24 @@ namespace Tizen.NUI.BaseComponents { NUILog.Error("HorizontalAlignment get error!"); } - return temp.GetValueByDescription(); + + 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(); + 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)] -- 2.7.4