diff --git a/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin.aar b/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin.aar index 37902632..8c4a4771 100644 Binary files a/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin.aar and b/dist/package-nofragment/Assets/Plugins/Android/WebViewPlugin.aar differ diff --git a/dist/package-nofragment/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs b/dist/package-nofragment/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs index a6796bcb..83930e39 100644 --- a/dist/package-nofragment/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs +++ b/dist/package-nofragment/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs @@ -75,6 +75,8 @@ public void OnPostGenerateGradleAndroidProject(string basePath) { } } } + changed = (androidManifest.SetApplicationTheme("@style/UnityThemeSelector") || changed); + changed = (androidManifest.SetActivityTheme("@style/UnityThemeSelector.Translucent") || changed); changed = (androidManifest.SetHardwareAccelerated(true) || changed); #if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC changed = (androidManifest.SetUsesCleartextTraffic(true) || changed); @@ -294,6 +296,25 @@ internal bool SetUsesCleartextTraffic(bool enabled) { return changed; } + internal bool SetApplicationTheme(string theme) { + bool changed = false; + if (ApplicationElement.GetAttribute("theme", AndroidXmlNamespace) != theme) { + ApplicationElement.SetAttribute("theme", AndroidXmlNamespace, theme); + changed = true; + } + return changed; + } + + internal bool SetActivityTheme(string theme) { + bool changed = false; + var activity = GetActivityWithLaunchIntent() as XmlElement; + if (activity.GetAttribute("theme", AndroidXmlNamespace) != theme) { + activity.SetAttribute("theme", AndroidXmlNamespace, theme); + changed = true; + } + return changed; + } + internal bool SetHardwareAccelerated(bool enabled) { bool changed = false; var activity = GetActivityWithLaunchIntent() as XmlElement; diff --git a/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView b/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView index 4aa4bab5..8ccf1f4c 100755 Binary files a/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView and b/dist/package-nofragment/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView differ diff --git a/dist/package-nofragment/Assets/Plugins/iOS/WebView.mm b/dist/package-nofragment/Assets/Plugins/iOS/WebView.mm index 48d6d6f7..4de85e4c 100644 --- a/dist/package-nofragment/Assets/Plugins/iOS/WebView.mm +++ b/dist/package-nofragment/Assets/Plugins/iOS/WebView.mm @@ -217,7 +217,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra [webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil]; - [view addSubview:webView]; + [view.superview insertSubview:webView atIndex:0]; return self; } diff --git a/dist/package-nofragment/Assets/Plugins/iOS/WebViewWithUIWebView.mm b/dist/package-nofragment/Assets/Plugins/iOS/WebViewWithUIWebView.mm index 17f0cf31..4ea24b36 100644 --- a/dist/package-nofragment/Assets/Plugins/iOS/WebViewWithUIWebView.mm +++ b/dist/package-nofragment/Assets/Plugins/iOS/WebViewWithUIWebView.mm @@ -277,7 +277,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra [webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil]; - [view addSubview:webView]; + [view.superview insertSubview:webView atIndex:0]; return self; } diff --git a/dist/package/Assets/Plugins/Android/WebViewPlugin.aar b/dist/package/Assets/Plugins/Android/WebViewPlugin.aar index 4a31fb27..7b4644a7 100644 Binary files a/dist/package/Assets/Plugins/Android/WebViewPlugin.aar and b/dist/package/Assets/Plugins/Android/WebViewPlugin.aar differ diff --git a/dist/package/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs b/dist/package/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs index ea584d6a..50104db9 100644 --- a/dist/package/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs +++ b/dist/package/Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs @@ -75,6 +75,8 @@ public void OnPostGenerateGradleAndroidProject(string basePath) { } } } + changed = (androidManifest.SetApplicationTheme("@style/UnityThemeSelector") || changed); + changed = (androidManifest.SetActivityTheme("@style/UnityThemeSelector.Translucent") || changed); changed = (androidManifest.SetHardwareAccelerated(true) || changed); #if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC changed = (androidManifest.SetUsesCleartextTraffic(true) || changed); @@ -294,6 +296,25 @@ internal bool SetUsesCleartextTraffic(bool enabled) { return changed; } + internal bool SetApplicationTheme(string theme) { + bool changed = false; + if (ApplicationElement.GetAttribute("theme", AndroidXmlNamespace) != theme) { + ApplicationElement.SetAttribute("theme", AndroidXmlNamespace, theme); + changed = true; + } + return changed; + } + + internal bool SetActivityTheme(string theme) { + bool changed = false; + var activity = GetActivityWithLaunchIntent() as XmlElement; + if (activity.GetAttribute("theme", AndroidXmlNamespace) != theme) { + activity.SetAttribute("theme", AndroidXmlNamespace, theme); + changed = true; + } + return changed; + } + internal bool SetHardwareAccelerated(bool enabled) { bool changed = false; var activity = GetActivityWithLaunchIntent() as XmlElement; diff --git a/dist/package/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView b/dist/package/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView index 4aa4bab5..8ccf1f4c 100755 Binary files a/dist/package/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView and b/dist/package/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView differ diff --git a/dist/package/Assets/Plugins/iOS/WebView.mm b/dist/package/Assets/Plugins/iOS/WebView.mm index 48d6d6f7..4de85e4c 100644 --- a/dist/package/Assets/Plugins/iOS/WebView.mm +++ b/dist/package/Assets/Plugins/iOS/WebView.mm @@ -217,7 +217,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra [webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil]; - [view addSubview:webView]; + [view.superview insertSubview:webView atIndex:0]; return self; } diff --git a/dist/package/Assets/Plugins/iOS/WebViewWithUIWebView.mm b/dist/package/Assets/Plugins/iOS/WebViewWithUIWebView.mm index 17f0cf31..4ea24b36 100644 --- a/dist/package/Assets/Plugins/iOS/WebViewWithUIWebView.mm +++ b/dist/package/Assets/Plugins/iOS/WebViewWithUIWebView.mm @@ -277,7 +277,7 @@ - (id)initWithGameObjectName:(const char *)gameObjectName_ transparent:(BOOL)tra [webView addObserver:self forKeyPath: @"loading" options: NSKeyValueObservingOptionNew context:nil]; - [view addSubview:webView]; + [view.superview insertSubview:webView atIndex:0]; return self; } diff --git a/dist/unity-webview-nofragment.unitypackage b/dist/unity-webview-nofragment.unitypackage index 2b2cb7f3..2856ac5a 100644 Binary files a/dist/unity-webview-nofragment.unitypackage and b/dist/unity-webview-nofragment.unitypackage differ diff --git a/dist/unity-webview-nofragment.zip b/dist/unity-webview-nofragment.zip index e2765ef3..8b1096c9 100644 Binary files a/dist/unity-webview-nofragment.zip and b/dist/unity-webview-nofragment.zip differ diff --git a/dist/unity-webview.unitypackage b/dist/unity-webview.unitypackage index 4315e382..3ee10c48 100644 Binary files a/dist/unity-webview.unitypackage and b/dist/unity-webview.unitypackage differ diff --git a/dist/unity-webview.zip b/dist/unity-webview.zip index b221b8fb..c5ea66fd 100644 Binary files a/dist/unity-webview.zip and b/dist/unity-webview.zip differ