diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 13ea633..21e978f 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,45 +1,46 @@
-
+
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/java/games/wenzi/ogame/MainActivity.java b/android/app/src/main/java/games/wenzi/ogame/MainActivity.java
index 82b7e84..a6247d0 100644
--- a/android/app/src/main/java/games/wenzi/ogame/MainActivity.java
+++ b/android/app/src/main/java/games/wenzi/ogame/MainActivity.java
@@ -3,15 +3,25 @@ package games.wenzi.ogame;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Window;
+import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
+import androidx.core.splashscreen.SplashScreen;
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsControllerCompat;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {
+ private boolean isWebViewReady = false;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
+ // 安装 SplashScreen,必须在 super.onCreate 之前调用
+ SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
+
+ // 保持 SplashScreen 直到 WebView 加载完成
+ splashScreen.setKeepOnScreenCondition(() -> !isWebViewReady);
+
super.onCreate(savedInstanceState);
Window window = getWindow();
@@ -45,6 +55,18 @@ public class MainActivity extends BridgeActivity {
settings.setDatabaseEnabled(true);
// 启用硬件加速渲染
webView.setLayerType(android.view.View.LAYER_TYPE_HARDWARE, null);
+
+ // 监听页面加载进度,加载完成后隐藏 SplashScreen
+ webView.setWebChromeClient(new WebChromeClient() {
+ @Override
+ public void onProgressChanged(WebView view, int newProgress) {
+ super.onProgressChanged(view, newProgress);
+ // 当页面加载达到 80% 时认为可以显示
+ if (newProgress >= 80) {
+ isWebViewReady = true;
+ }
+ }
+ });
}
}
}
diff --git a/android/app/src/main/res/drawable/splash.xml b/android/app/src/main/res/drawable/splash.xml
new file mode 100644
index 0000000..f6ba762
--- /dev/null
+++ b/android/app/src/main/res/drawable/splash.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ -
+
+
+
diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml
index 30d2a3c..3d07858 100644
--- a/android/app/src/main/res/values/colors.xml
+++ b/android/app/src/main/res/values/colors.xml
@@ -1,4 +1,5 @@
- #1a1a2e
-
+ #1a1a2e
+ #0f0f1a
+
\ No newline at end of file
diff --git a/android/app/src/main/res/values/ic_launcher_background.xml b/android/app/src/main/res/values/ic_launcher_background.xml
index c5d5899..16cdd5a 100644
--- a/android/app/src/main/res/values/ic_launcher_background.xml
+++ b/android/app/src/main/res/values/ic_launcher_background.xml
@@ -1,4 +1,4 @@
- #FFFFFF
+ #FFFFFF
\ No newline at end of file
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 9126ddd..3ad4b93 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -1,7 +1,7 @@
- OGame Vue Ts
- OGame Vue Ts
- games.wenzi.ogame
- games.wenzi.ogame
-
+ OGame Vue Ts
+ OGame Vue Ts
+ games.wenzi.ogame
+ games.wenzi.ogame
+
\ No newline at end of file
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
index ad35f23..8a1365e 100644
--- a/android/app/src/main/res/values/styles.xml
+++ b/android/app/src/main/res/values/styles.xml
@@ -1,26 +1,28 @@
-
-
+
+
-
+
-
-
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/xml/file_paths.xml b/android/app/src/main/res/xml/file_paths.xml
index bd0c4d8..2a8fc7b 100644
--- a/android/app/src/main/res/xml/file_paths.xml
+++ b/android/app/src/main/res/xml/file_paths.xml
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/xml/network_security_config.xml b/android/app/src/main/res/xml/network_security_config.xml
index d7b4192..bac9208 100644
--- a/android/app/src/main/res/xml/network_security_config.xml
+++ b/android/app/src/main/res/xml/network_security_config.xml
@@ -1,8 +1,8 @@
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/capacitor.config.ts b/capacitor.config.ts
index 5455f66..0390b89 100644
--- a/capacitor.config.ts
+++ b/capacitor.config.ts
@@ -5,16 +5,17 @@ const config: CapacitorConfig = {
appName: 'OGame Vue Ts',
webDir: 'docs',
server: {
- androidScheme: 'https'
+ androidScheme: 'https',
+ cacheControl: 'max-age=31536000'
},
android: {
buildOptions: {
keystorePath: undefined,
keystoreAlias: undefined
},
- // 启用 WebView 调试,方便排查问题
- webContentsDebuggingEnabled: true,
- allowMixedContent: false
+ webContentsDebuggingEnabled: false,
+ allowMixedContent: false,
+ hardwareAcceleration: true
},
plugins: {
// 禁用键盘自动调整视口
diff --git a/index.html b/index.html
index 28eab05..ba94683 100644
--- a/index.html
+++ b/index.html
@@ -13,38 +13,9 @@
-
+