Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ailiwean authored Jul 22, 2020
1 parent 5a99631 commit c5a8ef5
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down Expand Up @@ -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返回空字符串,可自行提示
}
```
注意:在解析图片资源时会自动关闭相机, 若解析失败则重写打开

-------

#### 下载体验
Expand Down

0 comments on commit c5a8ef5

Please sign in to comment.