fix: add LAUNCHER category and page-finished log

This commit is contained in:
2026-08-16 17:59:40 +08:00
parent a39264d785
commit ebcd771a1f
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -11,6 +11,7 @@
android:theme="@style/Theme.Hearth"> android:theme="@style/Theme.Hearth">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
@@ -92,6 +92,12 @@ class MainActivity : Activity() {
setContentView(root) setContentView(root)
desktopWebView = WebViewManager(this).attach(bridge, root) desktopWebView = WebViewManager(this).attach(bridge, root)
desktopWebView.webViewClient = object : WebViewClient() { desktopWebView.webViewClient = object : WebViewClient() {
// 主帧加载完成时打日志,便于定位黑屏(判断 index.html 是否成功加载)
// Log when the main frame finishes loading, to help diagnose a black screen
override fun onPageFinished(view: WebView?, url: String?) {
Log.d(TAG, "onPageFinished: url=$url")
}
// 主帧加载失败时展示错误页,避免白屏 // 主帧加载失败时展示错误页,避免白屏
// Show an error page on main-frame load failure to avoid a blank screen // Show an error page on main-frame load failure to avoid a blank screen
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION") @Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")