搜索

PythonReactSEOPDF
OpenClaw

yzturbo-web-android

YZTurboWebAndroid 高性能 Android WebView 容器 SDK 接入。用于在 Android 项目中集成 WebView 容器,实现: (1) WebView 预加载与复用,提升 H5 页面加载速度 (2) 离线包管理,拦截请求优先命中本地资源 (3) JS Bridge 双向通信,Native 与 H5 互调 适用场景:Android App 接入 H5 页面、需要离线包能力、需要 JS 通信的业务

hefuwei-950 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install hefuwei-95/yzturbo-web-android

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

YZTurboWebAndroid

Android 高性能 WebView 容器解决方案,支持 WebView 复用、离线包管理、JS Bridge 通信。

初始化配置

在 Application 中初始化:

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        WebViewLoader.INSTANCE.init(
            WebViewLoaderConfig.Builder(getApplication())
                .appKey("retail")           // 应用标识
                .poolSize(2)                // WebView 池大小
                .preloadUrl("https://xxx.com/m")
                .build()
        )
    }
}

添加依赖:

dependencies {
    implementation 'com.youzan.turboweb:turbo-web:1.0.1'
}

使用 WebViewFragment(推荐)

基础用法
class WebActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_web)

        if (savedInstanceState == null) {
            val fragment = WebViewFragment().apply {
                arguments = Bundle().apply {
                    putString("web_view_url", "https://your-domain.com/path")
                    putString("web_view_title", "页面标题")
                    putBoolean("show_title_bar", true)
                    putBoolean("show_progress_bar", true)
                }
            }
            supportFragmentManager.beginTransaction()
                .replace(R.id.container, fragment)
                .commit()
        }
    }
}
继承定制
class MyWebFragment : WebViewFragment() {
    override fun onPageReady() {
        super.onPageReady()
        // 页面加载完成后的自定义逻辑
    }
}

手动管理 WebView(进阶)

// 1. 获取 WebView(复用池中有可用则复用)
val (webView, isReused) = WebViewLoader.acquireWebView(
    context = this,
    url = "https://your-domain.com/app/path",
    listener = object : WebViewListener {
        override fun onPageFinished(view: WebView?, url: String?) {}
    }
)

// 2. 添加...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/hefuwei-95/yzturbo-web-android
Version
—
Commit
012f7bb0834aa8c1e02c79be8a4e9a7378a8c669
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

来源内容

SKILL.md
# YZTurboWebAndroid

Android 高性能 WebView 容器解决方案,支持 WebView 复用、离线包管理、JS Bridge 通信。

## 初始化配置

在 `Application` 中初始化:

```kotlin
class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        WebViewLoader.INSTANCE.init(
            WebViewLoaderConfig.Builder(getApplication())
                .appKey("retail")           // 应用标识
                .poolSize(2)                // WebView 池大小
                .preloadUrl("https://xxx.com/m")
                .build()
        )
    }
}
```

添加依赖:
```groovy
dependencies {
    implementation 'com.youzan.turboweb:turbo-web:1.0.1'
}
```

## 使用 WebViewFragment(推荐)

### 基础用法

```kotlin
class WebActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_web)

        if (savedInstanceState == null) {
            val fragment = WebViewFragment().apply {
                arguments = Bundle().apply {
                    putString("web_view_url", "https://your-domain.com/path")
                    putString("web_view_title", "页面标题")
                    putBoolean("show_title_bar", true)
                    putBoolean("show_progress_bar", true)
                }
            }
            supportFragmentManager.beginTransaction()
                .replace(R.id.container, fragment)
                .commit()
        }
    }
}
```

### 继承定制

```kotlin
class MyWebFragment : WebViewFragment() {
    override fun onPageReady() {
        super.onPageReady()
        // 页面加载完成后的自定义逻辑
    }
}
```

## 手动管理 WebView(进阶)

```kotlin
// 1. 获取 WebView(复用池中有可用则复用)
val (webView, isReused) = WebViewLoader.acquireWebView(
    context = this,
    url = "https://your-domain.com/app/path",
    listener = object : WebViewListener {
        override fun onPageFinished(view: WebView?, url: String?) {}
    }
)

// 2. 添加...

相关技能

OpenClaw

1password

daggerkun007

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.