diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets index d479f233f8c9368f74d44110150e9e41ceac6bb0..9042ab4907c85286cb748a8c10c51f954642aa88 100644 --- a/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -20,70 +20,82 @@ 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 94dd90fa6e835118c175081c5add7bbc11fbcf27..a588ab0671b1b9007f48e27b92e0fa450597c76b 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 92fe12e5e85b0a684220bf299e916f66f8ba74bb..aa7bcb44d1e25701089147837dc28313bf72c6cf 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 () => {