feat: page preload, card grid span, wallpaper into webview for glass blur

This commit is contained in:
2026-08-16 19:51:08 +08:00
parent 1a79b4ed55
commit 8c42dca7bc
8 changed files with 175 additions and 47 deletions
@@ -36,6 +36,14 @@ interface ServerUrlProvider {
fun setServerUrl(url: String)
}
// 壁纸提供接口:由 MainActivity 实现(WallpaperManager 转 base64),
// 让壁纸进入 WebView 内部,backdrop-filter 玻璃才能模糊到壁纸
// Wallpaper provider implemented by MainActivity (WallpaperManager -> base64), so the
// wallpaper lives inside the WebView and the glass backdrop-filter can blur it
interface WallpaperProvider {
fun getWallpaperBase64(): String
}
class JsBridge(
private val deviceWidthPx: Int,
private val deviceHeightPx: Int,
@@ -58,6 +66,9 @@ class JsBridge(
// 服务器地址存储接口
// Server URL storage provider
private val serverUrl: ServerUrlProvider? = null,
// 壁纸提供接口(base64
// Wallpaper provider (base64)
private val wallpaper: WallpaperProvider? = null,
) {
private val gson = com.google.gson.Gson()
@@ -270,6 +281,11 @@ class JsBridge(
serverUrl?.setServerUrl(url)
}
// 返回壁纸 base64(data URI,未接入返回空字符串)
// Return the wallpaper base64 (data URI; empty string when not wired)
@android.webkit.JavascriptInterface
fun getWallpaper(): String = wallpaper?.getWallpaperBase64() ?: ""
// 重新拉取 webAPP 清单 + 卡片目录,返回 { count }
// Re-fetch the webAPP manifest + card catalog, return { count }
@android.webkit.JavascriptInterface