feat: per-app initial scale config
This commit is contained in:
@@ -31,7 +31,7 @@ class WebViewManager(private val activity: Activity) {
|
||||
// (lifecycle is managed by the host); transparent background so a webapp without
|
||||
// a declared background shows the wallpaper instead of a default white
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
fun createContentWebView(ua: String?): WebView {
|
||||
fun createContentWebView(ua: String?, scale: Int?): WebView {
|
||||
val webView = WebView(activity)
|
||||
webView.setBackgroundColor(Color.TRANSPARENT)
|
||||
configure(webView)
|
||||
@@ -43,6 +43,11 @@ class WebViewManager(private val activity: Activity) {
|
||||
ua == "desktop" || ua == "pc" -> UA_DESKTOP
|
||||
else -> ua
|
||||
}
|
||||
// 初始缩放(1-100):用于 PC 版页面缩放适配横屏
|
||||
// Initial zoom (1-100): scale desktop pages to fit landscape
|
||||
if (scale != null && scale in 1..100) {
|
||||
webView.setInitialScale(scale)
|
||||
}
|
||||
return webView
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user