From 9f5e523f13a70bcc876bad1bf88f4dfa5351f426 Mon Sep 17 00:00:00 2001 From: 0000248716-lijiaxiao Date: Mon, 5 Jul 2021 16:48:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.OPENSOURCE | 2 +- README.md | 8 ++++---- build.gradle | 4 ++-- entry/build.gradle | 2 +- entry/src/main/config.json | 4 ---- qrcodescanner/build.gradle | 2 +- .../blikoon/qrcodescanner/decode/QrManager.java | 3 +-- .../qrcodescanner/slice/QrCodeAbilitySlice.java | 16 +++++++++++----- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/README.OPENSOURCE b/README.OPENSOURCE index 0a28852..f3469ef 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 c1e133f..774f9ad 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 83d884f..2ac7b7a 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 84bcffd..b3ae993 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 d8a32eb..dcdbb84 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 1db1f77..3f3379a 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 91e3595..58f7528 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 ed474a2..e0568a6 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(); } } -- Gitee