From 4ef4cf89fa0a193aa9bfb033c553f9fa5a00a5b1 Mon Sep 17 00:00:00 2001 From: aiWean <39707263+ailiwean@users.noreply.github.com> Date: Sun, 30 Aug 2020 02:30:12 +0800 Subject: [PATCH 1/2] Update README.md --- README.md | 114 ++++++++---------------------------------------------- 1 file changed, 17 insertions(+), 97 deletions(-) diff --git a/README.md b/README.md index 023c65d..b06e0a6 100644 --- a/README.md +++ b/README.md @@ -1,112 +1,27 @@ # NBZxing - 一个稳定完善的扫码库,几行代码既可接入,完美适配各种分辨率,无拉伸。 + 一个稳定完善的扫码库,几行代码既可接入,完美适配各种分辨率无拉伸,可插拔式自定义UI ### 依赖 -[![](https://jitpack.io/v/ailiwean/NBZxing.svg)](https://jitpack.io/#ailiwean/NBZxing) [![](https://jitpack.io/v/ailiwean/NBZxing-Scale.svg)](https://jitpack.io/#ailiwean/NBZxing-Scale) - - +[![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9qaXRwYWNrLmlvL3YvYWlsaXdlYW4vTkJaeGluZy5zdmc?x-oss-process=image/format,png)](https://jitpack.io/#ailiwean/NBZxing) [[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-fIwVCQJ9-1598724809081)(https://jitpack.io/v/ailiwean/NBZxing-Scale.svg)]](https://jitpack.io/#ailiwean/NBZxing-Scale) ``` - implementation 'com.github.ailiwean:NBZxing:0.0.21' + implementation 'com.github.ailiwean:NBZxing:0.0.23' //若需要使用灰度算法增强库,再次添加以下依赖//纯java超轻量 - implementation 'com.github.ailiwean:NBZxing-Scale:0.0.1' + implementation 'com.github.ailiwean:NBZxing-Scale:0.0.2' ``` [NBZxing-Scale](https://github.com/ailiwean/NBZxing-Scale "NBZxing-Scale") **注意:库中已经包含zxing源码无需再次依赖** +------- +### WIKI +[如何使用-超简易](https://github.com/ailiwean/NBZxing/wiki) -两步搞定 - - **step1. 自定义一个View继承NBZxingView** - -``` -class CusZxingView @JvmOverloads constructor(context: Context, attributeSet: AttributeSet? = null, def: Int = 0) : NBZxingView(context, attributeSet, def) { - - /*** - * 扫码结果回调 - */ - override fun resultBack(content: String) { - Toast.makeText(context, content, Toast.LENGTH_SHORT).show() - } - - - /*** - * 返回扫码类型 - * 1 ScanTypeConfig.HIGH_FREQUENCY 高频率格式(默认) - * 2 ScanTypeConfig.ALL 所有格式 - * 3 ScanTypeConfig.ONLY_QR_CODE 仅QR_CODE格式 - * 4 ScanTypeConfig.TWO_DIMENSION 所有二维码格式 - * 5 ScanTypeConfig.ONE_DIMENSION 所有一维码格式 - */ - override fun getScanType(): ScanTypeConfig { - return ScanTypeConfig.HIGH_FREQUENCY - } - -} -``` - - **step2. 同步生命周期** - -在Activity的onCreate方法中调用 - -``` - this.findViewById(R.id.cusZxing) - .synchLifeStart(this); -``` - -在Fragment中 -``` - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - zxingCameraView = new ZxingCameraView(container.getContext()) { - @Override - public void resultBack(@NotNull String content) { - Toast.makeText(container.getContext(), content, Toast.LENGTH_LONG).show(); - } - - @org.jetbrains.annotations.Nullable - @Override - public View provideFloorView() { - return null; - } - }; - return zxingCameraView; - } - - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - zxingCameraView.synchLifeStart(this); - } -``` - -**注意:仅支持AndroidX** - - -#### 图片资源解析 -在NBZxingView的子类中调用 - -``` - parseFile(filePath: String); - - //当图片过大需要手动压缩时,处理完请传入Bitmap - parseBitmap(bitmap: Bitmap) - -``` -重写该方法处理回调 -``` -protected open fun resultBackFile(content: String) { - //扫描失败content返回空字符串,可自行提示 -} - -``` -------- +感谢[@guangming](https://github.com/guangmingxiong9999)提供近百台机型应用测试🙏 #### 下载体验 ![在这里插入图片描述](https://imgconvert.csdnimg.cn/aHR0cHM6Ly93d3cucGd5ZXIuY29tL2FwcC9xcmNvZGUvaWlabg?x-oss-process=image/format,png) @@ -126,13 +41,11 @@ protected open fun resultBackFile(content: String) { | 曝光 | ![曝光](https://github.com/ailiwean/NBZxing/blob/master/qr_test/over_light.png "曝光") | | 浅色 | ![浅色](https://github.com/ailiwean/NBZxing/blob/master/qr_test/test_gray.png "浅色") | + #### 下版预期 -- `提供完全的自定义界面` - `二维码生成` -- `图片识别引用灰度扩展库` - #### 联系我 `微信: 17391961576` `QQ: 1581209979` @@ -140,7 +53,14 @@ protected open fun resultBackFile(content: String) { | 😊 | 😊 | | ------------ | ------------ | -| 请喝咖啡 | ![pay](https://github.com/ailiwean/NBZxing/blob/master/qr_test/pay.png "pay") | +| 请喝咖啡 | [(https://github.com/ailiwean/NBZxing/blob/master/qr_test/pay.png "pay")] | + + + + + + + From bf472f0900fc6aa1d0b8dd253c8a704f042cba8c Mon Sep 17 00:00:00 2001 From: aiWean <39707263+ailiwean@users.noreply.github.com> Date: Sun, 30 Aug 2020 02:31:56 +0800 Subject: [PATCH 2/2] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b06e0a6..ea4d6ca 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ ### 依赖 -[![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9qaXRwYWNrLmlvL3YvYWlsaXdlYW4vTkJaeGluZy5zdmc?x-oss-process=image/format,png)](https://jitpack.io/#ailiwean/NBZxing) [[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-fIwVCQJ9-1598724809081)(https://jitpack.io/v/ailiwean/NBZxing-Scale.svg)]](https://jitpack.io/#ailiwean/NBZxing-Scale) +[![](https://jitpack.io/v/ailiwean/NBZxing.svg)](https://jitpack.io/#ailiwean/NBZxing) [![](https://jitpack.io/v/ailiwean/NBZxing-Scale.svg)](https://jitpack.io/#ailiwean/NBZxing-Scale) + ``` @@ -53,7 +54,8 @@ | 😊 | 😊 | | ------------ | ------------ | -| 请喝咖啡 | [(https://github.com/ailiwean/NBZxing/blob/master/qr_test/pay.png "pay")] | +| 请喝咖啡 | ![pay](https://github.com/ailiwean/NBZxing/blob/master/qr_test/pay.png "pay") | +