From 1ae7e8e98a1d47c6ca5a90ce567b987dc7ee3526 Mon Sep 17 00:00:00 2001 From: Koji Nakamaru Date: Sat, 11 Nov 2023 01:03:46 +0900 Subject: [PATCH] made CUnityAndroidActivity opaque and fixed about layout.setBackgroundColor(). --- .../java/net/gree/unitywebview/CUnityPlayerActivity.java | 8 ++++++++ .../main/java/net/gree/unitywebview/CWebViewPlugin.java | 2 +- .../java/net/gree/unitywebview/CUnityPlayerActivity.java | 8 ++++++++ .../main/java/net/gree/unitywebview/CWebViewPlugin.java | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/Android/webview-nofragment/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java b/plugins/Android/webview-nofragment/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java index fbbd8e91..d41587b7 100644 --- a/plugins/Android/webview-nofragment/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java +++ b/plugins/Android/webview-nofragment/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java @@ -1,5 +1,6 @@ package net.gree.unitywebview; +import android.graphics.Color; import android.graphics.Rect; import android.os.Bundle; import android.util.Log; @@ -15,6 +16,13 @@ public class CUnityPlayerActivity private List _webViews = new ArrayList(); private List _masks = new ArrayList(); + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + getWindow().getDecorView().setBackgroundColor(Color.BLACK); + } + @Override public boolean dispatchTouchEvent(MotionEvent event) { boolean ret = super.dispatchTouchEvent(event); diff --git a/plugins/Android/webview-nofragment/src/main/java/net/gree/unitywebview/CWebViewPlugin.java b/plugins/Android/webview-nofragment/src/main/java/net/gree/unitywebview/CWebViewPlugin.java index c4599514..07fe23ee 100644 --- a/plugins/Android/webview-nofragment/src/main/java/net/gree/unitywebview/CWebViewPlugin.java +++ b/plugins/Android/webview-nofragment/src/main/java/net/gree/unitywebview/CWebViewPlugin.java @@ -619,7 +619,7 @@ public void Destroy() { webView.stopLoading(); if (mVideoView != null) { layout.removeView(mVideoView); - layout.setBackgroundColor(0x00000000); + layout.setBackgroundColor(0xff000000); mVideoView = null; } layout.removeView(webView); diff --git a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java index fbbd8e91..d41587b7 100644 --- a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java +++ b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CUnityPlayerActivity.java @@ -1,5 +1,6 @@ package net.gree.unitywebview; +import android.graphics.Color; import android.graphics.Rect; import android.os.Bundle; import android.util.Log; @@ -15,6 +16,13 @@ public class CUnityPlayerActivity private List _webViews = new ArrayList(); private List _masks = new ArrayList(); + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + getWindow().getDecorView().setBackgroundColor(Color.BLACK); + } + @Override public boolean dispatchTouchEvent(MotionEvent event) { boolean ret = super.dispatchTouchEvent(event); diff --git a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CWebViewPlugin.java b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CWebViewPlugin.java index 0827c2b7..9dc20c61 100644 --- a/plugins/Android/webview/src/main/java/net/gree/unitywebview/CWebViewPlugin.java +++ b/plugins/Android/webview/src/main/java/net/gree/unitywebview/CWebViewPlugin.java @@ -937,7 +937,7 @@ public void Destroy() { webView.stopLoading(); if (mVideoView != null) { layout.removeView(mVideoView); - layout.setBackgroundColor(0x00000000); + layout.setBackgroundColor(0xff000000); mVideoView = null; } layout.removeView(webView);