{"id":37455567,"url":"https://github.com/bluesofy/atomwebview","last_synced_at":"2026-01-16T07:00:15.811Z","repository":{"id":283883258,"uuid":"118858399","full_name":"bluesofy/AtomWebView","owner":"bluesofy","description":":zzz: Smart WebView Lib Base on Tencent X5","archived":false,"fork":false,"pushed_at":"2018-10-06T18:01:44.000Z","size":746,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T20:19:26.403Z","etag":null,"topics":["atom","js","prompt","safe","smart","webview"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluesofy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-25T03:42:51.000Z","updated_at":"2022-10-20T21:48:02.000Z","dependencies_parsed_at":"2025-03-22T20:29:31.645Z","dependency_job_id":null,"html_url":"https://github.com/bluesofy/AtomWebView","commit_stats":null,"previous_names":["bluesofy/atomwebview"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bluesofy/AtomWebView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluesofy%2FAtomWebView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluesofy%2FAtomWebView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluesofy%2FAtomWebView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluesofy%2FAtomWebView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluesofy","download_url":"https://codeload.github.com/bluesofy/AtomWebView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluesofy%2FAtomWebView/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atom","js","prompt","safe","smart","webview"],"created_at":"2026-01-16T07:00:14.309Z","updated_at":"2026-01-16T07:00:15.704Z","avatar_url":"https://github.com/bluesofy.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## AtomWebView\n\n[ ![Download](https://api.bintray.com/packages/blueyuki/maven/AtomWebView/images/download.svg) ](https://bintray.com/blueyuki/maven/AtomWebView/_latestVersion)\n\n使用Tencent X5内核，封装常用配置和方法，不想用X5，可以直接改源码，很简单的。\n\u003cbr\u003e利用onJsPrompt来实现JS交互，避开Android 4.2以下的WebView漏洞，不需要使用@JavascriptInterface注释。\n\u003cbr\u003e加了部分常用的功能调用，支持重写自定义扩充。\n\u003cbr\u003e\u003cbr\u003e\n\n### 使用说明  Usage\n#### 添加依赖\n```Gradle\napi 'cn.byk.pandora:atomwebview:1.0.1'\n```\n\n#### 使用方法\n- 直接在布局中使用或者继承后使用都可以\n```XML\n\u003ccom.byk.pandora.atomwebview.AtomWebView\n        android:id=\"@+id/webview\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"/\u003e\n```\n\n- 自定义WebChromeClient需要继承AtomWebChromeClient，类似的，自定义WebViewClient需要继承AtomWebViewClient\n\n- 主要API说明\n```Java\n// 调用Js方法，API19以下调用loadUrl()，19以上调用evaluateJavascript()，\n// 区别，loadUrl会重载网页，evaluateJavascript不会，且自带回调\ninvokeJs(final String jsMethod, final ValueCallback\u003cString\u003e callback)\n\n// 滑动监听，可监听到底事件\nsetScrollWatcher(IScrollWatcher watcher)\n\n// 长按监听，接口方法watcher.onLongClick(int type, HitTestResult result)\n// type - 资源类型，常量值见AtomWebView定义\n// result.getExtra() - 获取数据\nsetLongClickWatcher(ILongClickWatcher watcher)\n\n// 需要继承重写，设定是否启用Js，默认true\nenableJs()\n\n// 需要继承重写，设定是否需要图片延迟加载，即先加载完网页基本数据再加载图片，默认true\nenableDelayLoadImages()\n\n// 释放WebView资源，注意WebView的清理资源影响的是全局进程的，在界面销毁的时候调用\nclose()\n\n// Js调用Android方法监听，注意IJsBridge的onReceive带String结果值返回，可回调数据给网页Js\nsetJsBridge(IJsBridge bridge)\n```\n\n- 已实现的原生方法调用说明，以后可能会以atoms的scheme扩充\n```JavaScript\n// 注意这个是写在Js里的，function名字无所谓\nfunction callAndroid() {\n    // 打开网页（调起第三方浏览器）\n    var result = prompt(\"http://www.baidu.com\");\n\n    // 打开拨号盘\n    var result = prompt(\"tel:114\");\n    // 直接拨号（需要权限）\n    var result = prompt(\"tel:114$\");\n\n    // 打开短信\n    var result = prompt(\"smsto:10086\");\n    // 打开短信，预写短信内容\n    var result = prompt(\"smsto:10086$查询流量\");\n\n    // 打开相机，request是AcitvityForResult的回调code\n    var result = prompt(\"atoms://camera?request=1\");\n\n    // 打开第三方App，写入第三方App的scheme即可\n    var result = prompt(\"tbopen://xxx?xxx=1\");\n}\n```\n\n- 如果都不在以上已实现的原生方法调用中，或者打开第三方App失败，会抛出AtomResult自定义处理\n```Java\npublic class AtomResult {\n\n    // uri.getScheme()\n    private String scheme;\n\n    // uri.getAuthority()\n    private String action;\n\n    // 参数字符串，即问号后面的那一串，uri.getQuery()\n    private String data;\n\n    private Uri uri;\n\n    // Js.prompt传入的完整String数据\n    private String content;\n}\n```\n\n- 如果需要增加加载进度条，可继承AtomWebChromeClient\n```Java\n// 让进度条控件实现接口\npublic interface IProgress {\n    void onProgress(int progress);\n    void onVisible(boolean visible);\n}\n\n// 重写\npublic IProgress progress()\n```\n\n- 如果需要自定义加载错误页面，可继承AtomWebViewClient\n```Java\n// 让自定义View实现接口\npublic interface IErrorView {\n    void onError(WebView webView, int errorCode, String desc, String errorUrl);\n}\n\n// 重写\npublic IErrorView errorView()\n```\n\n- 学无止境\n\u003cbr\u003e\n\n### 关于混淆  ProGuard\n#### 无需添加混淆\n\u003cbr\u003e\n\n### 特别鸣谢  Tks to\n- [TBS腾讯浏览服务](http://x5.tencent.com/)\n\u003cbr\u003e\n\n### 联系方式  Support or Contact\n- E-Mail: bluesofy@qq.com\n- E-Mail: bluesofy@live.cn","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluesofy%2Fatomwebview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluesofy%2Fatomwebview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluesofy%2Fatomwebview/lists"}