From 3a6d2ea3a0779eaf43bfc5435dca0823cbe828b4 Mon Sep 17 00:00:00 2001 From: lloyd <754415+llince@user.noreply.gitee.com> Date: Wed, 2 Apr 2025 11:30:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E5=9F=BA=E4=BA=8E=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=A7=86=E8=A7=89=E6=9C=8D=E5=8A=A1=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E5=AE=9E=E7=8E=B0=E6=8B=8D=E7=85=A7=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E6=96=87=E5=AD=97=E5=8A=9F=E8=83=BD=E3=80=91=E5=BA=9F=E5=BC=83?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ets/common/constants/CommonConstants.ets | 25 ++++++++++++++++--- entry/src/main/ets/common/utils/Camera.ets | 2 +- entry/src/main/ets/pages/Index.ets | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets index d479f23..098bdb6 100644 --- a/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -20,70 +20,87 @@ export default class CommonConstants { * The size of arraybuffer size. */ static readonly ARRAYBUFFER_SIZE: number = 4069; + /** * The device outputs the sequence number. */ static readonly OUTPUT_DEVICE_INDEX: number = 5; + /** * The device inputs the sequence number. */ static readonly INPUT_DEVICE_INDEX: number = 0; + /** * The width of the image receiving stream. */ static readonly IMAGE_RECEIVER_WIDTH: number = 640; + /** * The height of the image receiving stream. */ static readonly IMAGE_RECEIVER_HEIGHT: number = 480; + /** * The capacity of the image receiving stream. */ static readonly IMAGE_RECEIVER_CAPACITY: number = 8; + /** * The size of full width. */ - static readonly FULL_WIDTH: string = "100%"; + static readonly FULL_WIDTH: string = '100%'; + /** * The size of full height. */ - static readonly FULL_Height: string = "100%"; + static readonly FULL_Height: string = '100%'; + /** * The true number. */ static readonly TRUE_NUMBER: number = 1; + /** * The false number. */ static readonly FALSE_NUMBER: number = 0; + /** * The width of surface. */ static readonly SURFACE_WIDTH: number = 1200; + /** * The height of surface. */ static readonly SURFACE_HEIGHT: number = 2000; + /** * The type of xcomponent. */ static readonly XCOMPONENT_TYPE: string = 'surface'; + /** * The id of xcomponent. */ static readonly XCOMPONENT_ID: string = 'xcomponent1'; + /** * The height expect xcomponent. */ static readonly OTHER_HEIGHT: number = 264; + /** * The width of dialog_block. */ - static readonly DIALOG_WIDTH: string = "93%"; + static readonly DIALOG_WIDTH: string = '93%'; + /** * The color of dialog_mask. */ - static readonly DIALOG_TEXT_MASK_COLOR: string = "rgba(0, 0, 0, 0.2)"; + static readonly DIALOG_TEXT_MASK_COLOR: string = 'rgba(0, 0, 0, 0.2)'; + /** * The weight of bold font. */ diff --git a/entry/src/main/ets/common/utils/Camera.ets b/entry/src/main/ets/common/utils/Camera.ets index 94dd90f..a588ab0 100644 --- a/entry/src/main/ets/common/utils/Camera.ets +++ b/entry/src/main/ets/common/utils/Camera.ets @@ -78,7 +78,7 @@ export default class Camera { isDirectionDetectionSupported: true }; let recognitionString: string = ''; - if (canIUse("SystemCapability.AI.OCR.TextRecognition")) { + if (canIUse('SystemCapability.AI.OCR.TextRecognition')) { await textRecognition.recognizeText(visionInfo, textConfiguration).then((TextRecognitionResult) => { if (TextRecognitionResult.value === '') { let context = getContext(this) as common.UIAbilityContext diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 92fe12e..aa7bcb4 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -89,7 +89,7 @@ struct Index { Row() { XComponent({ id: CommonConstants.XCOMPONENT_ID, - type: CommonConstants.XCOMPONENT_TYPE, + type: XComponentType.SURFACE, controller: this.xcomponentController }) .onLoad(async () => { -- Gitee From 9b3dda25b05a4e035b3bf924e16946db1c6ac3a9 Mon Sep 17 00:00:00 2001 From: lloyd <754415+llince@user.noreply.gitee.com> Date: Thu, 3 Apr 2025 15:52:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E5=9F=BA=E4=BA=8E=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=A7=86=E8=A7=89=E6=9C=8D=E5=8A=A1=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E5=AE=9E=E7=8E=B0=E6=8B=8D=E7=85=A7=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E6=96=87=E5=AD=97=E5=8A=9F=E8=83=BD=E3=80=91=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/constants/CommonConstants.ets | 5 ----- 1 file changed, 5 deletions(-) diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets index 098bdb6..9042ab4 100644 --- a/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -76,11 +76,6 @@ export default class CommonConstants { */ static readonly SURFACE_HEIGHT: number = 2000; - /** - * The type of xcomponent. - */ - static readonly XCOMPONENT_TYPE: string = 'surface'; - /** * The id of xcomponent. */ -- Gitee