Skip to content

Commit 5f02367

Browse files
committed
基础库升级文档整理
1 parent e046fa1 commit 5f02367

10 files changed

+341
-28
lines changed

SUMMARY.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
* [common-photos](use/common/common-photos.md)
1717
* [common-network](use/common/common-network.md)
1818
* [common-webview](use/common/common-webview.md)
19+
* [common-tbs](use/common/common-tbs.md)
20+
* [common-webview](use/common/common-webview.md)
21+
* [common-webview-tbs](use/common/common-webview-tbs.md)
1922
* [common-feedback](use/common/common-feedback.md)
23+
* [common-feedback-tbs](use/common/common-feedback-tbs.md)
2024
* [common-share](use/common/common-share.md)
2125
* [common-share](use/common/common-qrcode.md)
2226
* [common-praise](use/common/common-praise.md)
@@ -27,7 +31,9 @@
2731
* [common-svga](use/common/common-svga.md)
2832
* [common-navigation-drawer](use/common/common-navigation-drawer.md)
2933
* [common-message](use/common/common-message.md)
30-
34+
* [common-accessibility](use/common/common-accessibility.md)
35+
36+
3137
* [基础组件信息]()
3238
* [基础组件集]()
3339
* [lib-wrapper](use/libs/combination/lib-wrapper.md)
@@ -64,6 +70,7 @@
6470
* [lib-data-repository](use/libs/noui/lib-data-repository.md)
6571
* [lib-audio-player](use/libs/noui/lib-audio-player.md)
6672
* [UI相关]()
73+
* [lib-aaf-res](use/libs/ui/lib-aaf-res.md)
6774
* [lib-ui-common](use/libs/ui/lib-ui-common.md)
6875
* [lib-fragmentation-core](use/libs/ui/lib-fragmentation-core.md)
6976
* [lib-fragmentation](use/libs/ui/lib-fragmentation.md)
@@ -80,7 +87,7 @@
8087
* [lib-bottom-tab](use/libs/ui/lib-bottom-tab.md)
8188
* [lib-touchregion](use/libs/ui/lib-touchregion.md)
8289
* [lib-view-ext](use/libs/ui/lib-view-ext.md)
83-
* [lib-webview](use/libs/ui/lib-webview.md)
90+
* [lib-jsbridge](use/libs/ui/lib-jsbridge.md)
8491
* [lib-lifecycle](use/libs/ui/lib-lifecycle.md)
8592
* [lib-permission](use/libs/ui/lib-permission.md)
8693
* [lib-immersive](use/libs/ui/lib-immersive.md)
@@ -89,6 +96,7 @@
8996
* [lib-ace-editor](use/libs/ui/lib-ace-editor.md)
9097
* [lib-view-pager](use/libs/ui/lib-view-pager.md)
9198
* [lib-custom-view](use/libs/ui/lib-custom-view.md)
99+
* [lib-theme](use/libs/ui/lib-theme.md)
92100
* [路由相关]()
93101
* [lib-router](use/libs/router/lib-router.md)
94102
* [lib-router-compiler](use/libs/router/lib-router-compiler.md)

use/common/common-accessibility.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# CommonAccessibility
2+
3+
![CommonAccessibility](https://img.shields.io/badge/AndroidAppFactory-CommonAccessibility-brightgreen)
4+
[ ![Github](https://img.shields.io/badge/Github-CommonAccessibility-brightgreen?style=social) ](https://github.com/bihe0832/AndroidAppFactory/tree/master/CommonAccessibility)
5+
[ ![Maven Central](https://img.shields.io/maven-central/v/com.bihe0832.android/common-accessibility) ](https://search.maven.org/artifact/com.bihe0832.android/common-accessibility)
6+
7+
## 功能简介
8+
9+
基于无障碍封装的通用模拟点击方案
10+
11+
## 组件信息
12+
13+
#### 引用仓库
14+
15+
引用仓库可以参考 [组件使用](./../start.md) 中添加依赖的部分
16+
17+
#### 组件使用
18+
19+
```groovy
20+
implementation 'com.bihe0832.android:common-accessibility:+'
21+
```
22+
23+
## 组件功能
24+
25+
### AAFAccessibilityManager
26+
27+
- 模拟点击,无障碍的开启关闭状态管理等
28+
29+
### AAFAccessibilityDispatcher
30+
31+
- 根据提供的位置,或者位置左边的key完成一次模拟操作
32+
33+
### AAFAccessibilityService
34+
35+
- 无障碍对应的系统服务
36+
37+
### PositionIcon
38+
39+
- 按键校准时使用的悬浮窗信息

use/common/common-feedback-tbs.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# CommonTBSFeedback
2+
3+
![CommonTBSFeedback](https://img.shields.io/badge/AndroidAppFactory-CommonTBSFeedback-brightgreen)
4+
[ ![Github](https://img.shields.io/badge/Github-CommonTBSFeedback-brightgreen?style=social) ](https://github.com/bihe0832/AndroidAppFactory/tree/master/CommonTBSFeedback)
5+
[ ![Maven Central](https://img.shields.io/maven-central/v/com.bihe0832.android/common-feedback-tbs) ](https://search.maven.org/artifact/com.bihe0832.android/common-feedback-tbs)
6+
7+
## 功能简介
8+
9+
基于公共框架,结合腾讯吐槽添加的用户反馈组件,底层使用X5内核的Webview
10+
11+
## 组件使用
12+
13+
#### 引用仓库
14+
15+
引用仓库可以参考 [组件使用](./../start.md) 中添加依赖的部分
16+
17+
#### 组件使用
18+
19+
```groovy
20+
implementation 'com.bihe0832.android:common-feedback-tbs:+'
21+
```
22+
23+
## 组件功能
24+
25+
基于 [腾讯吐槽](https://support.qq.com/products/290858) 通过网页打开的用户反馈模块。会自动收集基础信息。
26+
27+
用户界面:
28+
29+
<img src="./common-feedback/common-feedback-user.png" width="90%"/>
30+
31+
反馈提交以后管理端界面:
32+
33+
<img src="./common-feedback/common-feedback.png" width="90%"/>
34+

use/libs/ui/lib-webview.md renamed to use/common/common-tbs.md

+6-22
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# LibWebview
1+
# CommonTBS
22

3-
![LibWebview](https://img.shields.io/badge/AndroidAppFactory-LibWebview-brightgreen)
4-
[ ![Github](https://img.shields.io/badge/Github-LibWebview-brightgreen?style=social) ](https://github.com/bihe0832/AndroidAppFactory/tree/master/LibWebview)
5-
[ ![Maven Central](https://img.shields.io/maven-central/v/com.bihe0832.android/lib-webview)](https://search.maven.org/artifact/com.bihe0832.android/lib-webview)
3+
![CommonTBS](https://img.shields.io/badge/AndroidAppFactory-CommonTBS-brightgreen)
4+
[ ![Github](https://img.shields.io/badge/Github-CommonTBS-brightgreen?style=social) ](https://github.com/bihe0832/AndroidAppFactory/tree/master/CommonTBS)
5+
[ ![Maven Central](https://img.shields.io/maven-central/v/com.bihe0832.android/common-tbs)](https://search.maven.org/artifact/com.bihe0832.android/common-tbs)
66

77
## 功能简介
88

@@ -17,7 +17,7 @@
1717
#### 组件使用
1818

1919
```groovy
20-
implementation 'com.bihe0832.android:lib-webview:+'
20+
implementation 'com.bihe0832.android:common-tbs:+'
2121
```
2222

2323
## 组件功能
@@ -26,7 +26,7 @@ implementation 'com.bihe0832.android:lib-webview:+'
2626

2727
- Webview 及 X5 内核的初始化
2828

29-
### BaseWebView
29+
### TBSWebView
3030

3131
- 基于X5 定制的Webview
3232

@@ -102,19 +102,3 @@ implementation 'com.bihe0832.android:lib-webview:+'
102102
setDrawingCacheEnabled(true);
103103
```
104104

105-
### JSbridge
106-
107-
JSbridge 相关的实现方案,可以点击[JSBridge](./../../../tools/android_jsbridge.md)参考文档了解
108-
109-
- BaseJsBridgeProxy
110-
111-
JS调用转为原生接口
112-
113-
- JsBridge
114-
115-
接原生处理结果,回调JS
116-
117-
118-
- JsResult
119-
120-
错误码

use/common/common-webview-tbs.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# CommonTBSWebview
2+
3+
![CommonTBSWebview](https://img.shields.io/badge/AndroidAppFactory-CommonTBSWebview-brightgreen)
4+
[ ![Github](https://img.shields.io/badge/Github-CommonTBSWebview-brightgreen?style=social) ](https://github.com/bihe0832/AndroidAppFactory/tree/master/CommonTBSWebview)
5+
[ ![Maven Central](https://img.shields.io/maven-central/v/com.bihe0832.android/common-webview-tbs) ](https://search.maven.org/artifact/com.bihe0832.android/common-webview-tbs)
6+
7+
## 功能简介
8+
9+
基于公共框架,进一步封装的X5 内核 通用webview,对于 Webview 相关的内容,可以查看 [CommonTBS](./common-tbs.md)
10+
11+
## 组件信息
12+
13+
#### 引用仓库
14+
15+
引用仓库可以参考 [组件使用](./../start.md) 中添加依赖的部分
16+
17+
#### 组件使用
18+
19+
```groovy
20+
implementation 'com.bihe0832.android:common-webview-tbs:+'
21+
```
22+
23+
## 组件功能
24+
25+
### TBSWebviewFragment
26+
27+
- 封装好的通用的 [Webview](./common-webview.md) 的Fragment,支持:
28+
29+
下拉刷新,请求追加业务参数,错误页面及错误重试,非 Http 协议使用 Intent 唤起,获取网页标题,将终端的前后台切换响应到H5
30+
31+
- 支持Jsbridge,使用方式可以参考 [JSBridge](./../../tools/android_jsbridge.md)
32+
33+
### TBSJsBridgeProxy && TBSJsBridge && TBSCookieManager
34+
35+
- 基于 LibJsBridge 实现的相关功能
36+
37+
### CommonTBSWebviewFragment
38+
39+
- 对于 TBSWebviewFragment 的 进一步封装,打开时会自动在:URL参数、cookie、UserAgent,添加响应的字段,如下图:
40+
41+
<img src="./common-webview-tbs/webview-params.png" width="80%"/>
42+
43+
44+
### WebPageActivity
45+
46+
通用的带标题栏的 Webview Activity,标题栏自动获取网页标题,如下图,使用 [CommonTBSWebviewFragment](./common-webview-tbs.md#CommonTBSWebviewfragment)[CommonActivity](./framework/framework-ui.md#通用主ui)实现:
47+
48+
<img src="./common-webview-tbs/webview-pages.png" width="30%"/>
49+
50+
## 测试事例:
51+
52+
AAF 的测试Demo 提供了几个Webview的调试页面,具体内容可以点击链接 [https://github.com/bihe0832/AndroidAppFactory/tree/master/BaseTest/src/main/java/com/bihe0832/android/base/test/webview/TestWebviewActivity.kt](https://github.com/bihe0832/AndroidAppFactory/tree/master/BaseTest/src/main/java/com/bihe0832/android/base/test/webview/TestWebviewActivity.kt) 查看对应源码
53+
54+

use/common/common-webview.md

+77-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## 功能简介
88

9-
基于公共框架,进一步封装的通用webview,对于通用Webview 相关的内容,可以查看 [LibWebview](./../libs/ui/lib-webview.md)
9+
基于公共框架,进一步封装的通用webview
1010

1111
## 组件信息
1212

@@ -22,14 +22,88 @@ implementation 'com.bihe0832.android:common-webview:+'
2222

2323
## 组件功能
2424

25-
### BaseWebviewFragment
25+
### BaseWebviewFragment && BaseWebviewActivity
2626

27-
- 封装好的通用的 [Webview](./../libs/ui/lib-webview.md) 的Fragment,支持:
27+
- 封装好的通用的 Webview 的Fragment、Activity,支持:
2828

2929
下拉刷新,请求追加业务参数,错误页面及错误重试,非 Http 协议使用 Intent 唤起,获取网页标题,将终端的前后台切换响应到H5
3030

3131
- 支持Jsbridge,使用方式可以参考 [JSBridge](./../../tools/android_jsbridge.md)
3232

33+
### WebviewLoggerFile
34+
35+
- Webview 相关的日志
36+
37+
### WebViewViewModel
38+
39+
- 配合获取当前WebPage的title
40+
41+
### NativeWebView
42+
43+
- 支持防 webview 远程代码执行漏洞
44+
45+
- 添加基础的HTML支持:
46+
47+
```java
48+
//设置WebView属性,能够执行Javascript脚本
49+
webSetting.setJavaScriptEnabled(true);
50+
webSetting.setAllowFileAccess(true);
51+
webSetting.setSupportMultipleWindows(false);
52+
webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
53+
webSetting.setUseWideViewPort(true); //将图片调整到适合webview的大小
54+
webSetting.setLoadWithOverviewMode(true); // 缩放至屏幕的大小
55+
//支持HTTP和HTTPS混合模式
56+
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
57+
//由于X5没有定义对应的常量,因此直接使用实际值,对应官方webkit的WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
58+
webSetting.setMixedContentMode(0);
59+
}
60+
//支持缩放,默认为true。是下面那个的前提。
61+
webSetting.setSupportZoom(true);
62+
//设置内置的缩放控件。
63+
webSetting.setBuiltInZoomControls(true);
64+
65+
//若上面是false,则该WebView不可缩放,这个不管设置什么都不能缩放。
66+
webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); //支持内容重新布局
67+
webSetting.supportMultipleWindows(); //多窗口
68+
webSetting.setNeedInitialFocus(true); //当webview调用requestFocus时为webview设置节点
69+
webSetting.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口
70+
webSetting.setLoadsImagesAutomatically(true); //支持自动加载图片
71+
webSetting.setDefaultTextEncodingName("utf-8");//设置编码格式
72+
```
73+
74+
- 自定义缓存支持
75+
76+
```java
77+
//设置缓存类型
78+
webSetting.setCacheMode(WebSettings.LOAD_DEFAULT);
79+
//设置缓存位置
80+
String cacheDirPath = this.getContext().getApplicationContext().getFilesDir().getAbsolutePath() + APP_CACAHE_DIRNAME;
81+
//JYLog.d("cacheDirPath=" + cacheDirPath);
82+
//设置数据库缓存路径
83+
webSetting.setDatabasePath(cacheDirPath);
84+
//设置 Application Caches 缓存目录
85+
webSetting.setAppCachePath(cacheDirPath);
86+
//开启 Application Caches 功能
87+
webSetting.setAppCacheEnabled(true);
88+
// 开启 DOM storage API 功能
89+
webSetting.setDomStorageEnabled(true);
90+
//开启 database storage API 功能
91+
webSetting.setDatabaseEnabled(true);
92+
webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
93+
```
94+
95+
### NativeWebviewFragment
96+
97+
- 封装好的通用的 [NativeWebView](./common-webview.md) 的Fragment,支持:
98+
99+
下拉刷新,请求追加业务参数,错误页面及错误重试,非 Http 协议使用 Intent 唤起,获取网页标题,将终端的前后台切换响应到H5
100+
101+
- 支持Jsbridge,使用方式可以参考 [JSBridge](./../../tools/android_jsbridge.md)
102+
103+
### NativeJsBridgeProxy && NativeJsBridge && NativeCookieManager
104+
105+
- 基于 LibJsBridge 实现的相关功能
106+
33107
### CommonWebviewFragment
34108

35109
- 对于 BaseWebviewFragment 的 进一步封装,打开时会自动在:URL参数、cookie、UserAgent,添加响应的字段,如下图:

use/libs/noui/lib-audio-player.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ implementation 'com.bihe0832.android:lib-audio-player:+'
2424

2525
### AudioPLayerManager
2626

27-
- 添加播放音频,支持文件路径和资源ID
27+
- 添加播放音频,支持文件路径和资源ID,支持设置音量和播放速度

use/libs/ui/lib-aaf-res.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# LibAAFResource
2+
3+
![LibAAFResource](https://img.shields.io/badge/AndroidAppFactory-LibAAFResource-brightgreen)
4+
[ ![Github](https://img.shields.io/badge/Github-LibAAFResource-brightgreen?style=social) ](https://github.com/bihe0832/AndroidAppFactory/tree/master/LibAAFResource)
5+
[ ![Maven Central](https://img.shields.io/maven-central/v/com.bihe0832.android/lib-aaf-res) ](https://search.maven.org/artifact/com.bihe0832.android/lib-aaf-res)
6+
7+
## 功能简介
8+
9+
AAF 所有资源的通用定义,当想更换主题时,使用该模块里面的资源替换即可实现基础的换肤功能
10+
11+
## 组件信息
12+
13+
#### 引用仓库
14+
15+
引用仓库可以参考 [组件使用](./../start.md) 中添加依赖的部分
16+
17+
#### 组件使用
18+
19+
```groovy
20+
implementation 'com.bihe0832.android:lib-aaf-res:+'
21+
```
22+
23+
## 组件功能
24+
25+
### AAFException
26+
27+
- AAF 相关的异常
28+
29+
### AAFDataCallback
30+
31+
- AAF 通用的数据回调
32+
33+
```
34+
class AAFDataCallback<T> {
35+
fun onError(errorCode: kotlin.Int, msg: kotlin.String)
36+
fun onSuccess(result: T?)
37+
}
38+
```

0 commit comments

Comments
 (0)