diff --git a/code/ArkTS1.2/CameraSample/.gitignore b/code/ArkTS1.2/CameraSample/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/code/ArkTS1.2/CameraSample/.gitignore @@ -0,0 +1,12 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/AppScope/app.json5 b/code/ArkTS1.2/CameraSample/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4955e7cfb7ca107d9d5e1b4ec985281c52344f4f --- /dev/null +++ b/code/ArkTS1.2/CameraSample/AppScope/app.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +{ + "app": { + "bundleName": "com.samples.CameraSample", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/code/ArkTS1.2/CameraSample/AppScope/resources/base/element/string.json b/code/ArkTS1.2/CameraSample/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f18fccaa35dc71840ffca418d377733a6b122b55 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "CameraSample" + } + ] +} diff --git a/code/ArkTS1.2/CameraSample/AppScope/resources/base/media/app_icon.png b/code/ArkTS1.2/CameraSample/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3 Binary files /dev/null and b/code/ArkTS1.2/CameraSample/AppScope/resources/base/media/app_icon.png differ diff --git a/code/ArkTS1.2/CameraSample/README.md b/code/ArkTS1.2/CameraSample/README.md new file mode 100644 index 0000000000000000000000000000000000000000..91eacd1e00d04937dadf70911627975360d53089 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/README.md @@ -0,0 +1,112 @@ +# 相机场景案例 + +### 介绍 + +本示例介绍相机场景案例的使用:通过[startAbilityForResult](https://docs.openharmony.cn/pages/v5.1/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext.md#startabilityforresult)接口拉起相机,拍照后获取照片地址,使用[Image](https://docs.openharmony.cn/pages/v5.1/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-basic-components-image.md)组件展示照片。 + +### 效果图预览 + + + +**使用说明** +1. 点击输入框输入评论。 +2. 点击相机图标进入拍照。 +3. 点击发布按钮发布评论。 + +### 实现思路 + +1.点击输入框,输入评论内容。 +```typescript +TextInput() + ... + .onChange( + (textInComment: string) => { + this.commentContent = textInComment; + } as EditableTextOnChangeCallback) +``` +2.点击相机图标拉起相机拍照。 +```typescript +cameraCapture(context: common.UIAbilityContext) { + try { + let want: Want = { + action: Constants.ACTION_PICKER_CAMERA, + parameters: { + 'supportMultiMode': false, + 'callBundleName': context.abilityInfo.bundleName + } as Record + }; + context.startAbilityForResult(want, + (err: BusinessError, result: common.AbilityResult) => { + if (err.code) { + hilog.error(0x0000, 'testTag', `startAbilityForResult failed, code is ${err.code}, message is ${err.message}`); + return; + } + if(result.resultCode === 0) { + const param: Record | undefined = result.want?.parameters; + if (param !== undefined) { + const resourceUri: string = param[Constants.KEY_RESULT_PICKER_CAMERA] as string; + this.imagePath = resourceUri; + } + } + }); + + } catch (err) { + let code = (err as BusinessError).code; + let message = (err as BusinessError).message; + hilog.error(0x0000, 'testTag', `startAbilityForResult failed, code is ${code}, message is ${message}`); + } +} +... +Image($r("app.media.icon_comment_camera")) + ... + .onClick((e: ClickEvent) => { + try { + this.cameraCapture(this.getUIContext().getHostContext() as common.UIAbilityContext); + } catch (error: BusinessError) { + hilog.info(0x0000, 'testTag', 'camera capture error:-----------' + error.code); + } + }) +``` +3.使用ForEach展示评论,使用自定义组件ImageListView展示照片。 +```typescript +ForEach(this.commentList, (item: Comment) => { + Column() { + Row() { + Image(item.avatar) + ... + Column() { + Text(item.name) + Text(item.time) + } + ... + } + Text(item.comment) + ... + if (item.images.length > 0) { + ImageListView({ selectedImages: item.images }) + } + } + ... +} +``` +### 高性能知识点 + +不涉及 + +### 工程结构&模块类型 + + ``` + cameraMainAbility + |---constants + | |---Constants.ets // 常量类 + |---model + | |---CommentModel.ets // 评论数据类 + |---components + | |---CommentItemView.ets // 单个评论组件 + | |---ImageListView.ets // 评论图片List组件 + | |---CommentInputAndCameraCapture.ets // 输入框和相机拍照组件 + ``` +### 参考资料 + +[startAbilityForResult参考文档](https://docs.openharmony.cn/pages/v5.1/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext.md#startabilityforresult) +[Image参考文档](https://docs.openharmony.cn/pages/v5.1/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-basic-components-image.md) \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/build-profile.json5 b/code/ArkTS1.2/CameraSample/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4ec4c8254308a30e98fe036995a9dec8ee4841e8 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/build-profile.json5 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "arkTSVersion": "1.2", + "compatibleSdkVersion": "6.0.0(20)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/code-linter.json5 b/code/ArkTS1.2/CameraSample/code-linter.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ed05653cca31b61d64cf6471529eaf50d4f70709 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/code-linter.json5 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +{ + "files": [ + "**/*.ets" + ], + "ignore": [ + "**/src/ohosTest/**/*", + "**/src/test/**/*", + "**/src/mock/**/*", + "**/node_modules/**/*", + "**/oh_modules/**/*", + "**/build/**/*", + "**/.preview/**/*" + ], + "ruleSet": [ + "plugin:@performance/recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "@security/no-unsafe-aes": "error", + "@security/no-unsafe-hash": "error", + "@security/no-unsafe-mac": "warn", + "@security/no-unsafe-dh": "error", + "@security/no-unsafe-dsa": "error", + "@security/no-unsafe-ecdsa": "error", + "@security/no-unsafe-rsa-encrypt": "error", + "@security/no-unsafe-rsa-sign": "error", + "@security/no-unsafe-rsa-key": "error", + "@security/no-unsafe-dsa-key": "error", + "@security/no-unsafe-dh-key": "error", + "@security/no-unsafe-3des": "error" + } +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/.gitignore b/code/ArkTS1.2/CameraSample/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/build-profile.json5 b/code/ArkTS1.2/CameraSample/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..982dbb524bd63408e05cfbed7204dd87a31dd681 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/build-profile.json5 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/hvigorfile.ts b/code/ArkTS1.2/CameraSample/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/code/ArkTS1.2/CameraSample/entry/obfuscation-rules.txt b/code/ArkTS1.2/CameraSample/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/oh-package.json5 b/code/ArkTS1.2/CameraSample/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/oh-package.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/ets/entryability/EntryAbility.ets b/code/ArkTS1.2/CameraSample/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d1eebfd768ce72c9d706f0f172c5ccb6f15f84b --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityConstant from '@ohos.app.ability.AbilityConstant'; +import Want from '@ohos.app.ability.Want'; +import window from '@ohos.window'; +import { BusinessError } from '@ohos.base'; +import hilog from '@ohos.hilog'; + +class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', 'EntryAbility onCreate'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + hilog.info(0x0000, 'testTag', 'EntryAbility onWindowStageCreate'); + try { + windowStage.loadContent('pages/Index', (err: BusinessError): void => { + hilog.info(0x0000, 'testTag', 'loadContent entering'); + if (err.code) { + hilog.error(0x0000, 'testTag', 'loadContent error'); + return; + } + hilog.info(0x0000, 'testTag', 'loadContent ok'); + }); + } catch (e: Error) { + hilog.error(0x0000, 'testTag', 'loadContent catch error:-----------' + e.message); + } + } +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/CommentInputAndCameraCapture.ets b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/CommentInputAndCameraCapture.ets new file mode 100644 index 0000000000000000000000000000000000000000..b43513f0e5809e0e7df7fe11ab2560781fa2c9a4 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/CommentInputAndCameraCapture.ets @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +import { memo, __memo_context_type, __memo_id_type } from '@ohos.arkui.stateManagement' // should be insert by ui-plugins +import { TouchEvent, TextInputController, RowAttribute, FlexAlign, EditableTextOnChangeCallback, TextInput, Margin, Row, VerticalAlign, HorizontalAlign, AlignRuleOption, Padding, $r, Image, Text, + TextAttribute, Column, UIRowAttribute, Component, Button, ButtonAttribute, ClickEvent, UserView, Offset, Position, ResourceStr} from '@ohos.arkui.component' // TextAttribute should be insert by ui-plugins +import { Link, StorageLink, Consume, State, StateDecoratedVariable, MutableState, stateOf, observableProxy } from '@ohos.arkui.stateManagement' // should be insert by ui-plugins +import hilog from '@ohos.hilog' +import { Comment } from '../model/CommentModel'; +import common from '@ohos.app.ability.common' +import { UIContext } from '@ohos.arkui.UIContext'; +import { Constants } from '../constants/Constants'; +import { BusinessError } from '@ohos.base' +import Want from '@ohos.app.ability.Want' +import image from '@ohos.multimedia.image' + +@Component +export struct Navigation { + @Link items: Array = new Array(); + @State commentContent: string = '' + @State imagePath: string = ''; + controller: TextInputController = new TextInputController(); + getCurrentDate(): string { + const date: Date = new Date(); + return `${date.getFullYear()}-${date.getMonth()}-${date.getDay()} ${date.getHours()}:${date.getMinutes()}`; + } + cameraCapture(context: common.UIAbilityContext) { + try { + let want: Want = { + action: Constants.ACTION_PICKER_CAMERA, + parameters: { + 'supportMultiMode': false, + 'callBundleName': context.abilityInfo.bundleName + } as Record + }; + context.startAbilityForResult(want, (err: BusinessError, result: common.AbilityResult) => { + if (err.code) { + hilog.error(0x0000, 'testTag', `startAbilityForResult failed, code is ${err.code}, message is ${err.message}`); + return; + } + if(result.resultCode === 0) { + const param: Record | undefined = result.want?.parameters; + if (param !== undefined) { + const resourceUri: string = param[Constants.KEY_RESULT_PICKER_CAMERA] as string; + this.imagePath = resourceUri; + } + } + }); + } catch (err) { + let code = (err as BusinessError).code; + let message = (err as BusinessError).message; + hilog.error(0x0000, 'testTag', `startAbilityForResult failed, code is ${code}, message is ${message}`); + } + } + build() { + Column() { + Row() { + TextInput({placeholder: $r('app.string.TextInput_placeholder'), text: this.commentContent}) + .height(40) + .width('70%') + .padding({ + left: 10, + right: 50, + top: 3, + bottom: 3 + } as Padding) + .margin({ + right: 10 + } as Margin) + .onChange((textInComment: string) => { + this.commentContent = textInComment; + } as EditableTextOnChangeCallback) + Image($r('app.media.icon_comment_camera')) + .height(30) + .width(30) + .margin({ + right: 10 + } as Margin) + .onClick((e: ClickEvent) => { + try { + this.cameraCapture(this.getUIContext().getHostContext() as common.UIAbilityContext); + } catch (error: BusinessError) { + hilog.info(0x0000, 'testTag', 'camera capture error:-----------' + error.code); + } + }) + Button($r('app.string.Comment_publish')) + .height(30) + .width(60) + .onClick((e: ClickEvent) => { + if(this.imagePath !== '') { + let mockData2: Comment = new Comment(); + mockData2.name = 'LiHua'; + mockData2.comment = this.commentContent; + mockData2.avatar = $r('app.media.icon_comment_app_logo2'); + mockData2.images = [this.imagePath]; + mockData2.time = this.getCurrentDate(); + this.items = [...this.items, mockData2]; + this.imagePath = ''; + this.commentContent = ''; + } + }) + }.justifyContent(FlexAlign.End) + } + } +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/CommentItemView.ets b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/CommentItemView.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb96916725147aa46923e1c367e61402600a6ceb --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/CommentItemView.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +import { Comment } from '../model/CommentModel'; +import { ImageListView } from './ImageListView'; +import { memo, __memo_context_type, __memo_id_type } from '@ohos.arkui.stateManagement' // should be insert by ui-plugins +import { Margin, Padding, HorizontalAlign, Resource, TextInput, Color, RelativeContainer, Padding, ResourceStr, CustomDialogController, Image, $r, ImageAttribute, Text, Row, TextAttribute, Column, Component, Button, ButtonAttribute, ClickEvent, UserView, Image, FlexAlign, HorizontalAlign, FlexDirection, Flex, ItemAlign } from '@ohos.arkui.component' // TextAttribute should be insert by ui-plugins +import { Link, StorageLink, State, StateDecoratedVariable, MutableState, stateOf, observableProxy } from '@ohos.arkui.stateManagement' // should be insert by ui-plugins Extend, +import hilog from '@ohos.hilog' +import { ImageListView } from './ImageListView' +@Component +export struct CommentView { + private comment: Comment = new Comment(); + + build() { + Column() { + Row() { + Image(this.comment.avatar) + .width(50) + .height(50) + .borderRadius(25) + Column() { + Text(this.comment.name) + Text(this.comment.time) + } + .alignItems(HorizontalAlign.Start) + .margin({ + left: 5 + } as Margin) + } + .width('100%') + + Text(this.comment.comment) + .width('100%') + .margin({ + top: 5 + } as Margin) + if (this.comment.images.length > 0) { + ImageListView({ selectedImages: this.comment.images }) + } + } + .width('100%') + .padding(10) + } +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/ImageListView.ets b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/ImageListView.ets new file mode 100644 index 0000000000000000000000000000000000000000..310fa24972ff683cef31fd6ab6303b6bdc38389e --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Components/ImageListView.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ +import { memo, __memo_context_type, __memo_id_type } from '@ohos.arkui.stateManagement' // should be insert by ui-plugins +import { RowAttribute, Padding, Axis, Resource, ListItem, ForEach, List, ResourceStr, CustomDialogController, Image, $r, ImageAttribute, Text, Row, TextAttribute, Column, Component, Button, ButtonAttribute, ClickEvent, UserView, Image, FlexAlign, HorizontalAlign, FlexDirection, Flex, ItemAlign } from '@ohos.arkui.component' // TextAttribute should be insert by ui-plugins +import { Link, StorageLink, State, StateDecoratedVariable, MutableState, stateOf, observableProxy } from '@ohos.arkui.stateManagement' // should be insert by ui-plugins Extend, +import hilog from '@ohos.hilog' + +@Component +export struct ImageListView { + @State selectedImages: Array = new Array(); + build() { + Column() { + Row() { + ForEach(this.selectedImages, (image: ResourceStr, index: Double) => { + Image(image) + .height(100) + .width(100) + .borderRadius(5) + }) + } + .width('100%') + .height(110) + .justifyContent(FlexAlign.Start) + } + } +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Index.ets b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ee639fc7c9589bb784f538589791eaf0e640005 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ +import { memo, __memo_context_type, __memo_id_type } from '@ohos.arkui.stateManagement' // should be insert by ui-plugins +import { BarState, ScrollDirection, Scroll, Scroller, AlertDialogParamWithOptions, ForEach, ListItem, BarState, TextAlign, LazyForEach, List, ScrollAlign, ListScroller, RowAttribute, FlexAlign, + Color, EditableTextOnChangeCallback, TextInput, Margin, Row, VerticalAlign, HorizontalAlign, + EdgeWidths, EdgeColors, AlignRuleOption, Padding, BorderOptions, $r, Image, Text, + TextAttribute, Column, UIRowAttribute, Component, Button, ButtonAttribute, ClickEvent, UserView, Offset, Position, ResourceStr} from '@ohos.arkui.component' // TextAttribute should be insert by ui-plugins +import { StorageLink, Consume, State, StateDecoratedVariable, MutableState, stateOf, observableProxy } from '@ohos.arkui.stateManagement' // should be insert by ui-plugins +import hilog from '@ohos.hilog' +import common from '@ohos.app.ability.common' +import { UIContext } from '@ohos.arkui.UIContext'; +import { Comment } from './model/CommentModel'; +import { CommentView } from './Components/CommentItemView'; +import { Navigation } from './Components/CommentInputAndCameraCapture'; +import { ImageListView } from './Components/ImageListView' +import photoAccessHelper from '@ohos.file.photoAccessHelper'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; +import { BusinessError } from '@ohos.base' + +@Component +struct MyStateSample { + @State commentList: Array = new Array(); + aboutToAppear() { + let mockData1: Comment = new Comment(); + mockData1.name = 'Cloud'; + mockData1.comment = $r('app.string.Comment_text'); + mockData1.avatar = $r('app.media.icon_comment_app_logo1'); + mockData1.images.push($r('app.media.icon_comment_landscape1')); + mockData1.images.push($r('app.media.icon_comment_launch_advert')); + mockData1.time = '02-07 13:25'; + this.commentList.push(mockData1); + } + + build() { + Scroll() { + Column() { + Navigation({ items: this.commentList }) + ForEach(this.commentList, (item: Comment) => { + Column() { + Row() { + Image(item.avatar) + .width(50) + .height(50) + .borderRadius(25) + Column() { + Text(item.name) + Text(item.time) + } + .alignItems(HorizontalAlign.Start) + .margin({ + left: 5 + } as Margin) + } + .width('100%') + + Text(item.comment) + .width('100%') + .margin({ + top: 5 + } as Margin) + if (item.images.length > 0) { + ImageListView({ selectedImages: item.images }) + } + } + .width('100%') + .padding(10) + } + ) + } + .width('100%') + .justifyContent(FlexAlign.Start) + } + .scrollable(ScrollDirection.Vertical) + } +} + +export class ComExampleTrivialApplication extends UserView { + getBuilder() { + let wrapper = @memo () => { + MyStateSample(undefined) + } + return wrapper + } +} diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/constants/Constants.ets b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/constants/Constants.ets new file mode 100644 index 0000000000000000000000000000000000000000..32c16045c56b17d3fe4083d5e98dc8883b8d6fdc --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/constants/Constants.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +export class Constants { + static readonly ACTION_PICKER_CAMERA: string = 'ohos.want.action.imageCapture'; + static readonly KEY_RESULT_PICKER_CAMERA: string = 'resourceUri'; +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/model/CommentModel.ets b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/model/CommentModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..51855045283661f4a24be2efaeeb0bd836daced2 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/model/CommentModel.ets @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ +import { ResourceStr } from '@ohos.arkui.component' // TextAttribute should be insert by ui-plugins + +export class Comment { + public id: number = 0; + public name: string = ''; + public avatar: ResourceStr = ''; + public time: string = ''; + public comment: string = ''; + public images: Array = new Array(); +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/module.json5 b/code/ArkTS1.2/CameraSample/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e640c364d0020ea335097b0a3d962b3f5ad14469 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/module.json5 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/color.json b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/float.json b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "page_text_font_size", + "value": "50fp" + } + ] +} diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/string.json b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ddfd4ec7d2122c830e98f97c926b822fc82b1297 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "CameraSample" + }, + { + "name": "Comment_text", + "value": "这里风景很好" + }, + { + "name": "TextInput_placeholder", + "value": "输入评论" + }, + { + "name": "Comment_publish", + "value": "发布" + } + ] +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/background.png b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/background.png differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/cameraAbility.png b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/cameraAbility.png new file mode 100644 index 0000000000000000000000000000000000000000..a1db5fe59c269481583125e0963b1aed5e2cd64a Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/cameraAbility.png differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/foreground.png b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/foreground.png differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_app_logo1.png b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_app_logo1.png new file mode 100644 index 0000000000000000000000000000000000000000..f7a029b5bc94ad5f4fb1c0124b83475f5661876b Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_app_logo1.png differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_app_logo2.png b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_app_logo2.png new file mode 100644 index 0000000000000000000000000000000000000000..ce47cda1e9be97e92e997dbeeb74c839f9a08257 Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_app_logo2.png differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_camera.png b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_camera.png new file mode 100644 index 0000000000000000000000000000000000000000..74ef98c4f7367f8403eaea79a2c1987328f4532f Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_camera.png differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_landscape1.jpg b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_landscape1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..65811244040a76430bd07853e7438988f2bf8be5 Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_landscape1.jpg differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_launch_advert.jpg b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_launch_advert.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b137e3b4c47ad881e23e546aaa9d5f810ddefdb9 Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/icon_comment_launch_advert.jpg differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/layered_image.json b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/startIcon.png b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/media/startIcon.png differ diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/profile/backup_config.json b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/profile/main_pages.json b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/code/ArkTS1.2/CameraSample/entry/src/main/resources/dark/element/color.json b/code/ArkTS1.2/CameraSample/entry/src/main/resources/dark/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/entry/src/main/resources/dark/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/code/ArkTS1.2/CameraSample/hvigor/hvigor-config.json5 b/code/ArkTS1.2/CameraSample/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..08254a495f66f3382dd5dd4830f6d1c997d59deb --- /dev/null +++ b/code/ArkTS1.2/CameraSample/hvigor/hvigor-config.json5 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +{ + "modelVersion": "5.0.2", + "dependencies": { + "@ohos/hvigor-ohos-online-sign-plugin": "4.0.2" + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/code/ArkTS1.2/CameraSample/hvigorfile.ts b/code/ArkTS1.2/CameraSample/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/code/ArkTS1.2/CameraSample/oh-package.json5 b/code/ArkTS1.2/CameraSample/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3b555a4269faeadc6caab93d696e194c30862899 --- /dev/null +++ b/code/ArkTS1.2/CameraSample/oh-package.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 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 a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ + +{ + "modelVersion": "5.0.2", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.21", + "@ohos/hamock": "1.0.0" + } +} diff --git a/code/ArkTS1.2/CameraSample/ohosTest.md b/code/ArkTS1.2/CameraSample/ohosTest.md new file mode 100644 index 0000000000000000000000000000000000000000..88f47600687c7da39894b1485c8c562dd0d968fe --- /dev/null +++ b/code/ArkTS1.2/CameraSample/ohosTest.md @@ -0,0 +1,7 @@ +# 相机场景测试用例 + +## 用例表 + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +|-----------------------------------|-------------------------------------|----------------------|------------------------------------|------|------| +| 发布图片文字评论 | 1. 需在真机测试
2. 构建并安装测试hap
3.进入【发布图片评论案例】| 1、点击输入框并输入文字
2、点击相机按钮并完成拍照
3、点击发布按钮| 1、正常拉起键盘,文字正常显示
2、正常拉起系统相机,拍照后可以回到上级页面
3、列表中有新发布的图文评论以及发布人信息、发布时间 | 否 | Pass |