From: huayongxu <49056704+huayongxu@users.noreply.github.com>
Date: Wed, 3 Feb 2021 06:01:22 +0000 (+0800)
Subject: [NUI] Add a VideoHoleEnabled property into WebView. (#2607)
X-Git-Tag: accepted/tizen/6.0/unified/20210204.104957~1^2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=346c1aa58fd686cfa913403955cb1d725cc61f22;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
[NUI] Add a VideoHoleEnabled property into WebView. (#2607)
Video hole is used for playing videos with high quality in WebView.
This patch is to add a VideoHoleEnabled property.
---
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
index 3e46570..e9a28e9 100755
--- a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
+++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
@@ -46,7 +46,10 @@ namespace Tizen.NUI
public static extern int ContentSizeGet();
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_TITLE_get")]
- public static extern int WebView_Property_TITLE_get();
+ public static extern int TitleGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_VIDEO_HOLE_ENABLED_get")]
+ public static extern int VideoHoleEnabledGet();
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetFavicon")]
public static extern global::System.IntPtr WebView_GetFavicon(global::System.Runtime.InteropServices.HandleRef jarg1);
diff --git a/src/Tizen.NUI/src/internal/WebView.cs b/src/Tizen.NUI/src/internal/WebView.cs
index 36a6c8d..b9409d2 100755
--- a/src/Tizen.NUI/src/internal/WebView.cs
+++ b/src/Tizen.NUI/src/internal/WebView.cs
@@ -167,7 +167,8 @@ namespace Tizen.NUI
internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
- internal static readonly int Title = Interop.WebView.WebView_Property_TITLE_get();
+ internal static readonly int Title = Interop.WebView.TitleGet();
+ internal static readonly int VideoHoleEnabled = Interop.WebView.VideoHoleEnabledGet();
}
private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
@@ -242,8 +243,24 @@ namespace Tizen.NUI
return title;
});
+ private static readonly BindableProperty VideoHoleEnabledProperty = BindableProperty.Create(nameof(VideoHoleEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ bool temp;
+ Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled).Get(out temp);
+ return temp;
+ });
+
///
- /// Creates an uninitialized WebView.
+ /// Creates a WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public WebView() : this(Interop.WebView.WebView_New(), true)
@@ -252,9 +269,9 @@ namespace Tizen.NUI
}
///
- /// Creates an uninitialized WebView.
- /// The locale of Web
- /// The timezoneId of Web
+ /// Creates a WebView with local language and time zone.
+ /// The locale language of Web
+ /// The time zone Id of Web
///
[EditorBrowsable(EditorBrowsableState.Never)]
public WebView(string locale, string timezoneId) : this(Interop.WebView.WebView_New_2(locale, timezoneId), true)
@@ -263,11 +280,11 @@ namespace Tizen.NUI
}
///
- /// Creates an uninitialized WebView.
- /// args array
+ /// Creates a WebView with an args list.
+ /// args array. The first value of array must be program's name.
///
[EditorBrowsable(EditorBrowsableState.Never)]
- public WebView(string[] args) : this(Interop.WebView.WebView_New_3(args.Length, args), true)
+ public WebView(string[] args) : this(Interop.WebView.WebView_New_3(args?.Length ?? 0, args), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
@@ -487,6 +504,23 @@ namespace Tizen.NUI
}
///
+ /// Whether video hole is enabled or not.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool VideoHoleEnabled
+ {
+ get
+ {
+ return (bool)GetValue(VideoHoleEnabledProperty);
+ }
+ set
+ {
+ SetValue(VideoHoleEnabledProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
+ ///
/// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when page loading has started.
///
@@ -611,6 +645,8 @@ namespace Tizen.NUI
get
{
global::System.IntPtr imageView = Interop.WebView.WebView_GetFavicon(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ return null;
return new ImageView(imageView, false);
}
}