diff --git a/README.OPENSOURCE b/README.OPENSOURCE index 0a2885251d8f2190b3bcbf258ed0fab86cf2a35e..f3469efd081e45ecffa695b04fb3712efb8750d1 100644 --- a/README.OPENSOURCE +++ b/README.OPENSOURCE @@ -3,7 +3,7 @@ "Name": "QRCodeScanner", "License": "GPLv3", "License File": "LICENSE", - "Version Number": "v0.1.2", + "Version Number": "0.1.2", "Upstream URL": "https://github.com/blikoon/QRCodeScanner", "Description": "点击跳转到扫码界面,返回扫码结果" } diff --git a/README.md b/README.md index c1e133f4eb63c790796d960ab3d72d28ccd14990..774f9ad42ad6696a58d2790f68c06221f12cedc5 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ - 项目名称:实现二维码扫码功能 - 所属系列:openharmony的第三方组件适配移植 - 功能:点击跳转到扫码界面,返回扫码结果 -- 基线版本: Release Tags 0.1.2 - 项目移植状态:主功能完成 - 调用差异:无 -- 开发版本:sdk5,DevEco Studio2.1 Release +- 开发版本:sdk6,DevEco Studio 2.2 Beta1 +- 基线版本: Release Tags 0.1.2 #### 效果演示 @@ -58,7 +58,7 @@ QrManager.getInstance().startScan(this, new QrManager.OnScanResultCallback() { getUITaskDispatcher().asyncDispatch(new Runnable() { @Override public void run() { - //result为扫描结果 + // result为扫描结果 } }); } @@ -70,7 +70,7 @@ CodeCheck代码测试无异常 CloudTest代码测试无异常 -火绒安全病毒安全检测通过 +病毒安全检测通过 当前版本demo功能与原组件基本无差异 diff --git a/build.gradle b/build.gradle index 83d884f02e8af69834e5d58b7b639f22d0a08708..2ac7b7a5b5ab94280b3b09df2a8326d0c65ac8d3 100644 --- a/build.gradle +++ b/build.gradle @@ -19,8 +19,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.4.2' - classpath 'com.huawei.ohos:decctest:1.0.0.6' + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' } } diff --git a/entry/build.gradle b/entry/build.gradle index 84bcffdffa26c713b44e5e699f641c0ea237eea8..b3ae993a3aaa17fe430796aa033ca290b3bd50c0 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.huawei.ohos.hap' apply plugin: 'com.huawei.ohos.decctest' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/entry/src/main/config.json b/entry/src/main/config.json index d8a32ebe9d7d77da74381b8ddba577dcce425acb..dcdbb849a6b8830ed2f0cc60bb4a68dfaf9ae32e 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -5,10 +5,6 @@ "version": { "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5 } }, "deviceConfig": {}, diff --git a/qrcodescanner/build.gradle b/qrcodescanner/build.gradle index 1db1f771986cf4f3d8a8d57730209a73f574411c..3f3379a1ace8502d8d9e563dab355089d3501dea 100644 --- a/qrcodescanner/build.gradle +++ b/qrcodescanner/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'com.huawei.ohos.library' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/qrcodescanner/src/main/java/com/blikoon/qrcodescanner/decode/QrManager.java b/qrcodescanner/src/main/java/com/blikoon/qrcodescanner/decode/QrManager.java index 91e35956fd168628400cce0f2ca5e0e890a559a2..58f7528576707fe287478f66d1d5658b542385ad 100644 --- a/qrcodescanner/src/main/java/com/blikoon/qrcodescanner/decode/QrManager.java +++ b/qrcodescanner/src/main/java/com/blikoon/qrcodescanner/decode/QrManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Chinese Software International Co., Ltd. + * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain an copy of the License at @@ -11,7 +11,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package com.blikoon.qrcodescanner.decode; diff --git a/qrcodescanner/src/main/java/com/blikoon/qrcodescanner/slice/QrCodeAbilitySlice.java b/qrcodescanner/src/main/java/com/blikoon/qrcodescanner/slice/QrCodeAbilitySlice.java index ed474a24bff865f175cc27459e2968f76412e254..e0568a614c3e15920e571b316dbf0c12f15e0efc 100644 --- a/qrcodescanner/src/main/java/com/blikoon/qrcodescanner/slice/QrCodeAbilitySlice.java +++ b/qrcodescanner/src/main/java/com/blikoon/qrcodescanner/slice/QrCodeAbilitySlice.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Chinese Software International Co., Ltd. + * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain an copy of the License at @@ -11,7 +11,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package com.blikoon.qrcodescanner.slice; @@ -35,6 +34,7 @@ import ohos.agp.components.surfaceprovider.SurfaceProvider; import ohos.agp.graphics.Surface; import ohos.agp.graphics.SurfaceOps; import ohos.agp.utils.Color; +import ohos.agp.window.dialog.ToastDialog; import ohos.eventhandler.EventHandler; import ohos.eventhandler.EventRunner; import ohos.global.resource.RawFileDescriptor; @@ -83,6 +83,7 @@ public class QrCodeAbilitySlice extends AbilitySlice { */ private static FrameConfig.Builder frameConfigBuilder; private Player mPlayer; + private boolean isFlash = false; @Override public void onStart(Intent intent) { @@ -159,10 +160,12 @@ public class QrCodeAbilitySlice extends AbilitySlice { */ public void setFlash(Text des) { try { + isFlash = !isFlash; + // 获取预览配置模板 FrameConfig.Builder frameConfigBuilder = myCamera.getFrameConfigBuilder(FRAME_CONFIG_PREVIEW); + // 配置预览Surface frameConfigBuilder.addSurface(previewSurface); - int flashMode = frameConfigBuilder.getFlashMode(); - if (flashMode == Metadata.FlashMode.FLASH_CLOSE) { + if (isFlash) { frameConfigBuilder.setFlashMode(Metadata.FlashMode.FLASH_ALWAYS_OPEN); if (des != null) { des.setText("Close Flash Light"); @@ -173,10 +176,13 @@ public class QrCodeAbilitySlice extends AbilitySlice { des.setText("Open flash light"); } } + // 预览帧变焦值变更 FrameConfig previewFrameConfig = frameConfigBuilder.build(); + + // 启动循环帧捕获 myCamera.triggerLoopingCapture(previewFrameConfig); } catch (Exception e) { - System.out.println(e); + new ToastDialog(this).setText("该设备不支持闪光灯").show(); } }