From: Jiyun Yang Date: Thu, 27 Aug 2020 05:52:32 +0000 (+0900) Subject: [NUI] Fix View.BackgroundImage getter and View.ImageSyncronousLoading to support... X-Git-Tag: accepted/tizen/unified/20210219.040944~462 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=79bb0e58e031db494de42f661b4cbf84591e4f23;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Fix View.BackgroundImage getter and View.ImageSyncronousLoading to support all possible visuals. (#1857) Previous code, it didn't work for other visuals except ImageVisual. Signed-off-by: Jiyun Yang Co-authored-by: WonYoung Choi --- diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 8b27138..29e716b 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -2215,15 +2215,11 @@ namespace Tizen.NUI.BaseComponents set { _backgroundImageSynchronosLoading = value; - string bgUrl = ""; - int visualType = 0; - Background.Find(Visual.Property.Type)?.Get(out visualType); - if (visualType == (int)Visual.Type.Image) - { - Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl); - } - if (bgUrl.Length != 0) + string bgUrl = null; + Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl); + + if (!string.IsNullOrEmpty(bgUrl)) { PropertyMap bgMap = this.Background; bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading)); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs index a0493bb..72540a6 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs @@ -155,12 +155,7 @@ namespace Tizen.NUI.BaseComponents string backgroundImage = ""; Tizen.NUI.PropertyMap background = view.Background; - int visualType = 0; - background.Find(Visual.Property.Type)?.Get(out visualType); - if ((visualType == (int)Visual.Type.Image) || (visualType == (int)Visual.Type.NPatch)) - { - background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage); - } + background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage); return backgroundImage; }); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewSelectorData.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewSelectorData.cs index a977e65..35e83e4 100644 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewSelectorData.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewSelectorData.cs @@ -38,17 +38,9 @@ namespace Tizen.NUI.BaseComponents }); public TriggerableSelector BackgroundImage { get; } = new TriggerableSelector(View.BackgroundImageProperty, delegate(View view) { - var background = view.Background; - int visualType = 0; - background.Find(Visual.Property.Type)?.Get(out visualType); - - if ((visualType == (int)Visual.Type.Image) || (visualType == (int)Visual.Type.NPatch)) - { - string backgroundImage = ""; - background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage); - return backgroundImage; - } - return null; + string backgroundImage = null; + view.Background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage); + return backgroundImage; }); public TriggerableSelector BackgroundImageBorder { get; } = new TriggerableSelector(View.BackgroundImageBorderProperty); public TriggerableSelector Color { get; } = new TriggerableSelector(View.ColorProperty, delegate(View view)