fix: grid minmax, media polling fallback, content webview layout, swipe timeout

This commit is contained in:
2026-08-16 20:25:21 +08:00
parent 8d10d9e5e9
commit 7a28e2372c
5 changed files with 59 additions and 10 deletions
@@ -54,6 +54,10 @@ class MainActivity : Activity() {
// 内容 WebView 顶栏预留高度(dp)
// Topbar reserved height for content WebViews (dp)
private const val TOPBAR_HEIGHT_DP = 44
// 全局侧边栏收起宽度(dp),内容 WebView 左侧预留,避免挡住侧边栏
// Global sidebar collapsed width (dp); content WebViews reserve it on the
// left to avoid covering the sidebar
private const val SIDEBAR_WIDTH_DP = 80
}
private val webAppContainer = WebAppContainer()
@@ -237,6 +241,9 @@ class MainActivity : Activity() {
private val topBarHeightPx by lazy {
(TOPBAR_HEIGHT_DP * resources.displayMetrics.density).toInt()
}
private val sidebarWidthPx by lazy {
(SIDEBAR_WIDTH_DP * resources.displayMetrics.density).toInt()
}
override fun openWebView(id: String, url: String) {
if (contentWebViews.containsKey(id)) {
@@ -261,6 +268,7 @@ class MainActivity : Activity() {
ViewGroup.LayoutParams.MATCH_PARENT
)
params.topMargin = topBarHeightPx
params.leftMargin = sidebarWidthPx
contentWebViews[id] = webView
root.addView(webView, params)
webView.loadUrl(url)