From c5a8ef58f1ae9c0c76c3ef36d38f4a1f54ec6e97 Mon Sep 17 00:00:00 2001 From: aiWean <39707263+ailiwean@users.noreply.github.com> Date: Wed, 22 Jul 2020 16:58:12 +0800 Subject: [PATCH] Update README.md --- README.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 581daba..412a8bf 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,15 @@ ### 依赖 -[![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9qaXRwYWNrLmlvL3YvYWlsaXdlYW4vTkJaeGluZy5zdmc?x-oss-process=image/format,png)](https://jitpack.io/#ailiwean/NBZxing) +[![](https://jitpack.io/v/ailiwean/NBZxing.svg)](https://jitpack.io/#ailiwean/NBZxing) ``` - implementation 'com.github.ailiwean:NBZxing:0.0.14' + implementation 'com.github.ailiwean:NBZxing:0.0.16' ``` **注意:库中已经包含zxing源码无需再次依赖** - 两步搞定 **step1. 自定义一个View继承ZxingCameraView** @@ -85,6 +84,27 @@ class CusZxingView @JvmOverloads constructor(context: Context, attributeSet: Att } ``` + +#### 图片资源解析 +在ZxingCameraView的子类中调用 + +``` + parseFile(filePath: String); + + //当图片过大需要手动压缩时,处理完请传入Bitmap + parseBitmap(bitmap: Bitmap) + +``` +重写该方法处理回调 +``` + +protected open fun resultBackFile(content: String) { + //扫描失败content返回空字符串,可自行提示 +} + +``` +注意:在解析图片资源时会自动关闭相机, 若解析失败则重写打开 + ------- #### 下载体验