feat: webapp multi-tab JS bridge and multi-WebView management
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package top.yeij.hearth.webview
|
||||
|
||||
import top.yeij.hearth.webapp.Tab
|
||||
|
||||
// webAPP 内容 WebView 宿主接口:由 MainActivity 实现,管理多 WebView 的生命周期、
|
||||
// 可见性、导航,并把标签状态同步回桌面 H5 顶栏
|
||||
// Web app content WebView host interface: implemented by MainActivity, managing
|
||||
// multi-WebView lifecycle, visibility, and navigation, and syncing tab state
|
||||
// back to the desktop H5 topbar
|
||||
interface WebAppHost {
|
||||
// 创建内容 WebView 加载 url 并显示(已存在则切换到该标签)
|
||||
// Create a content WebView loading url and show it (switch if already open)
|
||||
fun openWebView(id: String, url: String)
|
||||
|
||||
// 销毁对应内容 WebView
|
||||
// Destroy the corresponding content WebView
|
||||
fun closeWebView(id: String)
|
||||
|
||||
// 切换可见内容 WebView(其它内容 WebView GONE)
|
||||
// Switch the visible content WebView (hide the others with GONE)
|
||||
fun switchWebView(id: String)
|
||||
|
||||
// 当前可见 WebView 回退,无历史返回 false
|
||||
// Go back on the visible WebView, false when no history
|
||||
fun goBack(): Boolean
|
||||
|
||||
// 当前可见 WebView 前进,无历史返回 false
|
||||
// Go forward on the visible WebView, false when no history
|
||||
fun goForward(): Boolean
|
||||
|
||||
// 当前可见 WebView 重载
|
||||
// Reload the visible WebView
|
||||
fun reload()
|
||||
|
||||
// 将标签状态推送到桌面 H5 顶栏
|
||||
// Push the tab state to the desktop H5 topbar
|
||||
fun syncTabs(tabs: List<Tab>)
|
||||
}
|
||||
Reference in New Issue
Block a user