When we create ImageView with url, It will create image visual twice.
To avoid this situation, make we replace internal url value for
creation time.
And also, setup some missing values when we inputed desired size.
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
private EventHandler<ResourceLoadedEventArgs> _resourceLoadedEventHandler;
private _resourceLoadedCallbackType _resourceLoadedCallback;
private EventHandler<ResourceLoadedEventArgs> _resourceLoadedEventHandler;
private _resourceLoadedCallbackType _resourceLoadedCallback;
+ /// <summary>
+ /// Convert non-null string that some keyword change as application specific directory.
+ /// </summary>
+ /// <param name="value">Inputed and replaced after this function finished</param>
+ /// <returns>Replaced url</returns>
+ private static string ConvertResourceUrl(ref string value)
+ {
+ value ??= "";
+ if (value.StartsWith("*Resource*"))
+ {
+ string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+ value = value.Replace("*Resource*", resource);
+ }
+ return value;
+ }
+
// Collection of image-sensitive properties.
private static readonly List<int> cachedImagePropertyKeyList = new List<int> {
Visual.Property.Type,
// Collection of image-sensitive properties.
private static readonly List<int> cachedImagePropertyKeyList = new List<int> {
Visual.Property.Type,
/// </summary>
/// <param name="url">The URL of the image resource to display.</param>
/// <since_tizen> 3 </since_tizen>
/// </summary>
/// <param name="url">The URL of the image resource to display.</param>
/// <since_tizen> 3 </since_tizen>
- public ImageView(string url) : this(Interop.ImageView.New(url), true)
+ public ImageView(string url) : this(Interop.ImageView.New(ConvertResourceUrl(ref url)), true)
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
/// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
[EditorBrowsable(EditorBrowsableState.Never)]
/// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
/// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
[EditorBrowsable(EditorBrowsableState.Never)]
- public ImageView(string url, bool shown) : this(Interop.ImageView.New(url), true)
+ public ImageView(string url, bool shown) : this(Interop.ImageView.New(ConvertResourceUrl(ref url)), true)
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
SetVisible(shown);
}
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
SetVisible(shown);
}
- internal ImageView(string url, Uint16Pair size, bool shown = true) : this(Interop.ImageView.New(url, Uint16Pair.getCPtr(size)), true)
+ internal ImageView(string url, Uint16Pair size, bool shown = true) : this(Interop.ImageView.New(ConvertResourceUrl(ref url), Uint16Pair.getCPtr(size)), true)
+ _resourceUrl = url;
+ _desired_width = size?.GetWidth() ?? -1;
+ _desired_height = size?.GetHeight() ?? -1;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
if (!shown)
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
if (!shown)
- Interop.ImageView.SetImage(SwigCPtr, url);
+ Interop.ImageView.SetImage(SwigCPtr, ConvertResourceUrl(ref url));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- Interop.ImageView.SetImage(SwigCPtr, url, Uint16Pair.getCPtr(size));
+ Interop.ImageView.SetImage(SwigCPtr, ConvertResourceUrl(ref url), Uint16Pair.getCPtr(size));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ _resourceUrl = url;
+ _desired_width = size?.GetWidth() ?? -1;
+ _desired_height = size?.GetHeight() ?? -1;
}
internal ViewResourceReadySignal ResourceReadySignal(View view)
}
internal ViewResourceReadySignal ResourceReadySignal(View view)
private void SetResourceUrl(string value)
{
private void SetResourceUrl(string value)
{
- value = (value == null ? "" : value);
- if (value.StartsWith("*Resource*"))
- {
- string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
- value = value.Replace("*Resource*", resource);
- }
- if(_resourceUrl != value)
+ if(_resourceUrl != ConvertResourceUrl(ref value))
{
_resourceUrl = value;
if(string.IsNullOrEmpty(_resourceUrl))
{
_resourceUrl = value;
if(string.IsNullOrEmpty(_resourceUrl))