[NUI] Fix RenderingBehavior issue, Support Resource path when using xaml (#480)
authordongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 20 Sep 2018 02:04:38 +0000 (11:04 +0900)
committerGitHub <noreply@github.com>
Thu, 20 Sep 2018 02:04:38 +0000 (11:04 +0900)
* [NUI] Fix RenderingBehavior issue

Change-Id: I35b83e115fd60d2b43ed49c2a35a0f34377e55c2
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Support Resource path when using xaml

Change-Id: I066c4a6b051bfdcc5fa6b26f9f784a2be5a255a7

src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
src/Tizen.NUI/src/public/Window.cs

index ae2d0cc..043cffd 100755 (executable)
@@ -36,7 +36,13 @@ namespace Tizen.NUI.BaseComponents
             var imageView = (ImageView)bindable;
             if (newValue != null)
             {
-                imageView._url = (newValue == null? "" : (string)newValue);
+                string url = (string)newValue;
+                if (imageView.IsCreateByXaml && url.Contains("*Resource*"))
+                {
+                    string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+                    url = url.Replace("*Resource*", resource);
+                }
+                imageView._url = url;
                 imageView.UpdateImage();
             }
         },
@@ -53,9 +59,44 @@ namespace Tizen.NUI.BaseComponents
             var imageView = (ImageView)bindable;
             if (newValue != null)
             {
+                PropertyMap map = (PropertyMap)newValue;
+                if (imageView.IsCreateByXaml)
+                {
+                    string url = "", alphaMaskURL="", auxiliaryImageURL = "";
+                    string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+                    PropertyValue urlValue = map.Find(NDalic.IMAGE_VISUAL_URL);
+                    bool ret = false;
+                    if (urlValue != null) ret = urlValue.Get(out url);
+                    PropertyMap mmap = new PropertyMap();
+                    if (ret && url.Contains("*Resource*"))
+                    {
+                        url = url.Replace("*Resource*", resource);
+                        mmap.Insert(NDalic.IMAGE_VISUAL_URL, new PropertyValue(url));
+                    }
+
+                    ret = false;
+                    PropertyValue alphaMaskUrlValue = map.Find(NDalic.IMAGE_VISUAL_ALPHA_MASK_URL);
+                    if (alphaMaskUrlValue != null) ret = alphaMaskUrlValue.Get(out alphaMaskURL);
+                    if (ret && alphaMaskURL.Contains("*Resource*"))
+                    {
+                        alphaMaskURL = alphaMaskURL.Replace("*Resource*", resource);
+                        mmap.Insert(NDalic.IMAGE_VISUAL_URL, new PropertyValue(alphaMaskURL));
+                    }
+
+                    ret = false;
+                    PropertyValue auxiliaryImageURLValue  = map.Find(NDalic.IMAGE_VISUAL_AUXILIARY_IMAGE_URL);
+                    if (auxiliaryImageURLValue != null) ret = auxiliaryImageURLValue.Get(out auxiliaryImageURL);
+                    if (ret && auxiliaryImageURL.Contains("*Resource*"))
+                    {
+                        auxiliaryImageURL = auxiliaryImageURL.Replace("*Resource*", resource);
+                        mmap.Insert(NDalic.IMAGE_VISUAL_AUXILIARY_IMAGE_URL, new PropertyValue(auxiliaryImageURL));
+                    }
+                    
+                    map.Merge(mmap);
+                }
                 if (imageView._border == null)
                 {
-                    Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
+                    Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(map));
                 }
             }
         },
index 8927c14..606292f 100755 (executable)
@@ -747,7 +747,7 @@ namespace Tizen.NUI
 
         internal RenderingBehaviorType GetRenderingBehavior()
         {
-            RenderingBehaviorType ret = (RenderingBehaviorType)NDalicPINVOKE.Stage_GetRenderingBehavior(swigCPtr);
+            RenderingBehaviorType ret = (RenderingBehaviorType)NDalicPINVOKE.Stage_GetRenderingBehavior(stageCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending)
                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;