diff --git a/GestureConflict/AppScope/app.json5 b/GestureConflict/AppScope/app.json5 deleted file mode 100644 index 99a7c4e45f22fc5a6ed643360dff373f67b194aa..0000000000000000000000000000000000000000 --- a/GestureConflict/AppScope/app.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.gestureconflict", - "vendor": "samples", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:layered_image", - "label": "$string:app_name" - } -} diff --git a/GestureConflict/AppScope/resources/base/element/string.json b/GestureConflict/AppScope/resources/base/element/string.json deleted file mode 100644 index f7b6b8642bbdc34358a7e05e87191130e96f0b46..0000000000000000000000000000000000000000 --- a/GestureConflict/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "GestureConflict" - } - ] -} diff --git a/GestureConflict/AppScope/resources/base/media/background.png b/GestureConflict/AppScope/resources/base/media/background.png deleted file mode 100644 index 923f2b3f27e915d6871871deea0420eb45ce102f..0000000000000000000000000000000000000000 Binary files a/GestureConflict/AppScope/resources/base/media/background.png and /dev/null differ diff --git a/GestureConflict/AppScope/resources/base/media/foreground.png b/GestureConflict/AppScope/resources/base/media/foreground.png deleted file mode 100644 index eb9427585b36d14b12477435b6419d1f07b3e0bb..0000000000000000000000000000000000000000 Binary files a/GestureConflict/AppScope/resources/base/media/foreground.png and /dev/null differ diff --git a/GestureConflict/AppScope/resources/base/media/layered_image.json b/GestureConflict/AppScope/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/GestureConflict/AppScope/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/GestureConflict/README_zh.md b/GestureConflict/README_zh.md deleted file mode 100644 index aeab32207b1094cec41e62a0f385a99d10e2a55c..0000000000000000000000000000000000000000 --- a/GestureConflict/README_zh.md +++ /dev/null @@ -1,91 +0,0 @@ -# 手势冲突处理 - -## 介绍 - -本示例为[手势冲突处理](https://gitcode.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/arkts-gesture-events-gesture-judge.md)的配套示例工程。 - -本示例展示了适配手势冲突处理的组件及触发方式。 - -## 效果预览 - -| 首页 | 自定义手势判定 | -|---------------------------------------|-------------------------------------| -| ![](screenshots/Home.jpg) | ![](screenshots/userDefined.jpg) | -| 手势并行动态控制 | 阻止手势参与识别 | -| ![](screenshots/kineticControl.jpg) | ![](screenshots/Stop.jpg) | - - -### 具体实现 - -1. **基础单个手势识别**:用系统手势类创建实例,绑定回调并关联组件。 - 点击(TapGesture):设 count(点击次数),onAction 定义逻辑,.gesture () 绑定组件。 - 长按(LongPressGesture):设 duration(触发时间),onActionStart/End 处理始末逻辑。 - 滑动(PanGesture):设 direction(方向),onActionUpdate 获取 offsetX/Y 实现跟随滑动。 -2. **组合手势识别**:用 GestureGroup 按模式管理多手势。 - 并行(Parallel):如捏合 + 旋转,可同时触发。 - 顺序(Serial):如长按后滑动,需先触发前者。 - 互斥(Exclusive):如点击 / 长按,优先识别高优先级手势。 -3. **手势冲突处理**: - 优先级:通过 priority 属性(值越大优先级越高)设置。 - 父子组件:父组件用 gestureMask 控制子组件手势透传。 - 条件过滤:回调中加判断(如有效滑动偏移)避免误触。 - - -### 使用说明 - -1. **API 适配场景**: - GestureGroup 模式:Parallel 无冲突用,Serial 有先后依赖用,Exclusive 互斥用。 - 属性范围:priority 按需设(建议 1-5 级),PanGesture 不设 direction 默认全方向。 - -2. **@冲突优先预防**: - 同一组件少绑手势,拆分交互逻辑。 - 父子组件分层:父绑范围手势(如页面滑动),子绑精准手势(如按钮点击)。 - -3. **问题排查**: - 不触发:查组件 enabled、手势绑定、高优先级拦截。 - 触发异常:查 GestureGroup 模式、回调异常逻辑 - -## 工程目录 - -``` -entry/src/main/ets/ -└── pages - └── Index.ets (获取文本界面) -└── Component/CustomGestures - └── CustomGestureDetermination.ets // 自定义手势判定页面 - └── CustomGestures.ets // 自定义手势判定页面片段 -└── Component/GestureAndMotionControl - └── GestureAndMotionControl.ets // 手势并行动态控制页面 - └── GestureControl.ets // 手势并行动态控制页面片段 -└── Component/PreventGestureRecognition - └── PreventGestureRecognition.ets // 阻止手势参与识别页面 - └── PreventIdentification.ets // 阻止手势参与识别页面片段 -``` - -## 相关权限 - -不涉及 - -## 依赖 - -不涉及 - -## 约束和限制 - -1. 本示例支持标准系统上运行,支持设备:RK3568; - -2. 本示例支持API20版本SDK,版本号:6.0.0.36; - -3. 本示例已支持使DevEco Studio 5.0.5 Release (构建版本:5.0.13.100,构建 2025年4月25日)编译运行 - -## 下载 - -如需单独下载本工程,执行如下命令: - -``` -git init -git config core.sparsecheckout true -echo code/DocsSample/ArkUISample/GestureConflict > .git/info/sparse-checkout -git remote add origin https://gitcode.com/openharmony/applications_app_samples.git -git pull origin master -``` \ No newline at end of file diff --git a/GestureConflict/build-profile.json5 b/GestureConflict/build-profile.json5 deleted file mode 100644 index 3ca5a93fb814017ac4c398aacbdf17b1d8b0a237..0000000000000000000000000000000000000000 --- a/GestureConflict/build-profile.json5 +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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", - "compileSdkVersion": "6.0.0(20)", - "compatibleSdkVersion": "6.0.0(20)", - "targetSdkVersion": "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/GestureConflict/code-linter.json5 b/GestureConflict/code-linter.json5 deleted file mode 100644 index 5c4682f8164874ec7e9cb8f99ff8b3228ffbc126..0000000000000000000000000000000000000000 --- a/GestureConflict/code-linter.json5 +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/GestureConflict/entry/build-profile.json5 b/GestureConflict/entry/build-profile.json5 deleted file mode 100644 index 9016faf39f8a65cf648bae246a53575510fe8b9f..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/build-profile.json5 +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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": { - "resOptions": { - "copyCodeResource": { - "enable": false - } - } - }, - "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/GestureConflict/entry/hvigorfile.ts b/GestureConflict/entry/hvigorfile.ts deleted file mode 100644 index f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/hvigorfile.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. */ -} \ No newline at end of file diff --git a/GestureConflict/entry/obfuscation-rules.txt b/GestureConflict/entry/obfuscation-rules.txt deleted file mode 100644 index 272efb6ca3f240859091bbbfc7c5802d52793b0b..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/obfuscation-rules.txt +++ /dev/null @@ -1,23 +0,0 @@ -# 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/GestureConflict/entry/oh-package.json5 b/GestureConflict/entry/oh-package.json5 deleted file mode 100644 index 10cda399b0aec3099b257299a57d284393e4e55a..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/oh-package.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/GestureConflict/entry/src/main/ets/Component/CustomGestures/CustomGestureDetermination.ets b/GestureConflict/entry/src/main/ets/Component/CustomGestures/CustomGestureDetermination.ets deleted file mode 100644 index 8263dd22391576c3b6d3ef308c563d8d724a14a9..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/Component/CustomGestures/CustomGestureDetermination.ets +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -// [Start CustomGestures] -import { PromptAction } from '@kit.ArkUI'; - -@Entry -@Component -struct Index { - scroller: Scroller = new Scroller(); - promptAction: PromptAction = this.getUIContext().getPromptAction(); - - build() { - Scroll(this.scroller) { - Column({ space: 8 }) { - // $r('app.string.Drag_instructions') 需要替换为开发者所需的资源文件 - Text($r('app.string.Drag_instructions')).width('100%').fontSize(20).fontColor('0xffdd00') - Stack({ alignContent: Alignment.Center }) { - Column() { - // 模拟上半区和下半区 - Stack().width('200vp').height('100vp').backgroundColor(Color.Red) - Stack().width('200vp').height('100vp').backgroundColor(Color.Blue) - }.width('200vp').height('200vp') - // Stack的下半区是绑定了滑动手势的图像区域。 - // $r('sys.media.ohos_app_icon') 需要替换为开发者所需的资源文件 - Image($r('sys.media.ohos_app_icon')) - .draggable(true) - .onDragStart(()=>{ - // $r('app.string.Allow_dragging_prompt') 需要替换为开发者所需的资源文件 - this.promptAction.showToast({ message: $r('app.string.Allow_dragging_prompt') }); - }) - .width('200vp').height('200vp') - // Stack的上半区是绑定了长按手势的浮动区域。 - Stack() { - } - .width('200vp') - .height('200vp') - .hitTestBehavior(HitTestMode.Transparent) - .gesture(GestureGroup(GestureMode.Parallel, - LongPressGesture() - .onAction((event: GestureEvent) => { - // $r('app.string.Stop_dragging_prompt') 需要替换为开发者所需的资源文件 - this.promptAction.showToast({ message: $r('app.string.Stop_dragging_prompt') }); - }) - .tag('longpress') - )) - .onGestureJudgeBegin((gestureInfo: GestureInfo, event: BaseGestureEvent) => { - // 如果是长按类型手势,判断点击的位置是否在上半区 - if (gestureInfo.type == GestureControl.GestureType.LONG_PRESS_GESTURE) { - if (event.fingerList.length > 0 && event.fingerList[0].localY < 100) { - return GestureJudgeResult.CONTINUE; - } else { - return GestureJudgeResult.REJECT; - } - }; - return GestureJudgeResult.CONTINUE; - }) - }.width('100%') - }.width('100%') - } - }; -} -// [End CustomGestures] \ No newline at end of file diff --git a/GestureConflict/entry/src/main/ets/Component/CustomGestures/CustomGestures.ets b/GestureConflict/entry/src/main/ets/Component/CustomGestures/CustomGestures.ets deleted file mode 100644 index 34a60c27ca451e4dad14bfd3525bee2c7527549a..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/Component/CustomGestures/CustomGestures.ets +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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 { PromptAction } from '@kit.ArkUI'; -@Entry -@Component -struct CustomGestures { - scroller: Scroller = new Scroller(); - build() { - Scroll(this.scroller) { - Column({ space: 8 }) { - // $r('app.string.Drag_instructions') 需要替换为开发者所需的资源文件 - Text($r('app.string.Drag_instructions')).width('100%').fontSize(20).fontColor('0xffdd00') - Stack({ alignContent: Alignment.Center }) { - Column() { - // 模拟上半区和下半区 - Stack().width('200vp').height('100vp').backgroundColor(Color.Red) - Stack().width('200vp').height('100vp').backgroundColor(Color.Blue) - }.width('200vp').height('200vp') - - - // [Start ComponentDragging] - // $r('sys.media.ohos_app_icon') 需要替换为开发者所需的资源文件 - Image($r('sys.media.ohos_app_icon')) - .draggable(true) - .onDragStart(()=>{ - // [StartExclude ExcludeComponentDragging] - let promptAction: PromptAction = this.getUIContext().getPromptAction(); - // [EndExclude ExcludeComponentDragging] - // $r('app.string.Allow_dragging_prompt') 需要替换为开发者所需的资源文件 - promptAction.showToast({ message: $r('app.string.Allow_dragging_prompt') }); - }) - .width('200vp').height('200vp') - // [End ComponentDragging] - - - - // [Start SetGestures] - Stack() {} - .width('200vp') - .height('200vp') - .hitTestBehavior(HitTestMode.Transparent) - .gesture(GestureGroup(GestureMode.Parallel, - LongPressGesture() - .onAction((event: GestureEvent) => { - // [StartExclude ExcludeSetGestures] - let promptAction: PromptAction = this.getUIContext().getPromptAction(); - // [EndExclude ExcludeSetGestures] - // $r('app.string.Stop_dragging_prompt') 需要替换为开发者所需的资源文件 - promptAction.showToast({ message: $r('app.string.Stop_dragging_prompt') }); - }) - .tag('longpress') - )) - // [End SetGestures] - - // [Start SetUpInterception] - .onGestureJudgeBegin((gestureInfo: GestureInfo, event: BaseGestureEvent) => { - // 如果是长按类型手势,判断点击的位置是否在上半区 - if (gestureInfo.type == GestureControl.GestureType.LONG_PRESS_GESTURE) { - if (event.fingerList.length > 0 && event.fingerList[0].localY < 100) { - return GestureJudgeResult.CONTINUE; - } else { - return GestureJudgeResult.REJECT; - } - }; - return GestureJudgeResult.CONTINUE; - }) - // [End SetUpInterception] - - }.width('100%') - }.width('100%') - } - }; -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/ets/Component/GestureAndMotionControl/GestureAndMotionControl.ets b/GestureConflict/entry/src/main/ets/Component/GestureAndMotionControl/GestureAndMotionControl.ets deleted file mode 100644 index 4c0b7c23c198b2153817a39abdf6dfb01050c6c5..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/Component/GestureAndMotionControl/GestureAndMotionControl.ets +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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. - */ - -// [Start GestureAndMotionControl] -// xxx.ets -@Entry -@Component -struct FatherControlChild { - scroller: Scroller = new Scroller(); - scroller2: Scroller = new Scroller(); - private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - private childRecognizer: GestureRecognizer = new GestureRecognizer(); - private currentRecognizer: GestureRecognizer = new GestureRecognizer(); - private lastOffset: number = 0; - - build() { - Stack({ alignContent: Alignment.TopStart }) { - Scroll(this.scroller) { // 外部滚动容器 - Column() { - Text('Scroll Area') - .width('90%') - .height(150) - .backgroundColor(0xFFFFFF) - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ top: 10 }) - Scroll(this.scroller2) { // 内部滚动容器 - Column() { - Text('Scroll Area2') - .width('90%') - .height(150) - .backgroundColor(0xFFFFFF) - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ top: 10 }) - Column() { - ForEach(this.arr, (item: number) => { - Text(item.toString()) - .width('90%') - .height(150) - .backgroundColor(0xFFFFFF) - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ top: 10 }) - }, (item: string) => item) - }.width('100%') - } - } - .id('inner') - .width('100%') - .height(800) - }.width('100%') - } - .id('outer') - .height(600) - .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 - .scrollBar(BarState.On) // 滚动条常驻显示 - .scrollBarColor(Color.Gray) // 滚动条颜色 - .scrollBarWidth(10) // 滚动条宽度 - .edgeEffect(EdgeEffect.None) - .shouldBuiltInRecognizerParallelWith((current: GestureRecognizer, others: Array) => { - for (let i = 0; i < others.length; i++) { - let target = others[i].getEventTargetInfo(); - if (target.getId() == 'inner' && others[i].isBuiltIn() && - others[i].getType() == GestureControl.GestureType.PAN_GESTURE) { // 找到将要组成并行手势的识别器 - this.currentRecognizer = current; // 保存当前组件的识别器 - this.childRecognizer = others[i]; // 保存将要组成并行手势的识别器 - return others[i]; // 返回和当前手势将要组成并行手势的识别器 - } - } - return undefined; - }) - .onGestureRecognizerJudgeBegin((event: BaseGestureEvent, current: GestureRecognizer, - others: Array) => { // 在识别器即将要成功时,根据当前组件状态,设置识别器使能状态 - let target = current.getEventTargetInfo(); - if (target && target.getId() == 'outer' && current.isBuiltIn() && - current.getType() == GestureControl.GestureType.PAN_GESTURE) { - for (let i = 0; i < others.length; i++) { - let target = others[i].getEventTargetInfo() as ScrollableTargetInfo; - if (target instanceof ScrollableTargetInfo && target.getId() == 'inner') { // 找到响应链上对应并行的识别器 - let panEvent = event as PanGestureEvent; - this.childRecognizer.setEnabled(true); - this.currentRecognizer.setEnabled(false); - if (target.isEnd()) { // 根据当前组件状态以及移动方向动态控制识别器使能状态 - if (panEvent && panEvent.offsetY < 0) { - this.childRecognizer.setEnabled(false); - this.currentRecognizer.setEnabled(true); - } - } else if (target.isBegin()) { - if (panEvent.offsetY > 0) { - this.childRecognizer.setEnabled(false); - this.currentRecognizer.setEnabled(true); - } - } - } - } - } - return GestureJudgeResult.CONTINUE; - }) - .parallelGesture( // 绑定一个Pan手势作为动态控制器 - PanGesture() - .onActionUpdate((event: GestureEvent) => { - if (this.childRecognizer?.getState() != GestureRecognizerState.SUCCESSFUL || - this.currentRecognizer?.getState() != GestureRecognizerState.SUCCESSFUL) { // 如果识别器状态不是SUCCESSFUL,则不做控制 - return; - } - let target = this.childRecognizer.getEventTargetInfo() as ScrollableTargetInfo; - let currentTarget = this.currentRecognizer.getEventTargetInfo() as ScrollableTargetInfo; - if (target instanceof ScrollableTargetInfo && currentTarget instanceof ScrollableTargetInfo) { - this.childRecognizer.setEnabled(true); - this.currentRecognizer.setEnabled(false); - if (target.isEnd()) { // 在移动过程中实时根据当前组件状态,控制识别器的开闭状态 - if ((event.offsetY - this.lastOffset) < 0) { - this.childRecognizer.setEnabled(false); - if (currentTarget.isEnd()) { - this.currentRecognizer.setEnabled(false); - } else { - this.currentRecognizer.setEnabled(true); - }; - }; - } else if (target.isBegin()) { - if ((event.offsetY - this.lastOffset) > 0) { - this.childRecognizer.setEnabled(false) - if (currentTarget.isBegin()) { - this.currentRecognizer.setEnabled(false); - } else { - this.currentRecognizer.setEnabled(true); - }; - }; - }; - }; - this.lastOffset = event.offsetY; - }) - ) - }.width('100%').height('100%').backgroundColor(0xDCDCDC) - }; -} -// [End GestureAndMotionControl] \ No newline at end of file diff --git a/GestureConflict/entry/src/main/ets/Component/GestureAndMotionControl/GestureControl.ets b/GestureConflict/entry/src/main/ets/Component/GestureAndMotionControl/GestureControl.ets deleted file mode 100644 index 32c1dce9db6d387336b6b322cbd13c727ec63f89..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/Component/GestureAndMotionControl/GestureControl.ets +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ -@Entry -@Component -struct GestureControlGroup { - scroller: Scroller = new Scroller(); - scroller2: Scroller = new Scroller(); - private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - private childRecognizer: GestureRecognizer = new GestureRecognizer(); - private currentRecognizer: GestureRecognizer = new GestureRecognizer(); - private lastOffset: number = 0; - - build() { - Stack({ alignContent: Alignment.TopStart }) { - Scroll(this.scroller) { // 外部滚动容器 - Column() { - Text('Scroll Area') - .width('90%') - .height(150) - .backgroundColor(0xFFFFFF) - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ top: 10 }) - Scroll(this.scroller2) { // 内部滚动容器 - Column() { - Text('Scroll Area2') - .width('90%') - .height(150) - .backgroundColor(0xFFFFFF) - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ top: 10 }) - Column() { - ForEach(this.arr, (item: number) => { - Text(item.toString()) - .width('90%') - .height(150) - .backgroundColor(0xFFFFFF) - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ top: 10 }) - }, (item: string) => item) - }.width('100%') - } - } - .id('inner') - .width('100%') - .height(800) - }.width('100%') - } - .id('outer') - .height(600) - .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 - .scrollBar(BarState.On) // 滚动条常驻显示 - .scrollBarColor(Color.Gray) // 滚动条颜色 - .scrollBarWidth(10) // 滚动条宽度 - .edgeEffect(EdgeEffect.None) - - - // [Start GestureSimultaneously] - .shouldBuiltInRecognizerParallelWith((current: GestureRecognizer, others: Array) => { - for (let i = 0; i < others.length; i++) { - let target = others[i].getEventTargetInfo(); - if (target.getId() == 'inner' && others[i].isBuiltIn() && others[i].getType() == GestureControl.GestureType.PAN_GESTURE) { // 找到将要组成并行手势的识别器 - this.currentRecognizer = current; // 保存当前组件的识别器 - this.childRecognizer = others[i]; // 保存将要组成并行手势的识别器 - return others[i]; // 返回和当前手势将要组成并行手势的识别器 - }; - }; - return undefined; - }) - // [End GestureSimultaneously] - - - // [Start GestureOpeningClosing] - .onGestureRecognizerJudgeBegin((event: BaseGestureEvent, current: GestureRecognizer, - others: Array) => { // 在识别器即将要成功时,根据当前组件状态,设置识别器使能状态 - let target = current.getEventTargetInfo(); - if (target && target.getId() == 'outer' && current.isBuiltIn() && current.getType() == GestureControl.GestureType.PAN_GESTURE) { - for (let i = 0; i < others.length; i++) { - let target = others[i].getEventTargetInfo() as ScrollableTargetInfo; - if (target instanceof ScrollableTargetInfo && target.getId() == 'inner') { // 找到响应链上对应并行的识别器 - let panEvent = event as PanGestureEvent; - this.childRecognizer.setEnabled(true); - this.currentRecognizer.setEnabled(false); - if (target.isEnd()) { // 根据当前组件状态以及移动方向动态控制识别器使能状态 - if (panEvent && panEvent.offsetY < 0) { - this.childRecognizer.setEnabled(false); - this.currentRecognizer.setEnabled(true); - }; - } else if (target.isBegin()) { - if (panEvent.offsetY > 0) { - this.childRecognizer.setEnabled(false); - this.currentRecognizer.setEnabled(true); - }; - }; - }; - }; - }; - return GestureJudgeResult.CONTINUE; - }) - // [End GestureOpeningClosing] - - // [Start ListeningToGestures] - .parallelGesture( // 绑定一个Pan手势作为动态控制器 - PanGesture() - .onActionUpdate((event: GestureEvent)=>{ - if (this.childRecognizer.getState() != GestureRecognizerState.SUCCESSFUL || - this.currentRecognizer.getState() != GestureRecognizerState.SUCCESSFUL) { // 如果识别器状态不是SUCCESSFUL,则不做控制 - return; - }; - let target = this.childRecognizer.getEventTargetInfo() as ScrollableTargetInfo; - let currentTarget = this.currentRecognizer.getEventTargetInfo() as ScrollableTargetInfo; - if (target instanceof ScrollableTargetInfo && currentTarget instanceof ScrollableTargetInfo) { - this.childRecognizer.setEnabled(true); - this.currentRecognizer.setEnabled(false); - if (target.isEnd()) { // 在移动过程中实时根据当前组件状态,控制识别器的开闭状态 - if ((event.offsetY - this.lastOffset) < 0) { - this.childRecognizer.setEnabled(false); - if (currentTarget.isEnd()) { - this.currentRecognizer.setEnabled(false); - } else { - this.currentRecognizer.setEnabled(true); - }; - }; - } else if (target.isBegin()) { - if ((event.offsetY - this.lastOffset) > 0) { - this.childRecognizer.setEnabled(false); - if (currentTarget.isBegin()) { - this.currentRecognizer.setEnabled(false); - } else { - this.currentRecognizer.setEnabled(true); - }; - }; - }; - }; - this.lastOffset = event.offsetY; - }) - ); - // [End ListeningToGestures] - - }.width('100%').height('100%').backgroundColor(0xDCDCDC); - }; -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/ets/Component/PreventGestureRecognition/PreventGestureRecognition.ets b/GestureConflict/entry/src/main/ets/Component/PreventGestureRecognition/PreventGestureRecognition.ets deleted file mode 100644 index c98101557758ae3073ccb96321dbd6946d0e80a2..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/Component/PreventGestureRecognition/PreventGestureRecognition.ets +++ /dev/null @@ -1,254 +0,0 @@ -/* - * 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. - */ - -// [Start gestureRecognition] -@Entry -@ComponentV2 -struct Index { - @Local progress: number = 496000; // 初始进度,秒 - @Local total: number = 27490000; // 总时长,秒 - @Local currentWidth: string = '100%'; - @Local currentHeight: string = '100%'; - private currentPosX: number = 0; - private currentPosY: number = 0; - private currentFullScreenState: boolean = true; - private normalPlayTimer: number = -1; - private isPlaying: boolean = true; - private fastForwardTimer: number = -1; - private context = this.getUIContext().getHostContext() - - aboutToAppear(): void { - // 启动一个周期性定时器每隔一秒刷新一次进度 - this.startNormalPlayTimer(); - }; - - startNormalPlayTimer(): void { - if (this.normalPlayTimer != -1) { - this.stopNormalPlayTimer() - }; - this.normalPlayTimer = setInterval(() => { - this.progress = this.progress + 1000 - }, 1000); - }; - - stopNormalPlayTimer(): void { - if (this.normalPlayTimer == -1) { - return; - }; - clearInterval(this.normalPlayTimer); - this.normalPlayTimer = -1; - }; - - startFastForwardTimer(): void { - if (this.fastForwardTimer != -1) { - this.stopFastForwardTimer(); - }; - this.fastForwardTimer = setInterval(() => { - this.progress = this.progress + 100000; - }, 100); - }; - - stopFastForwardTimer(): void { - if (this.fastForwardTimer == -1) { - return; - }; - clearInterval(this.fastForwardTimer); - this.fastForwardTimer = -1; - }; - - showMessage(message: string): void { - this.getUIContext().getPromptAction().showToast({ message: message, alignment: Alignment.Center }); - }; - - resetPosInfo(): void { - this.currentPosX = 0; - this.currentPosY = 0; - }; - - toggleFullScreenState(): void { - this.currentFullScreenState = !this.currentFullScreenState; - if (this.currentFullScreenState) { - this.currentWidth = '100%'; - this.currentHeight = '100%'; - } else { - this.currentWidth = '100%'; - this.currentHeight = '50%'; - }; - // $r('app.string.Play_full_screen') 需要替换为开发者所需的资源文件 - // $r('app.string.Exit_play_full_screen') 需要替换为开发者所需的资源文件 - this.showMessage(this.currentFullScreenState - ? this.context!.resourceManager.getStringSync($r('app.string.Play_full_screen').id) - : this.context!.resourceManager.getStringSync($r('app.string.Exit_play_full_screen').id)); - }; - - togglePlayAndPause(): void { - this.isPlaying = !this.isPlaying; - if (!this.isPlaying) { - this.stopNormalPlayTimer(); - } else { - // 重新启动 - this.startNormalPlayTimer(); - }; - // $r('app.string.stop_playing') 需要替换为开发者所需的资源文件 - // $r('app.string.Continue_playing') 需要替换为开发者所需的资源文件 - this.showMessage(this.isPlaying - ? this.context!.resourceManager.getStringSync($r('app.string.stop_playing').id) - : this.context!.resourceManager.getStringSync($r('app.string.Continue_playing').id)); - }; - - doFastForward(start: boolean): void { - if (!start) { // 停止快进,恢复正常播放 - this.stopFastForwardTimer(); - this.startNormalPlayTimer(); - // $r('app.string.Cancel_FastForwarding') 需要替换为开发者所需的资源文件 - this.showMessage( - this.context!.resourceManager.getStringSync($r('app.string.Cancel_FastForwarding').id)); - return; - }; - - this.stopNormalPlayTimer(); - this.startFastForwardTimer(); - // $r('app.string.Start_FastForwarding') 需要替换为开发者所需的资源文件 - this.showMessage( - this.context!.resourceManager.getStringSync($r('app.string.Start_FastForwarding').id)); - }; - - updateBrightness(start: boolean, event: BaseGestureEvent): void { - let newY = event.fingerList[0].localY; - if (start) { - this.currentPosY = newY; - // $r('app.string.Start_adjusting_brightness') 需要替换为开发者所需的资源文件 - this.showMessage(this.context!.resourceManager - .getStringSync($r('app.string.Start_adjusting_brightness').id)); - return; - }; - let offsetY = newY - this.currentPosY; - if (Math.abs(offsetY) > 10) { - // $r('app.string.Reduce_brightness') 需要替换为开发者所需的资源文件 - // $r('app.string.Increase_brightness') 需要替换为开发者所需的资源文件 - this.showMessage((offsetY > 0) - ? this.context!.resourceManager.getStringSync($r('app.string.Reduce_brightness').id) - : this.context!.resourceManager.getStringSync($r('app.string.Increase_brightness').id) ) - this.currentPosY = newY; - }; - }; - - updateProgress(start: boolean, event: BaseGestureEvent): void { - let newX = event.fingerList[0].localX; - if (start) { - this.currentPosX = newX; - // $r('app.string.Adjust_schedule') 需要替换为开发者所需的资源文件 - this.showMessage(this.context!.resourceManager - .getStringSync($r('app.string.Adjust_schedule').id)); - return; - }; - let offsetX = newX - this.currentPosX; - this.progress = Math.floor(this.progress + offsetX * 10000); - this.currentPosX = newX; - }; - - build() { - Stack({ alignContent: Alignment.Center }) { - Column() { - Column() { - // $r('app.string.Playback_progress') 需要替换为开发者所需的资源文件 - Text(this.context!.resourceManager.getStringSync($r('app.string.Playback_progress').id) + this.progress) - } - .width('100%').height('90%') - Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Slider({ - value: this.progress, - min: 0, - max: this.total, - style: SliderStyle.OutSet - }) - .onChange((value: number, mode: SliderChangeMode) => { - this.progress = value; - }) - .id('progress_layer') - .onTouchTestDone((event, allRecognizers: Array) => { - for (let i = 0; i < allRecognizers.length; i++) { - let recognizer = allRecognizers[i]; - let inspectorInfo = recognizer.getEventTargetInfo().getId(); - if (inspectorInfo !== 'progress_layer') { - // 用户操作到进度条区域时,禁用掉所有非progress_layer上的手势 - recognizer.preventBegin(); - }; - }; - }) - .margin({ left: 5 }) - .trackColor(Color.Red) - .blockColor(Color.Yellow) - .selectedColor(Color.Orange) - .trackThickness(2) - .flexShrink(1) - .flexGrow(1) - } - .flexGrow(1) - .flexShrink(1) - .id('id_progress_view') - } - } - .id('video_layer') - .backgroundColor('#E0E0E0') - .gesture( - GestureGroup(GestureMode.Exclusive, - PanGesture({ direction: PanDirection.Vertical, distance: 10 }) - .tag('pan_for_brightness_control') - .onActionStart((event) => { - this.updateBrightness(true, event); - }) - .onActionUpdate((event) => { - this.updateBrightness(false, event); - }), - PanGesture({ direction: PanDirection.Horizontal, distance: 10 }) - .tag('pan_for_play_progress_control') - .onActionStart((event) => { - this.updateProgress(true, event); - }) - .onActionUpdate((event) => { - this.updateProgress(false, event); - }), - - LongPressGesture() - .tag('long_press_for_fast_forward_control') - .onAction(() => { - this.doFastForward(true); // 开始快进 - }) - .onActionEnd(() => { - this.doFastForward(false); // 停止快进 - }) - .onActionCancel(() => { - this.doFastForward(false); - }), - - TapGesture({ count: 2 }) - .tag('double_tap_on_video') - .onAction(() => { - this.toggleFullScreenState(); - }), - - TapGesture() - .tag('single_tap_on_video') - .onAction(() => { - this.togglePlayAndPause(); - }) - ) - ) - .width(this.currentWidth) - .height(this.currentHeight) - }; -} -// [End gestureRecognition] \ No newline at end of file diff --git a/GestureConflict/entry/src/main/ets/Component/PreventGestureRecognition/PreventIdentification.ets b/GestureConflict/entry/src/main/ets/Component/PreventGestureRecognition/PreventIdentification.ets deleted file mode 100644 index a8bf4ab9f5339654b027902cb9bf13865c076d72..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/Component/PreventGestureRecognition/PreventIdentification.ets +++ /dev/null @@ -1,280 +0,0 @@ -/* - * 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. - */ -@Entry -@ComponentV2 -struct PreventIdentification { - @Local progress: number = 496000; // 初始进度,秒 - @Local total: number = 27490000; // 总时长,秒 - @Local currentWidth: string = '100%'; - @Local currentHeight: string = '100%'; - private currentPosX: number = 0; - private currentPosY: number = 0; - private currentFullScreenState: boolean = true; - private normalPlayTimer: number = -1; - private isPlaying: boolean = true; - private fastForwardTimer: number = -1; - private context = this.getUIContext().getHostContext() - - aboutToAppear(): void { - // 启动一个周期性定时器每隔一秒刷新一次进度 - this.startNormalPlayTimer(); - }; - - startNormalPlayTimer(): void { - if (this.normalPlayTimer != -1) { - this.stopNormalPlayTimer(); - }; - this.normalPlayTimer = setInterval(() => { - this.progress = this.progress + 1000; - }, 1000); - }; - - stopNormalPlayTimer(): void { - if (this.normalPlayTimer == -1) { - return; - }; - clearInterval(this.normalPlayTimer); - this.normalPlayTimer = -1; - }; - - startFastForwardTimer(): void { - if (this.fastForwardTimer != -1) { - this.stopFastForwardTimer(); - }; - this.fastForwardTimer = setInterval(() => { - this.progress = this.progress + 100000; - }, 100); - }; - - stopFastForwardTimer(): void { - if (this.fastForwardTimer == -1) { - return; - }; - clearInterval(this.fastForwardTimer); - this.fastForwardTimer = -1; - }; - - showMessage(message: string): void { - this.getUIContext().getPromptAction().showToast({ message: message, alignment: Alignment.Center }); - }; - - resetPosInfo(): void { - this.currentPosX = 0; - this.currentPosY = 0; - }; - - toggleFullScreenState(): void { - this.currentFullScreenState = !this.currentFullScreenState; - if (this.currentFullScreenState) { - this.currentWidth = '100%'; - this.currentHeight = '100%'; - } else { - this.currentWidth = '100%'; - this.currentHeight = '50%'; - }; - // $r('app.string.Play_full_screen') 需要替换为开发者所需的资源文件 - // $r('app.string.Exit_play_full_screen') 需要替换为开发者所需的资源文件 - this.showMessage(this.currentFullScreenState - ? this.context!.resourceManager.getStringSync($r('app.string.Play_full_screen').id) - : this.context!.resourceManager.getStringSync($r('app.string.Exit_play_full_screen').id)); - }; - - togglePlayAndPause(): void { - this.isPlaying = !this.isPlaying; - if (!this.isPlaying) { - this.stopNormalPlayTimer(); - } else { - // 重新启动 - this.startNormalPlayTimer(); - }; - // $r('app.string.stop_playing') 需要替换为开发者所需的资源文件 - // $r('app.string.Continue_playing') 需要替换为开发者所需的资源文件 - this.showMessage(this.isPlaying - ? this.context!.resourceManager.getStringSync($r('app.string.stop_playing').id) - : this.context!.resourceManager.getStringSync($r('app.string.Continue_playing').id)); - }; - - doFastForward(start: boolean): void { - if (!start) { // 停止快进,恢复正常播放 - this.stopFastForwardTimer(); - this.startNormalPlayTimer(); - // $r('app.string.Cancel_FastForwarding') 需要替换为开发者所需的资源文件 - this.showMessage( - this.context!.resourceManager.getStringSync($r('app.string.Cancel_FastForwarding').id)); - return; - }; - - this.stopNormalPlayTimer(); - this.startFastForwardTimer(); - // $r('app.string.Start_FastForwarding') 需要替换为开发者所需的资源文件 - this.showMessage( - this.context!.resourceManager.getStringSync($r('app.string.Start_FastForwarding').id)); - }; - - updateBrightness(start: boolean, event: BaseGestureEvent): void { - let newY = event.fingerList[0].localY; - if (start) { - this.currentPosY = newY; - // $r('app.string.Start_adjusting_brightness') 需要替换为开发者所需的资源文件 - this.showMessage(this.context!.resourceManager - .getStringSync($r('app.string.Start_adjusting_brightness').id)); - return; - }; - let offsetY = newY - this.currentPosY; - if (Math.abs(offsetY) > 10) { - // $r('app.string.Reduce_brightness') 需要替换为开发者所需的资源文件 - // $r('app.string.Increase_brightness') 需要替换为开发者所需的资源文件 - this.showMessage((offsetY > 0) - ? this.context!.resourceManager.getStringSync($r('app.string.Reduce_brightness').id) - : this.context!.resourceManager.getStringSync($r('app.string.Increase_brightness').id) ) - this.currentPosY = newY; - }; - }; - - updateProgress(start: boolean, event: BaseGestureEvent): void { - let newX = event.fingerList[0].localX; - if (start) { - this.currentPosX = newX; - // $r('app.string.Adjust_schedule') 需要替换为开发者所需的资源文件 - this.showMessage(this.context!.resourceManager - .getStringSync($r('app.string.Adjust_schedule').id)); - return; - }; - let offsetX = newX - this.currentPosX; - this.progress = Math.floor(this.progress + offsetX * 10000); - this.currentPosX = newX; - }; - - build() { - Stack({ alignContent: Alignment.Center }) { - Column() { - Column() { - // $r('app.string.Playback_progress') 需要替换为开发者所需的资源文件 - Text(this.context!.resourceManager.getStringSync($r('app.string.Playback_progress').id) + this.progress) - } - .width('100%').height('90%') - Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Slider({ - value: this.progress, - min: 0, - max: this.total, - style: SliderStyle.OutSet - }) - .onChange((value: number, mode: SliderChangeMode) => { - this.progress = value; - }) - .id('progress_layer') - - - - // [Start DisableGestureType] - .onTouchTestDone((event, recognizers) => { - for (let i = 0; i < recognizers.length; i++) { - let recognizer = recognizers[i]; - // 根据类型禁用所有滑动手势 - if (recognizer.getType() == GestureControl.GestureType.PAN_GESTURE) { - recognizer.preventBegin(); - }; - }; - }) - // [End DisableGestureType] - - // [Start ComponentDisabled] - .onTouchTestDone((event, recognizers) => { - for (let i = 0; i < recognizers.length; i++) { - let recognizer = recognizers[i]; - // 禁用掉标识为myID的组件上的所有手势 - if (recognizer.getEventTargetInfo().getId() == 'myID') { - recognizer.preventBegin(); - }; - }; - }) - // [End ComponentDisabled] - - // [Start BuiltInGestureDisable] - .onTouchTestDone((event, recognizers) => { - for (let i = 0; i < recognizers.length; i++) { - let recognizer = recognizers[i]; - // 禁用掉所有系统内置的手势 - if (recognizer.isBuiltIn()) { - recognizer.preventBegin(); - }; - }; - }) - // [End BuiltInGestureDisable] - - .margin({ left: 5 }) - .trackColor(Color.Red) - .blockColor(Color.Yellow) - .selectedColor(Color.Orange) - .trackThickness(2) - .flexShrink(1) - .flexGrow(1) - } - .flexGrow(1) - .flexShrink(1) - .id('id_progress_view') - } - } - .id('video_layer') - .backgroundColor('#E0E0E0') - .gesture( - GestureGroup(GestureMode.Exclusive, - PanGesture({ direction: PanDirection.Vertical, distance: 10 }) - .tag('pan_for_brightness_control') - .onActionStart((event) => { - this.updateBrightness(true, event); - }) - .onActionUpdate((event) => { - this.updateBrightness(false, event); - }), - PanGesture({ direction: PanDirection.Horizontal, distance: 10 }) - .tag('pan_for_play_progress_control') - .onActionStart((event) => { - this.updateProgress(true, event); - }) - .onActionUpdate((event) => { - this.updateProgress(false, event); - }), - - LongPressGesture() - .tag('long_press_for_fast_forward_control') - .onAction(() => { - this.doFastForward(true); // 开始快进 - }) - .onActionEnd(() => { - this.doFastForward(false); // 停止快进 - }) - .onActionCancel(() => { - this.doFastForward(false); - }), - - TapGesture({ count: 2 }) - .tag('double_tap_on_video') - .onAction(() => { - this.toggleFullScreenState(); - }), - - TapGesture() - .tag('single_tap_on_video') - .onAction(() => { - this.togglePlayAndPause(); - }) - ) - ) - .width(this.currentWidth) - .height(this.currentHeight) - }; -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/ets/entryability/EntryAbility.ets b/GestureConflict/entry/src/main/ets/entryability/EntryAbility.ets deleted file mode 100644 index 98182799de1294d4c21194646a0c30eff08aea33..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/entryability/EntryAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; -import { hilog } from '@kit.PerformanceAnalysisKit'; -import { window } from '@kit.ArkUI'; - -const DOMAIN = 0x0000; - -export default class EntryAbility extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - try { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); - } catch (err) { - hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err)); - } - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); - } - - onDestroy(): void { - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage): void { - // Main window is created, set main page for this ability - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - - windowStage.loadContent('pages/Index', (err) => { - if (err.code) { - hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); - return; - } - hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); - }); - } - - onWindowStageDestroy(): void { - // Main window is destroyed, release UI related resources - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); - } - - onForeground(): void { - // Ability has brought to foreground - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); - } - - onBackground(): void { - // Ability has back to background - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); - } -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/GestureConflict/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets deleted file mode 100644 index 4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 { hilog } from '@kit.PerformanceAnalysisKit'; -import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; - -const DOMAIN = 0x0000; - -export default class EntryBackupAbility extends BackupExtensionAbility { - async onBackup() { - hilog.info(DOMAIN, 'testTag', 'onBackup ok'); - await Promise.resolve(); - } - - async onRestore(bundleVersion: BundleVersion) { - hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); - await Promise.resolve(); - } -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/ets/pages/Index.ets b/GestureConflict/entry/src/main/ets/pages/Index.ets deleted file mode 100644 index 5e6725b02ca4b69506ab94c7867907852309bc01..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/ets/pages/Index.ets +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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 router from '@ohos.router'; - -interface listItem { - router?: string; - name: string; - description?: string; -}; -let demandList: listItem[] = [ - { - name: 'Custom gesture recognition', - description: 'The application can independently decide whether to intercept this gesture, causing the gesture recognition to fail, thereby leaving the chance of successful recognition to other gestures.', - router: 'Component/CustomGestures/CustomGestureDetermination' - }, - { - name: 'Gesture and motion control', - description: 'Gesture and motion control refers to the situation where the gesture has been successfully recognized, but the developer can still control whether the gesture callback can respond by calling the API interface.', - router: 'Component/GestureAndMotionControl/GestureAndMotionControl' - }, - { - name: 'Preventing gesture participation in recognition', - description: 'When the user presses, by controlling the participation status of the gesture recognizer in the response chain, efficient dynamic intervention of gesture processing is achieved.', - router: 'Component/PreventGestureRecognition/PreventGestureRecognition' - } -]; - -@Entry -@Component -struct Index { - @State bgColor: ResourceColor = '#39b5fa'; - - build() { - Column() { - Column() { - List({ space: 20, initialIndex: 0 }) { - ForEach(demandList, (listitem: listItem, index: number) => { - ListItem() { - Column({ space: 10 }) { - Text(listitem.name) - .fontSize(20) - .fontColor(this.bgColor) - .maxLines(1) - - Text(listitem.description) - .width('100%') - } - .margin({ bottom: index >= demandList.length - 1 ? 100 : 0 }) - .padding({ - top: '3%', - right: '10.00%', - bottom: '5%', - left: '10.00%' - }) - .width('100%') - .constraintSize({ minHeight: 100 }) - .borderRadius(10) - .backgroundColor(0xFFFFFF) - .onClick(() => { - if (!!listitem.router) { - this.getUIContext().getRouter().pushUrl({ url: listitem.router }) - }; - }) - } - }) - } - .listDirection(Axis.Vertical) // 排列方向 - .scrollBar(BarState.Off) - .friction(0.6) - .divider({ - strokeWidth: 2, - color: 0xFFFFFF, - startMargin: 20, - endMargin: 20 - }) // 每行之间的分界线 - .edgeEffect(EdgeEffect.Spring) // 边缘效果设置为Spring - .width('90%') - } - .width('100%') - .height('100%') - .backgroundColor('#fff4f3f3') - .padding({ top: 5 }) - } - }; -} diff --git a/GestureConflict/entry/src/main/module.json5 b/GestureConflict/entry/src/main/module.json5 deleted file mode 100644 index 8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/module.json5 +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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" - ], - "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": [ - "ohos.want.action.home" - ] - } - ] - } - ], - "extensionAbilities": [ - { - "name": "EntryBackupAbility", - "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", - "type": "backup", - "exported": false, - "metadata": [ - { - "name": "ohos.extension.backup", - "resource": "$profile:backup_config" - } - ], - } - ] - } -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/resources/base/element/color.json b/GestureConflict/entry/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/resources/base/element/float.json b/GestureConflict/entry/src/main/resources/base/element/float.json deleted file mode 100644 index a0a93dd91fd48f08f3a9532c76e9b26e68d4c034..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/resources/base/element/float.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "float": [ - { - "name": "page_text_font_size", - "value": "50fp" - } - ] -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/resources/base/element/string.json b/GestureConflict/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 05a6cc74adb97a08e01185d752c2776e0ad17bf0..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "EntryAbility_desc", - "value": "description" - }, - { - "name": "EntryAbility_label", - "value": "label" - }, - { - "name": "Drag_instructions", - "value": "包括上下两层组件,上层组件绑定长按手势,下层组件绑定拖拽。其中上层组件下半区域绑定手势拦截,使该区域响应下层拖拽手势。" - }, - { - "name": "Allow_dragging_prompt", - "value": "Drag 下半区蓝色区域,Image响应" - }, - { - "name": "Stop_dragging_prompt", - "value": "LongPressGesture 长按上半区 红色区域,红色区域响应" - }, - { - "name": "Playback_progress", - "value": "播放进度" - }, - { - "name": "Play_full_screen", - "value": "全屏播放" - }, - { - "name": "Exit_play_full_screen", - "value": "取消全屏播放" - }, - { - "name": "stop_playing", - "value": "暂停播放" - }, - { - "name": "Continue_playing", - "value": "继续播放" - }, - { - "name": "Cancel_FastForwarding", - "value": "取消快进" - }, - { - "name": "Start_FastForwarding", - "value": "开始快进" - }, - { - "name": "Start_adjusting_brightness", - "value": "开始调整 亮度" - }, - { - "name": "Reduce_brightness", - "value": "降低亮度" - }, - { - "name": "Increase_brightness", - "value": "提高亮度" - }, - { - "name": "Adjust_schedule", - "value": "开始调整 进度" - } - ] -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/resources/base/media/background.png b/GestureConflict/entry/src/main/resources/base/media/background.png deleted file mode 100644 index 923f2b3f27e915d6871871deea0420eb45ce102f..0000000000000000000000000000000000000000 Binary files a/GestureConflict/entry/src/main/resources/base/media/background.png and /dev/null differ diff --git a/GestureConflict/entry/src/main/resources/base/media/foreground.png b/GestureConflict/entry/src/main/resources/base/media/foreground.png deleted file mode 100644 index 97014d3e10e5ff511409c378cd4255713aecd85f..0000000000000000000000000000000000000000 Binary files a/GestureConflict/entry/src/main/resources/base/media/foreground.png and /dev/null differ diff --git a/GestureConflict/entry/src/main/resources/base/media/layered_image.json b/GestureConflict/entry/src/main/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/resources/base/media/startIcon.png b/GestureConflict/entry/src/main/resources/base/media/startIcon.png deleted file mode 100644 index 205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b..0000000000000000000000000000000000000000 Binary files a/GestureConflict/entry/src/main/resources/base/media/startIcon.png and /dev/null differ diff --git a/GestureConflict/entry/src/main/resources/base/profile/backup_config.json b/GestureConflict/entry/src/main/resources/base/profile/backup_config.json deleted file mode 100644 index 78f40ae7c494d71e2482278f359ec790ca73471a..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/resources/base/profile/backup_config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "allowToBackupRestore": true -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/resources/base/profile/main_pages.json b/GestureConflict/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 5b2ca389b9aa67dc4230e85a5bf2bac574411662..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "src": [ - "pages/Index", - "Component/CustomGestures/CustomGestureDetermination", - "Component/GestureAndMotionControl/GestureAndMotionControl", - "Component/PreventGestureRecognition/PreventGestureRecognition", - "Component/CustomGestures/CustomGestures", - "Component/GestureAndMotionControl/GestureControl", - "Component/PreventGestureRecognition/PreventIdentification" - ] -} \ No newline at end of file diff --git a/GestureConflict/entry/src/main/resources/dark/element/color.json b/GestureConflict/entry/src/main/resources/dark/element/color.json deleted file mode 100644 index 79b11c2747aec33e710fd3a7b2b3c94dd9965499..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/main/resources/dark/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#000000" - } - ] -} \ No newline at end of file diff --git a/GestureConflict/entry/src/mock/mock-config.json5 b/GestureConflict/entry/src/mock/mock-config.json5 deleted file mode 100644 index 323d1d611fecf4ecb751976e3a71500b3712a445..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/mock/mock-config.json5 +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ -{ -} \ No newline at end of file diff --git a/GestureConflict/entry/src/ohosTest/ets/test/Ability.test.ets b/GestureConflict/entry/src/ohosTest/ets/test/Ability.test.ets deleted file mode 100644 index 7f30942b81554a399e89aa253c7089eca4f8d8d1..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/ohosTest/ets/test/Ability.test.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 { hilog } from '@kit.PerformanceAnalysisKit'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; - -export default function abilityTest() { - describe('ActsAbilityTest', () => { - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(() => { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - }) - beforeEach(() => { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - }) - afterEach(() => { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - }) - afterAll(() => { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - }) - it('assertContain', 0, () => { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); - let a = 'abc'; - let b = 'b'; - // Defines a variety of assertion methods, which are used to declare expected boolean conditions. - expect(a).assertContain(b); - expect(a).assertEqual(a); - }) - }) -} \ No newline at end of file diff --git a/GestureConflict/entry/src/ohosTest/ets/test/Index.test.ets b/GestureConflict/entry/src/ohosTest/ets/test/Index.test.ets deleted file mode 100644 index 7213b146f7b5384bd42143fc049dbe44d602f8be..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/ohosTest/ets/test/Index.test.ets +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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 { describe, it, expect, beforeAll } from '@ohos/hypium'; -import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit'; -import { UIAbility, Want } from '@kit.AbilityKit'; -import hilog from '@ohos.hilog'; - -// HiLog通常需要domain, tag等参数 -const DOMAIN = 0x0001; -const TAG = 'MyApp'; - -const delegator = abilityDelegatorRegistry.getAbilityDelegator(); -const bundleName = abilityDelegatorRegistry.getArguments().bundleName; -let driver: Driver; -let want: Want; - -export default function GestureConflict() { - describe('GestureConflict', () => { - beforeAll(async () => { - // 启动应用 - want = { - bundleName: bundleName, - abilityName: 'EntryAbility' - }; - await delegator.startAbility(want); - driver = Driver.create(); - await driver.delayMs(2000); // 增加初始等待时间 - - // 验证当前页面是否正确 - const ability: UIAbility = await delegator.getCurrentTopAbility(); - hilog.info(DOMAIN, TAG,'get top ability'); - expect(ability.context.abilityInfo.name).assertEqual('EntryAbility'); - }); - - /** - * @tc.number GestureConflict_001 - * @tc.name testHomePageLoad - * @tc.desc 测试首页加载是否成功 - */ - it('testHomePageLoad', 0, async (done: Function) => { - hilog.info(DOMAIN, TAG,'GestureConflict: testHomePageLoad begin'); - - // 验证列表项存在 - 使用首页中实际存在的文本 - const listItem = await driver.findComponent(ON.text('Custom gesture recognition')); - hilog.info(DOMAIN, TAG,`GestureConflict: list item found: ${listItem !== null}`); - expect(listItem === null).assertFalse(); - - // 验证列表存在 - const list = await driver.findComponent(ON.type('List')); - hilog.info(DOMAIN, TAG,`GestureConflict: list found: ${list !== null}`); - expect(list === null).assertFalse(); - - hilog.info(DOMAIN, TAG,'GestureConflict: testHomePageLoad end'); - done(); - }); - - /** - * @tc.number GestureConflict_002 - * @tc.name testNavigationToDetailPage - * @tc.desc 测试页面 长按拖动 - */ - it('testNavigationToDetailPage', 0, async (done: Function) => { - // 查找并点击第一个列表项 - const targetItem = await driver.findComponent(ON.text('Custom gesture recognition')); - if (targetItem !== null) { - await targetItem.click(); - // 等待目标页面加载 - await driver.delayMs(2000); - // 返回首页 - await driver.pressBack(); - await driver.delayMs(1000); - } - done(); - }); - - /** - * @tc.number GestureConflict_003 - * @tc.name GestureAndMotionControl - * @tc.desc 滑动页面. - */ - it('GestureAndMotionControl', 0, async (done: Function) => { - // 查找并点击第一个列表项 - const targetItem = await driver.findComponent(ON.text('Gesture and motion control')); - if (targetItem !== null) { - await targetItem.click(); - // 等待目标页面加载 - await driver.delayMs(10000); - - // 使用 swipe 方法向下滑动 - await driver.swipe(500, 1000, 500, 200, 100); - - // 返回首页 - await driver.pressBack(); - await driver.delayMs(1000); - } - done(); - }); - - /** - * @tc.number GestureConflict_004 - * @tc.name PreventGestureRecognition - * @tc.desc 长按页面,加速进度. - */ - it('PreventGestureRecognition', 0, async (done: Function) => { - try { - const targetItem = await driver.findComponent(ON.text('Preventing gesture participation in recognition')); - if (targetItem !== null) { - await targetItem.click(); - await driver.delayMs(3000); - const centerX = 500; - const centerY = 800; - await driver.swipe(centerX, centerY, centerX + 10, centerY + 10, 3000); - await driver.delayMs(3000); - await driver.pressBack(); - await driver.delayMs(1000); - } - done(); - } catch (error) { - hilog.error(DOMAIN, TAG,'error:', error); - done(error); - } - }); - }); -} \ No newline at end of file diff --git a/GestureConflict/entry/src/ohosTest/ets/test/List.test.ets b/GestureConflict/entry/src/ohosTest/ets/test/List.test.ets deleted file mode 100644 index d5155f901adda0baec09cfff28c20e531db6e67f..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/ohosTest/ets/test/List.test.ets +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 abilityTest from './Ability.test'; -import index from './Index.test'; - - -export default function testsuite() { - abilityTest(); - index() -} \ No newline at end of file diff --git a/GestureConflict/entry/src/ohosTest/module.json5 b/GestureConflict/entry/src/ohosTest/module.json5 deleted file mode 100644 index 1cafc28b86d7d9f2b34f24d26a75c0dbd7299715..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/ohosTest/module.json5 +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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_test", - "type": "feature", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false - } -} diff --git a/GestureConflict/entry/src/test/List.test.ets b/GestureConflict/entry/src/test/List.test.ets deleted file mode 100644 index a60c87c5cbb0badf7c3fd8975034590e6fafa992..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 localUnitTest from './LocalUnit.test'; - -export default function testsuite() { - localUnitTest(); -} \ No newline at end of file diff --git a/GestureConflict/entry/src/test/LocalUnit.test.ets b/GestureConflict/entry/src/test/LocalUnit.test.ets deleted file mode 100644 index 841bfd77e56060e50ec0924302a5ae624e76e3aa..0000000000000000000000000000000000000000 --- a/GestureConflict/entry/src/test/LocalUnit.test.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; - -export default function localUnitTest() { - describe('localUnitTest', () => { - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(() => { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - }); - beforeEach(() => { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - }); - afterEach(() => { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - }); - afterAll(() => { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - }); - it('assertContain', 0, () => { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let a = 'abc'; - let b = 'b'; - // Defines a variety of assertion methods, which are used to declare expected boolean conditions. - expect(a).assertContain(b); - expect(a).assertEqual(a); - }); - }); -} \ No newline at end of file diff --git a/GestureConflict/hvigor/hvigor-config.json5 b/GestureConflict/hvigor/hvigor-config.json5 deleted file mode 100644 index 3b057578a1bb4d591ee53054e39ab0154fc2e43a..0000000000000000000000000000000000000000 --- a/GestureConflict/hvigor/hvigor-config.json5 +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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": "6.0.0", - "dependencies": { - }, - "execution": { - // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | 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 */ - // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */ - }, - "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/GestureConflict/hvigorfile.ts b/GestureConflict/hvigorfile.ts deleted file mode 100644 index ae9086af35844176c08f1be3772d081d95d267c6..0000000000000000000000000000000000000000 --- a/GestureConflict/hvigorfile.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. */ -} \ No newline at end of file diff --git a/GestureConflict/oh-package.json5 b/GestureConflict/oh-package.json5 deleted file mode 100644 index 837c0ff9f35a6bb9eea849fead7955c19bcdec8d..0000000000000000000000000000000000000000 --- a/GestureConflict/oh-package.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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": "6.0.0", - "description": "Please describe the basic information.", - "dependencies": { - }, - "devDependencies": { - "@ohos/hypium": "1.0.24", - "@ohos/hamock": "1.0.0" - } -} diff --git a/GestureConflict/ohosTest.md b/GestureConflict/ohosTest.md deleted file mode 100644 index 618aae89f609eae8054c601492e9112f15f05c8d..0000000000000000000000000000000000000000 --- a/GestureConflict/ohosTest.md +++ /dev/null @@ -1,6 +0,0 @@ -| 测试功能 | 预置条件 | 输入 | 预期输出 | 测试结果 | -|----------| ------------ |---------------------------------|-------------------| -------- | -| 首页加载测试 | 设备正常运行 | 验证基础元素渲染 | 检查标题和列表组件 | Pass | -| 自定义手势判定 | 设备正常运行 | 点击'Custom gesture recognition' | 跳转成功且页面存在Image组件 | Pass | -| 手势并行动态控制 | 设备正常运行 | 点击'Gesture and motion control' | 跳转成功且包含嵌套滚动组件 | Pass | -| 阻止手势参与识别 | 设备正常运行 | 点击'Prevent Gesture Recognition' | 跳转成功且根据手势决定数字增加速度 | Pass | \ No newline at end of file diff --git a/GestureConflict/screenshots/GestureRecognition.png b/GestureConflict/screenshots/GestureRecognition.png deleted file mode 100644 index a0956d878dbe36f33be9b08ebcc71cdcefadbc4a..0000000000000000000000000000000000000000 Binary files a/GestureConflict/screenshots/GestureRecognition.png and /dev/null differ diff --git a/GestureConflict/screenshots/Home.jpg b/GestureConflict/screenshots/Home.jpg deleted file mode 100644 index fe8d0975bcdb09372aedae8ba288164fd0cbf412..0000000000000000000000000000000000000000 Binary files a/GestureConflict/screenshots/Home.jpg and /dev/null differ diff --git a/GestureConflict/screenshots/Stop.jpg b/GestureConflict/screenshots/Stop.jpg deleted file mode 100644 index ba56fe7d23a05f9a0f8ae9c0152c1b30bde58f46..0000000000000000000000000000000000000000 Binary files a/GestureConflict/screenshots/Stop.jpg and /dev/null differ diff --git a/GestureConflict/screenshots/kineticControl.jpg b/GestureConflict/screenshots/kineticControl.jpg deleted file mode 100644 index 73e15599235b4d3cb98cefc2f9c39f207ed5fdd2..0000000000000000000000000000000000000000 Binary files a/GestureConflict/screenshots/kineticControl.jpg and /dev/null differ diff --git a/GestureConflict/screenshots/userDefined.jpg b/GestureConflict/screenshots/userDefined.jpg deleted file mode 100644 index dfafefe386449a7e3ee1cf6c776809215ef8d086..0000000000000000000000000000000000000000 Binary files a/GestureConflict/screenshots/userDefined.jpg and /dev/null differ diff --git a/GestureGroup/AppScope/app.json5 b/GestureGroup/AppScope/app.json5 deleted file mode 100644 index 84097e0051993ba421d92f270f34efb07b9192df..0000000000000000000000000000000000000000 --- a/GestureGroup/AppScope/app.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.gesturegroup", - "vendor": "samples", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:layered_image", - "label": "$string:app_name" - } -} diff --git a/GestureGroup/AppScope/resources/base/element/string.json b/GestureGroup/AppScope/resources/base/element/string.json deleted file mode 100644 index d4277523131a196d946fac1c0acf79845b0bd4c8..0000000000000000000000000000000000000000 --- a/GestureGroup/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "GestureGroup" - } - ] -} diff --git a/GestureGroup/AppScope/resources/base/media/background.png b/GestureGroup/AppScope/resources/base/media/background.png deleted file mode 100644 index 923f2b3f27e915d6871871deea0420eb45ce102f..0000000000000000000000000000000000000000 Binary files a/GestureGroup/AppScope/resources/base/media/background.png and /dev/null differ diff --git a/GestureGroup/AppScope/resources/base/media/foreground.png b/GestureGroup/AppScope/resources/base/media/foreground.png deleted file mode 100644 index eb9427585b36d14b12477435b6419d1f07b3e0bb..0000000000000000000000000000000000000000 Binary files a/GestureGroup/AppScope/resources/base/media/foreground.png and /dev/null differ diff --git a/GestureGroup/AppScope/resources/base/media/layered_image.json b/GestureGroup/AppScope/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/GestureGroup/AppScope/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/GestureGroup/README_zh.md b/GestureGroup/README_zh.md deleted file mode 100644 index c7f7430ed3d5fad427ef5ec17566b2db7a52ae3a..0000000000000000000000000000000000000000 --- a/GestureGroup/README_zh.md +++ /dev/null @@ -1,81 +0,0 @@ -# 组合手势 - -## 介绍 - -本示例为[组合手势](https://gitcode.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/arkts-gesture-events-combined-gestures.md)的配套示例工程。 - -本示例展示了适配组合手势的组件及触发方式。 - -## 效果预览 - -| 首页 | 顺序识别 | -|-------------------------------|--------------------------------| -| ![](screenshots/Home.jpg) | ![](screenshots/Sequence.gif) | -| 并行识别 | 互斥识别 | -| ![](screenshots/Parallel.gif) | ![](screenshots/Exclusive.gif) | - - -### 具体实现 - -1. **GestureGroup 基础搭建**:通过GestureGroup(模式)创建容器,包裹多个手势实例,再用组件.gesture()绑定,实现多手势统一管理。 -2. **三种组合模式实现**: - 并行(Parallel):包裹无冲突手势(如捏合 + 旋转),可同时触发,各自回调独立执行(如捏合改缩放比例、旋转改角度)。 - 顺序(Serial):包裹有依赖的手势(如长按 + 滑动),需先触发前一个(长按满足 duration),再触发后一个(滑动),前一个未触发则后一个无效。 - 互斥(Exclusive):包裹互斥手势(如点击 + 长按),系统优先识别高优先级手势,未识别则尝试下一个(如长按优先级高,先判断长按,不满足再判断点击)。 -3. **优先级与冲突控制**: - 手势优先级:给手势设priority(默认 0,值越大优先级越高),如LongPressGesture({priority:1})比TapGesture({priority:0})优先被识别。 - 父子组件冲突:父组件用gestureMask控制透传(如GestureMask.IgnoreInternal,父手势不响应子组件区域操作)。 - - -### 使用说明 - -1. **模式选择按场景匹配**: - 需同时触发(如缩放 + 旋转)→ 用 Parallel; - 需先后触发(如长按后拖动)→ 用 Serial; - 二选一触发(如点击 / 长按)→ 用 Exclusive,避免模式错用导致手势失效。 -2. **优先级配置规则**: - priority数值无上限,建议按业务设 1-3 级(避免过度叠加); - 同一 GestureGroup 内,优先级高的手势先被判断,优先触发。 -3. **使用约束**: - 禁止在 Serial 模式下包裹无依赖的手势(如点击 + 滑动),会导致后一个手势无法触发; - 组件需设enabled:true(禁用状态下手势不响应)。 - -## 工程目录 - -``` -entry/src/main/ets/ -└── pages - └── Index.ets (获取文本界面) - └── Exclusive.ets // 互斥识别页面 - └── Parallel.ets // 并行识别页面 - └── SceneExample.ets // 场景示例页面 - └── Sequence.ets // 顺序识别页面 -``` - -## 相关权限 - -不涉及 - -## 依赖 - -不涉及 - -## 约束和限制 - -### 约束与限制 -1.本示例仅支持标准系统上运行, 支持设备:RK3568。 - -2.本示例为Stage模型,支持API20版本SDK,版本号:6.0.0.47,镜像版本号:OpenHarmony_6.0.0.47。 - -3.本示例需要使用DevEco Studio NEXT Developer Preview2 (Build Version: 6.0.0.47, built on October 21, 2025)及以上版本才可编译运行。 - -## 下载 - -如需单独下载本工程,执行如下命令: -``` -git init -git config core.sparsecheckout true -echo code/DocsSample/ArkUISample/GestureGroup > .git/info/sparse-checkout -git remote add origin https://gitcode.com/openharmony/applications_app_samples.git -git pull origin master -``` diff --git a/GestureGroup/build-profile.json5 b/GestureGroup/build-profile.json5 deleted file mode 100644 index 3ca5a93fb814017ac4c398aacbdf17b1d8b0a237..0000000000000000000000000000000000000000 --- a/GestureGroup/build-profile.json5 +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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", - "compileSdkVersion": "6.0.0(20)", - "compatibleSdkVersion": "6.0.0(20)", - "targetSdkVersion": "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/GestureGroup/code-linter.json5 b/GestureGroup/code-linter.json5 deleted file mode 100644 index 5c4682f8164874ec7e9cb8f99ff8b3228ffbc126..0000000000000000000000000000000000000000 --- a/GestureGroup/code-linter.json5 +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/GestureGroup/entry/build-profile.json5 b/GestureGroup/entry/build-profile.json5 deleted file mode 100644 index 9016faf39f8a65cf648bae246a53575510fe8b9f..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/build-profile.json5 +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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": { - "resOptions": { - "copyCodeResource": { - "enable": false - } - } - }, - "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/GestureGroup/entry/hvigorfile.ts b/GestureGroup/entry/hvigorfile.ts deleted file mode 100644 index f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/hvigorfile.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. */ -} \ No newline at end of file diff --git a/GestureGroup/entry/obfuscation-rules.txt b/GestureGroup/entry/obfuscation-rules.txt deleted file mode 100644 index 272efb6ca3f240859091bbbfc7c5802d52793b0b..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/obfuscation-rules.txt +++ /dev/null @@ -1,23 +0,0 @@ -# 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/GestureGroup/entry/oh-package.json5 b/GestureGroup/entry/oh-package.json5 deleted file mode 100644 index 10cda399b0aec3099b257299a57d284393e4e55a..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/oh-package.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/GestureGroup/entry/src/main/ets/entryability/EntryAbility.ets b/GestureGroup/entry/src/main/ets/entryability/EntryAbility.ets deleted file mode 100644 index 98182799de1294d4c21194646a0c30eff08aea33..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/ets/entryability/EntryAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; -import { hilog } from '@kit.PerformanceAnalysisKit'; -import { window } from '@kit.ArkUI'; - -const DOMAIN = 0x0000; - -export default class EntryAbility extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - try { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); - } catch (err) { - hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err)); - } - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); - } - - onDestroy(): void { - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage): void { - // Main window is created, set main page for this ability - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - - windowStage.loadContent('pages/Index', (err) => { - if (err.code) { - hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); - return; - } - hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); - }); - } - - onWindowStageDestroy(): void { - // Main window is destroyed, release UI related resources - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); - } - - onForeground(): void { - // Ability has brought to foreground - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); - } - - onBackground(): void { - // Ability has back to background - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); - } -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/GestureGroup/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets deleted file mode 100644 index 4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 { hilog } from '@kit.PerformanceAnalysisKit'; -import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; - -const DOMAIN = 0x0000; - -export default class EntryBackupAbility extends BackupExtensionAbility { - async onBackup() { - hilog.info(DOMAIN, 'testTag', 'onBackup ok'); - await Promise.resolve(); - } - - async onRestore(bundleVersion: BundleVersion) { - hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); - await Promise.resolve(); - } -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/ets/pages/Exclusive.ets b/GestureGroup/entry/src/main/ets/pages/Exclusive.ets deleted file mode 100644 index 572cbf3112207be85feddd35d416f62975c204a8..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/ets/pages/Exclusive.ets +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - */ - -// [Start Mutual_exclusion] -// xxx.ets -@Entry -@Component -struct MutualExclusion { - @State count1: number = 0; - @State count2: number = 0; - - build() { - Column() { - Text('Exclusive gesture\n' + 'tapGesture count is 1:' + this.count1 + '\ntapGesture count is 2:' + this.count2 + '\n') - .fontSize(28); - } - .height(200) - .width('100%') - //以下组合手势为互斥识别,单击手势识别成功后,双击手势会识别失败 - .gesture( - GestureGroup(GestureMode.Exclusive, - TapGesture({ count: 1 }) - .onAction(() => { - this.count1++; - }), - TapGesture({ count: 2 }) - .onAction(() => { - this.count2++; - }) - ) - ); - }; -} -// [End Mutual_exclusion] \ No newline at end of file diff --git a/GestureGroup/entry/src/main/ets/pages/Index.ets b/GestureGroup/entry/src/main/ets/pages/Index.ets deleted file mode 100644 index 88e6f60549df3daa27ba710487e7e2bb8be5c310..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/ets/pages/Index.ets +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -interface listItem { - router?: string; - name: string; - description?: string; -}; -let demandList: listItem[] = [ - { - name: 'sequence Identification', - description: 'The GestureMode corresponding to the sequential recognition of combined gestures is Sequence. The sequential recognition of combined gestures will identify gestures in the order they are registered until all gestures are successfully recognized.', - router: 'pages/Sequence' - }, - { - name: 'parallel recognition', - description: 'The GestureMode corresponding to the parallel recognition of the combined gestures is Parallel. In the parallel recognition of the combined gestures, the registered gestures will be recognized simultaneously until all gestures have been recognized.', - router: 'pages/Parallel' - }, - { - name: 'Mutual exclusion identification', - description: 'The GestureMode corresponding to the mutually exclusive recognition gesture combination is Exclusive. The registered gestures in the mutually exclusive recognition gesture combination will be recognized simultaneously.', - router: 'pages/Exclusive' - }, - { - name: 'Scene Example', - description: 'The following example implements the binding of long press and swipe gestures for the sub-component. The long press gesture and swipe gesture need to be triggered simultaneously. However, if the long press gesture fails, the built-in swipe gesture triggering function of the parent component Swiper needs to be activated.', - router: 'pages/SceneExample' - } -]; - -@Entry -@Component -struct Index { - @State bgColor: ResourceColor = '#39b5fa'; - - build() { - Column() { - Column() { - List({ space: 20, initialIndex: 0 }) { - ForEach(demandList, (listitem: listItem, index: number) => { - ListItem() { - Column({ space: 10 }) { - Text(listitem.name) - .fontSize(20) - .fontColor(this.bgColor) - .maxLines(1); - - Text(listitem.description) - .width('100%'); - } - .margin({ bottom: index >= demandList.length - 1 ? 100 : 0 }) - .padding({ - top: '3%', - right: '10.00%', - bottom: '5%', - left: '10.00%' - }) - .width('100%') - .constraintSize({ minHeight: 100 }) - .borderRadius(10) - .backgroundColor(0xFFFFFF) - .onClick(() => { - if (!!listitem.router) { - this.getUIContext().getRouter().pushUrl({ url: listitem.router }) - }; - }); - }; - }); - } - .listDirection(Axis.Vertical) // 排列方向 - .scrollBar(BarState.Off) - .friction(0.6) - .divider({ - strokeWidth: 2, - color: 0xFFFFFF, - startMargin: 20, - endMargin: 20 - }) // 每行之间的分界线 - .edgeEffect(EdgeEffect.Spring) // 边缘效果设置为Spring - .width('90%'); - } - .width('100%') - .height('100%') - .backgroundColor('#fff4f3f3') - .padding({ top: 5 }); - }; - }; -} diff --git a/GestureGroup/entry/src/main/ets/pages/Parallel.ets b/GestureGroup/entry/src/main/ets/pages/Parallel.ets deleted file mode 100644 index b434e70cb9575280b3c1d623c93deacdd1e4e308..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/ets/pages/Parallel.ets +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - */ - -// [Start parallel_recognition] -// xxx.ets -@Entry -@Component -struct parallelRecognition { - @State count1: number = 0; - @State count2: number = 0; - - build() { - Column() { - Text('Parallel gesture\n' + 'tapGesture count is 1:' + this.count1 + '\ntapGesture count is 2:' + this.count2 + '\n') - .fontSize(28); - } - .height(200) - .width('100%') - // 以下组合手势为并行识别,单击手势识别成功后,若在规定时间内再次点击,双击手势也会识别成功 - .gesture( - GestureGroup(GestureMode.Parallel, - TapGesture({ count: 1 }) - .onAction(() => { - this.count1++; - }), - TapGesture({ count: 2 }) - .onAction(() => { - this.count2++; - }) - ) - ); - }; -} -// [End parallel_recognition] \ No newline at end of file diff --git a/GestureGroup/entry/src/main/ets/pages/SceneExample.ets b/GestureGroup/entry/src/main/ets/pages/SceneExample.ets deleted file mode 100644 index 537812f58101df04d2939702dafd2843b51b27b5..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/ets/pages/SceneExample.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -// [Start Scene_example] -// xxx.ets -import { PromptAction } from '@kit.ArkUI'; - -@Entry -@Component -struct CombinedGestureDemo { - @State isLongPress: boolean = false; - promptAction: PromptAction = this.getUIContext().getPromptAction(); - - build() { - Swiper() { - // 页面1 - Row() - .width('100%') - .height('100%') - .backgroundColor(Color.Grey) - .borderRadius(12) - // 通过自定义手势判定回调,判断在长按手势未成功时,拒绝子组件的滑动手势,从而让父组件Swiper的滑动手势成功 - .onGestureRecognizerJudgeBegin( - (event: BaseGestureEvent, current: GestureRecognizer, others: Array)=>{ - if (current.getType() !== GestureControl.GestureType.PAN_GESTURE) { - return GestureJudgeResult.CONTINUE; - }; - if (this.isLongPress) { - return GestureJudgeResult.CONTINUE; - }; - return GestureJudgeResult.REJECT; - }) - .gesture( - // 绑定并行手势组,实现长按手势和滑动手势可以同时触发 - GestureGroup(GestureMode.Parallel, - LongPressGesture() - .onAction(() => { - this.isLongPress = true; - this.promptAction.showToast({ message: 'LongPress trigger' }); - }) - .onActionEnd(() => { - this.isLongPress = false; - }) - , - PanGesture() - .onActionStart(() => { - this.promptAction.showToast({ message: 'child pan start' }); - }) - ) - ); - // 页面2 - Row() - .width('100%') - .height('100%') - .backgroundColor(Color.Pink) - .borderRadius(12); - } - .borderWidth(2) - .width('100%') - .height(300) - .padding(20); - }; -} -// [End Scene_example] \ No newline at end of file diff --git a/GestureGroup/entry/src/main/ets/pages/Sequence.ets b/GestureGroup/entry/src/main/ets/pages/Sequence.ets deleted file mode 100644 index 922b5d9794d884a2fb0400d1c38522df450c07b9..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/ets/pages/Sequence.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -// [Start sequence_identification] -// xxx.ets -@Entry -@Component -struct sequenceIdentification { - @State offsetX: number = 0; - @State offsetY: number = 0; - @State count: number = 0; - @State positionX: number = 0; - @State positionY: number = 0; - @State borderStyles: BorderStyle = BorderStyle.Solid; - - build() { - Column() { - Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) - .fontSize(28) - }.margin(10) - .borderWidth(1) - // 绑定translate属性可以实现组件的位置移动 - .translate({ x: this.offsetX, y: this.offsetY, z: 0 }) - .height(250) - .width(300) - //以下组合手势为顺序识别,当长按手势事件未正常触发时不会触发滑动手势事件 - .gesture( - // 声明该组合手势的类型为Sequence类型 - GestureGroup(GestureMode.Sequence, - // 该组合手势第一个触发的手势为长按手势,且长按手势可多次响应 - LongPressGesture({ repeat: true }) - // 当长按手势识别成功,增加Text组件上显示的count次数 - .onAction((event: GestureEvent|undefined) => { - if(event){ - if (event.repeat) { - this.count++; - }; - }; - console.info('LongPress onAction'); - }) - .onActionEnd(() => { - console.info('LongPress end'); - }), - // 当长按之后进行拖动,PanGesture手势被触发 - PanGesture() - .onActionStart(() => { - this.borderStyles = BorderStyle.Dashed; - console.info('pan start'); - }) - // 当该手势被触发时,根据回调获得拖动的距离,修改该组件的位移距离从而实现组件的移动 - .onActionUpdate((event: GestureEvent|undefined) => { - if(event){ - this.offsetX = (this.positionX + event.offsetX); - this.offsetY = this.positionY + event.offsetY; - }; - console.info('pan update'); - }) - .onActionEnd(() => { - this.positionX = this.offsetX; - this.positionY = this.offsetY; - this.borderStyles = BorderStyle.Solid; - }) - ) - .onCancel(() => { - console.info('sequence gesture canceled'); - }) - ); - }; -} -// [End sequence_identification] \ No newline at end of file diff --git a/GestureGroup/entry/src/main/module.json5 b/GestureGroup/entry/src/main/module.json5 deleted file mode 100644 index 8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/module.json5 +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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" - ], - "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": [ - "ohos.want.action.home" - ] - } - ] - } - ], - "extensionAbilities": [ - { - "name": "EntryBackupAbility", - "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", - "type": "backup", - "exported": false, - "metadata": [ - { - "name": "ohos.extension.backup", - "resource": "$profile:backup_config" - } - ], - } - ] - } -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/resources/base/element/color.json b/GestureGroup/entry/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/resources/base/element/float.json b/GestureGroup/entry/src/main/resources/base/element/float.json deleted file mode 100644 index a0a93dd91fd48f08f3a9532c76e9b26e68d4c034..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/resources/base/element/float.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "float": [ - { - "name": "page_text_font_size", - "value": "50fp" - } - ] -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/resources/base/element/string.json b/GestureGroup/entry/src/main/resources/base/element/string.json deleted file mode 100644 index f94595515a99e0c828807e243494f57f09251930..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "EntryAbility_desc", - "value": "description" - }, - { - "name": "EntryAbility_label", - "value": "label" - } - ] -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/resources/base/media/background.png b/GestureGroup/entry/src/main/resources/base/media/background.png deleted file mode 100644 index 923f2b3f27e915d6871871deea0420eb45ce102f..0000000000000000000000000000000000000000 Binary files a/GestureGroup/entry/src/main/resources/base/media/background.png and /dev/null differ diff --git a/GestureGroup/entry/src/main/resources/base/media/foreground.png b/GestureGroup/entry/src/main/resources/base/media/foreground.png deleted file mode 100644 index 97014d3e10e5ff511409c378cd4255713aecd85f..0000000000000000000000000000000000000000 Binary files a/GestureGroup/entry/src/main/resources/base/media/foreground.png and /dev/null differ diff --git a/GestureGroup/entry/src/main/resources/base/media/layered_image.json b/GestureGroup/entry/src/main/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/resources/base/media/startIcon.png b/GestureGroup/entry/src/main/resources/base/media/startIcon.png deleted file mode 100644 index 205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b..0000000000000000000000000000000000000000 Binary files a/GestureGroup/entry/src/main/resources/base/media/startIcon.png and /dev/null differ diff --git a/GestureGroup/entry/src/main/resources/base/profile/backup_config.json b/GestureGroup/entry/src/main/resources/base/profile/backup_config.json deleted file mode 100644 index 78f40ae7c494d71e2482278f359ec790ca73471a..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/resources/base/profile/backup_config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "allowToBackupRestore": true -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/resources/base/profile/main_pages.json b/GestureGroup/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 75353de76761f7d30686c21219b1f274eea094f3..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "src": [ - "pages/Index", - "pages/Parallel", - "pages/Sequence", - "pages/Exclusive", - "pages/SceneExample" - ] -} \ No newline at end of file diff --git a/GestureGroup/entry/src/main/resources/dark/element/color.json b/GestureGroup/entry/src/main/resources/dark/element/color.json deleted file mode 100644 index 79b11c2747aec33e710fd3a7b2b3c94dd9965499..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/main/resources/dark/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#000000" - } - ] -} \ No newline at end of file diff --git a/GestureGroup/entry/src/mock/mock-config.json5 b/GestureGroup/entry/src/mock/mock-config.json5 deleted file mode 100644 index 323d1d611fecf4ecb751976e3a71500b3712a445..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/mock/mock-config.json5 +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ -{ -} \ No newline at end of file diff --git a/GestureGroup/entry/src/ohosTest/ets/test/Ability.test.ets b/GestureGroup/entry/src/ohosTest/ets/test/Ability.test.ets deleted file mode 100644 index 7f30942b81554a399e89aa253c7089eca4f8d8d1..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/ohosTest/ets/test/Ability.test.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 { hilog } from '@kit.PerformanceAnalysisKit'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; - -export default function abilityTest() { - describe('ActsAbilityTest', () => { - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(() => { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - }) - beforeEach(() => { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - }) - afterEach(() => { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - }) - afterAll(() => { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - }) - it('assertContain', 0, () => { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); - let a = 'abc'; - let b = 'b'; - // Defines a variety of assertion methods, which are used to declare expected boolean conditions. - expect(a).assertContain(b); - expect(a).assertEqual(a); - }) - }) -} \ No newline at end of file diff --git a/GestureGroup/entry/src/ohosTest/ets/test/Index.test.ets b/GestureGroup/entry/src/ohosTest/ets/test/Index.test.ets deleted file mode 100644 index 2cda4830fe9f4f6254e6bdbd025dfae42d872cb0..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/ohosTest/ets/test/Index.test.ets +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 { describe, it, expect, beforeAll } from '@ohos/hypium'; -import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit'; -import { UIAbility, Want } from '@kit.AbilityKit'; -import { hilog } from '@kit.PerformanceAnalysisKit'; -const DOMAIN = 0x0001; -const TAG = 'MyApp'; -const delegator = abilityDelegatorRegistry.getAbilityDelegator(); -const bundleName = abilityDelegatorRegistry.getArguments().bundleName; -let driver: Driver; -let want: Want; - -// 定义要测试的页面列表 -const testPages = [ - 'sequence Identification', - 'parallel recognition', - 'Mutual exclusion identification', - 'Scene Example' -]; - -export default function GestureGroup() { - describe('GestureGroup', () => { - beforeAll(async () => { - // 启动应用 - want = { - bundleName: bundleName, - abilityName: 'EntryAbility' - }; - await delegator.startAbility(want); - driver = Driver.create(); - await driver.delayMs(1000); - // 验证当前页面是否正确 - const ability: UIAbility = await delegator.getCurrentTopAbility(); - hilog.info(DOMAIN, TAG, 'get top ability'); - expect(ability.context.abilityInfo.name).assertEqual('EntryAbility'); - }); - - /** - * @tc.number GestureGroup_001 - * @tc.name sequence Identification - * @tc.desc 测试首页加载是否成功 - */ - it('sequence Identification', 0, async (done: Function) => { - hilog.info(DOMAIN, TAG, 'GestureGroupTest: sequence Identification begin'); - // 验证列表存在 - const list = await driver.findComponent(ON.type('List')); - expect(list === null).assertFalse(); - - // 验证至少一个列表项存在 - const firstItem = await driver.findComponent(ON.text('sequence Identification')); - expect(firstItem === null).assertFalse(); - - hilog.info(DOMAIN, TAG, 'GestureGroupTest: sequence Identification end'); - done(); - }); - - /** - * @tc.number GestureGroup_002 - * @tc.name testAllGestureGroupPages - * @tc.desc 测试所有GestureGroup页面,按顺序点击进入四个页面,每个页面停留3秒 - */ - it('testAllGestureGroupPages', 0, async (done: Function) => { - hilog.info(DOMAIN, TAG, 'GestureGroupTest: testAllGestureGroupPages begin'); - - for (let i = 0; i < testPages.length; i++) { - const pageName = testPages[i]; - hilog.info(DOMAIN, TAG, `GestureGroupTest: Testing page ${i + 1}: ${pageName}`); - - // 查找并点击页面项 - const targetItem = await driver.findComponent(ON.text(pageName)); - if (targetItem !== null) { - await targetItem.click(); - hilog.info(DOMAIN, TAG, `GestureGroupTest: Clicked ${pageName} item`); - - // 等待目标页面加载 - await driver.delayMs(1000); - - // 在页面停留3秒 - hilog.info(DOMAIN, TAG, `GestureGroupTest: Staying on ${pageName} page for 3 seconds`); - await driver.delayMs(1000); - - // 返回主页 - await driver.pressBack(); - await driver.delayMs(1000); - hilog.info(DOMAIN, TAG, `GestureGroupTest: Returned from ${pageName} page`); - } else { - hilog.error(DOMAIN, TAG, `GestureGroupTest: Could not find ${pageName} item`); - // 即使找不到某个页面,也继续测试下一个 - continue; - } - } - - hilog.info(DOMAIN, TAG, 'GestureGroupTest: Completed all pages test successfully'); - hilog.info(DOMAIN, TAG, 'GestureGroupTest: testAllGestureGroupPages end'); - done(); - }); - }); -} \ No newline at end of file diff --git a/GestureGroup/entry/src/ohosTest/ets/test/List.test.ets b/GestureGroup/entry/src/ohosTest/ets/test/List.test.ets deleted file mode 100644 index a191efc067c23c071e294158a5302d4f3eb673ab..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/ohosTest/ets/test/List.test.ets +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 abilityTest from './Ability.test'; -import index from './Index.test' - -export default function testsuite() { - abilityTest(); - index(); -}; \ No newline at end of file diff --git a/GestureGroup/entry/src/ohosTest/module.json5 b/GestureGroup/entry/src/ohosTest/module.json5 deleted file mode 100644 index 1cafc28b86d7d9f2b34f24d26a75c0dbd7299715..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/ohosTest/module.json5 +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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_test", - "type": "feature", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false - } -} diff --git a/GestureGroup/entry/src/test/List.test.ets b/GestureGroup/entry/src/test/List.test.ets deleted file mode 100644 index a60c87c5cbb0badf7c3fd8975034590e6fafa992..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 localUnitTest from './LocalUnit.test'; - -export default function testsuite() { - localUnitTest(); -} \ No newline at end of file diff --git a/GestureGroup/entry/src/test/LocalUnit.test.ets b/GestureGroup/entry/src/test/LocalUnit.test.ets deleted file mode 100644 index 841bfd77e56060e50ec0924302a5ae624e76e3aa..0000000000000000000000000000000000000000 --- a/GestureGroup/entry/src/test/LocalUnit.test.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; - -export default function localUnitTest() { - describe('localUnitTest', () => { - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(() => { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - }); - beforeEach(() => { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - }); - afterEach(() => { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - }); - afterAll(() => { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - }); - it('assertContain', 0, () => { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let a = 'abc'; - let b = 'b'; - // Defines a variety of assertion methods, which are used to declare expected boolean conditions. - expect(a).assertContain(b); - expect(a).assertEqual(a); - }); - }); -} \ No newline at end of file diff --git a/GestureGroup/hvigor/hvigor-config.json5 b/GestureGroup/hvigor/hvigor-config.json5 deleted file mode 100644 index b8fea3f097bd68b0bc4d87de986d2cb7732c1d9b..0000000000000000000000000000000000000000 --- a/GestureGroup/hvigor/hvigor-config.json5 +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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": "6.0.0", - "dependencies": { - }, - "execution": { - // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | 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 */ - // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */ - }, - "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/GestureGroup/hvigorfile.ts b/GestureGroup/hvigorfile.ts deleted file mode 100644 index ae9086af35844176c08f1be3772d081d95d267c6..0000000000000000000000000000000000000000 --- a/GestureGroup/hvigorfile.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. */ -} \ No newline at end of file diff --git a/GestureGroup/oh-package.json5 b/GestureGroup/oh-package.json5 deleted file mode 100644 index 837c0ff9f35a6bb9eea849fead7955c19bcdec8d..0000000000000000000000000000000000000000 --- a/GestureGroup/oh-package.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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": "6.0.0", - "description": "Please describe the basic information.", - "dependencies": { - }, - "devDependencies": { - "@ohos/hypium": "1.0.24", - "@ohos/hamock": "1.0.0" - } -} diff --git a/GestureGroup/ohosTest.md b/GestureGroup/ohosTest.md deleted file mode 100644 index e6261c9f544d8923c7c04a14e85331ff4d5d1383..0000000000000000000000000000000000000000 --- a/GestureGroup/ohosTest.md +++ /dev/null @@ -1,8 +0,0 @@ -| 测试功能 | 预置条件 | 输入 | 预期输出 | 测试结果 | -|----------| ------------ |---------------------|--------------------| -------- | -| 首页加载测试 | 设备正常运行 | 验证基础元素渲染 | 检查标题和列表组件 | Pass | -| 顺序识别 | 设备正常运行 | 点击'sequence Identification' | 跳转成功且页面包含gesture属性 | Pass | -| 并行识别 | 设备正常运行 | 点击'parallel recognition' | 跳转成功且页面包含gesture属性 | Pass | -| 互斥识别 | 设备正常运行 | 点击'Mutual exclusion identification' | 跳转成功且页面包含gesture属性 | Pass | -| 场景示例 | 设备正常运行 | 点击'Scene Example' | 跳转成功且页面包含gesture属性 | Pass | - diff --git a/GestureGroup/screenshots/Exclusive.gif b/GestureGroup/screenshots/Exclusive.gif deleted file mode 100644 index faeca22604c3a8e6cbdbab1b66f4362efa764c65..0000000000000000000000000000000000000000 Binary files a/GestureGroup/screenshots/Exclusive.gif and /dev/null differ diff --git a/GestureGroup/screenshots/Home.jpg b/GestureGroup/screenshots/Home.jpg deleted file mode 100644 index af79d931c58da5f8d865780fe588eeb18e3a19ba..0000000000000000000000000000000000000000 Binary files a/GestureGroup/screenshots/Home.jpg and /dev/null differ diff --git a/GestureGroup/screenshots/Parallel.gif b/GestureGroup/screenshots/Parallel.gif deleted file mode 100644 index 2901ba70b5af8a7f41abf904ae7dfbc0a95e4614..0000000000000000000000000000000000000000 Binary files a/GestureGroup/screenshots/Parallel.gif and /dev/null differ diff --git a/GestureGroup/screenshots/Sequence.gif b/GestureGroup/screenshots/Sequence.gif deleted file mode 100644 index 063ebbfba5d54557f337d7be4a91655c3983781a..0000000000000000000000000000000000000000 Binary files a/GestureGroup/screenshots/Sequence.gif and /dev/null differ diff --git a/internationalization/AppScope/Resources/base/element/string.json b/internationalization/AppScope/Resources/base/element/string.json deleted file mode 100644 index 1080233f01384411ec684b58955cb8808746fdd3..0000000000000000000000000000000000000000 --- a/internationalization/AppScope/Resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "MyApplication" - } - ] -} diff --git a/internationalization/AppScope/Resources/base/media/background.png b/internationalization/AppScope/Resources/base/media/background.png deleted file mode 100644 index 923f2b3f27e915d6871871deea0420eb45ce102f..0000000000000000000000000000000000000000 Binary files a/internationalization/AppScope/Resources/base/media/background.png and /dev/null differ diff --git a/internationalization/AppScope/Resources/base/media/foreground.png b/internationalization/AppScope/Resources/base/media/foreground.png deleted file mode 100644 index eb9427585b36d14b12477435b6419d1f07b3e0bb..0000000000000000000000000000000000000000 Binary files a/internationalization/AppScope/Resources/base/media/foreground.png and /dev/null differ diff --git a/internationalization/AppScope/Resources/base/media/layered_image.json b/internationalization/AppScope/Resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/internationalization/AppScope/Resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/internationalization/AppScope/app.json5 b/internationalization/AppScope/app.json5 deleted file mode 100644 index 59d96e63072cd7388b11907355c4e511e9ba76c6..0000000000000000000000000000000000000000 --- a/internationalization/AppScope/app.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.internationalization", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:layered_image", - "label": "$string:app_name" - } -} diff --git a/internationalization/README_zh.md b/internationalization/README_zh.md deleted file mode 100644 index 3332437d87ca679aec539c10f164d83e36f45392..0000000000000000000000000000000000000000 --- a/internationalization/README_zh.md +++ /dev/null @@ -1,66 +0,0 @@ -# ArkUI使用滚动类指南文档示例 - -### 介绍 - -本示例展示了[@Once:初始化同步一次](https://gitcode.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/arkts-color-effect.md)色彩的使用方法: - -使用说明: -1. 该工程可以选择在模拟器和开发板上运行。 -2. 点击构建,即可在生成的应用中点击对应的按钮,观察自定义占位节点的不同应用。 -3. 进入”DocsSample/ArkUISample/internationalization/entry/src/ohosTest/ets/test/index.test.ets“文件,可以对本项目进行UI的自动化测试。 -### 效果预览 - -| 首页 | 列表类组件目录 | 列表中显示数据示例 | -|------------------------------------|------------------------------------|------------------------------------| -| ![](screenshots/device/image1.png) | ![](screenshots/device/image2.png) | - -### 使用说明 - -1. 在主界面,可以点击对应卡片,选择需要参考的组件示例。 - -2. 在组件目录选择详细的示例参考。 - -3. 进入示例界面,查看参考示例。 - -4. 通过自动测试框架可进行测试及维护。 - -### 工程目录 -``` -entry/src/main/ets/ -|---entryability -|---homePage -| |---CustomizeCanvasComponentDrawing.ets //点击自定义绘制Canvas组件 -| |---InterfaceLayoutBorderSettings.ets //点击界面布局和边框设置 -|---pages -| |---Index.ets // 应用主页面 -entry/src/ohosTest/ -|---ets -| |---index.test.ets // 示例代码测试代码 -``` -### 具体实现 - -1. 组件属性替换:将position({x: 20})改为position({start: 20}),marginLeft: 10改为marginStart: 10,borderRightWidth: 2改为borderEndWidth: 2,确保方向随语言自适应。 -2. 控制组件方向:若需强制 RTL,给组件设置.direction(Direction.Rtl);若需跟随系统语言,设置.direction(Direction.Auto)(系统语言为 RTL 时自动镜像)。 -3. 验证默认适配组件:如 Swipe、TextInput 等已支持镜像,无需手动调整,仅需确认自定义布局的方向词替换完整。 -4. 订阅事件:调用commonEventManager.subscribe,在回调中获取语言变化通知。 -5. 触发 UI 更新:在回调内修改@State/@Link状态变量(如重新赋值this.title = $r('app.string.page_title')),状态变化会自动触发组件重绘。 - -### 相关权限 - -不涉及。 - -### 依赖 - -不涉及。 - -### 下载 - -如需单独下载本工程,执行如下命令: - -```` -git init -git config core.sparsecheckout true -echo code/DocsSample/ArkUISample/GradientEffect > .git/info/sparse-checkout -git remote add origin https://gitcode.com/openharmony/applications_app_samples.git -git pull origin master -```` \ No newline at end of file diff --git a/internationalization/build-profile.json5 b/internationalization/build-profile.json5 deleted file mode 100644 index e3aee4c3af7e6552d7c7fb0bc32272a29669954f..0000000000000000000000000000000000000000 --- a/internationalization/build-profile.json5 +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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", - "compileSdkVersion": "6.0.0(20)", - "compatibleSdkVersion": "6.0.0(20)", - "targetSdkVersion": "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/internationalization/code-linter.json5 b/internationalization/code-linter.json5 deleted file mode 100644 index 5c4682f8164874ec7e9cb8f99ff8b3228ffbc126..0000000000000000000000000000000000000000 --- a/internationalization/code-linter.json5 +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/internationalization/entry/build-profile.json5 b/internationalization/entry/build-profile.json5 deleted file mode 100644 index 9016faf39f8a65cf648bae246a53575510fe8b9f..0000000000000000000000000000000000000000 --- a/internationalization/entry/build-profile.json5 +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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": { - "resOptions": { - "copyCodeResource": { - "enable": false - } - } - }, - "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/internationalization/entry/hvigorfile.ts b/internationalization/entry/hvigorfile.ts deleted file mode 100644 index f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46..0000000000000000000000000000000000000000 --- a/internationalization/entry/hvigorfile.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. */ -} \ No newline at end of file diff --git a/internationalization/entry/obfuscation-rules.txt b/internationalization/entry/obfuscation-rules.txt deleted file mode 100644 index 272efb6ca3f240859091bbbfc7c5802d52793b0b..0000000000000000000000000000000000000000 --- a/internationalization/entry/obfuscation-rules.txt +++ /dev/null @@ -1,23 +0,0 @@ -# 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/internationalization/entry/oh-package.json5 b/internationalization/entry/oh-package.json5 deleted file mode 100644 index 10cda399b0aec3099b257299a57d284393e4e55a..0000000000000000000000000000000000000000 --- a/internationalization/entry/oh-package.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/internationalization/entry/src/main/ets/common/Card.ets b/internationalization/entry/src/main/ets/common/Card.ets deleted file mode 100644 index 8eef9a0fc9b2138668c3048c8076d9db3e453c85..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/ets/common/Card.ets +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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. - */ - -@Component -export struct CompletedRoutableCard { - @Prop - symbol: Resource = $r('sys.symbol.label'); - @Prop - @Require - title: string; - @Prop - @Require - description: ResourceStr; - - build() { - Card({ verticalAlign: VerticalAlign.Top }) { - Button({ type: ButtonType.Circle }) { - SymbolGlyph(this.symbol) - .fontColor(['#fff']) - .fontSize(16) - } - .borderRadius(14) - - Column({ space: 8 }) { - Text(this.title) - .fontColor($r('sys.color.font_primary')) - - Text(this.description) - .fontColor($r('sys.color.font_secondary')) - .fontSize($r('sys.float.Body_S')) - } - .alignItems(HorizontalAlign.Start) - .layoutWeight(1) - } - } -} - -@Component -export struct Card { - @Prop - verticalAlign: VerticalAlign = VerticalAlign.Center; - @BuilderParam - content: () => void; - - build() { - Row({ space: 12 }) { - this.content() - } - .alignItems(this.verticalAlign) - .backgroundColor('#fff') - .borderRadius(12) - .padding(12) - .width('100%') - } -} - -@Component -export struct RoutableCard { - @Prop - icon: Resource = $r('sys.symbol.label'); - @Prop - @Require - title: ResourceStr; - - build() { - Card() { - Button({ type: ButtonType.Circle }) { - SymbolGlyph(this.icon) - .fontColor(['#fff']) - .fontSize(16) - } - .borderRadius(14) - - Text(this.title) - .fontColor($r('sys.color.font_primary')) - .minFontSize(12) - .maxFontSize(16) - .maxLines(1) - .textOverflow({ overflow: TextOverflow.Ellipsis }) - - Blank() - - Button({ type: ButtonType.Normal, buttonStyle: ButtonStyleMode.TEXTUAL }) { - SymbolGlyph($r('sys.symbol.chevron_right')) - .fontSize(18) - .fontColor([$r('sys.color.font_secondary')]) - } - } - } -} - -@Component -export struct ComponentCard { - @Prop - @Require - title: ResourceStr; - @BuilderParam content: () => void; - @Prop - description?: ResourceStr; - - build() { - Column({ space: 8 }) { - Text(this.title) - .fontSize(14) - .fontColor('#666') - Row({ space: 12}) { - this.content(); - } - if (this.description) { - Text(this.description) - .backgroundColor('#eee') - .borderRadius(4) - .padding(4) - .fontSize(12) - .fontColor('#999') - .width('100%') - } - } - .alignItems(HorizontalAlign.Start) - .backgroundColor('#fff') - .borderRadius(12) - .padding(12) - .width('100%') - } -} \ No newline at end of file diff --git a/internationalization/entry/src/main/ets/common/Route.ets b/internationalization/entry/src/main/ets/common/Route.ets deleted file mode 100644 index da3d2cc3284d5cba7d3b667a3c1c61f5c6b5a9dc..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/ets/common/Route.ets +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 interface Route { - title: string ; - name: string; - items?: Route[]; - description?: ResourceStr; -} \ No newline at end of file diff --git a/internationalization/entry/src/main/ets/common/resource.ets b/internationalization/entry/src/main/ets/common/resource.ets deleted file mode 100644 index e240a1079ad09a0f19080b49b57a6a0720416e6c..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/ets/common/resource.ets +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 ResourceManager { - public resourceToString(resource: Resource): string { - return getContext(this).resourceManager.getStringSync(resource); - } -} - -// 默认导出let -let resourceToStringManager = new ResourceManager(); - -export default resourceToStringManager as ResourceManager; \ No newline at end of file diff --git a/internationalization/entry/src/main/ets/entryability/EntryAbility.ets b/internationalization/entry/src/main/ets/entryability/EntryAbility.ets deleted file mode 100644 index 98182799de1294d4c21194646a0c30eff08aea33..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/ets/entryability/EntryAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; -import { hilog } from '@kit.PerformanceAnalysisKit'; -import { window } from '@kit.ArkUI'; - -const DOMAIN = 0x0000; - -export default class EntryAbility extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - try { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); - } catch (err) { - hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err)); - } - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); - } - - onDestroy(): void { - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage): void { - // Main window is created, set main page for this ability - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - - windowStage.loadContent('pages/Index', (err) => { - if (err.code) { - hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); - return; - } - hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); - }); - } - - onWindowStageDestroy(): void { - // Main window is destroyed, release UI related resources - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); - } - - onForeground(): void { - // Ability has brought to foreground - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); - } - - onBackground(): void { - // Ability has back to background - hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); - } -} \ No newline at end of file diff --git a/internationalization/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/internationalization/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets deleted file mode 100644 index 4ce6449f0e91914e73d4502c9f2e8e9a395ea4b1..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 { hilog } from '@kit.PerformanceAnalysisKit'; -import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; - -const DOMAIN = 0x0000; - -export default class EntryBackupAbility extends BackupExtensionAbility { - async onBackup() { - hilog.info(DOMAIN, 'testTag', 'onBackup ok'); - await Promise.resolve(); - } - - async onRestore(bundleVersion: BundleVersion) { - hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); - await Promise.resolve(); - } -} \ No newline at end of file diff --git a/internationalization/entry/src/main/ets/homePage/CustomizeCanvasComponentDrawing.ets b/internationalization/entry/src/main/ets/homePage/CustomizeCanvasComponentDrawing.ets deleted file mode 100644 index 08df2b64e9de341ad8d44d3e43139f789305a8c9..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/ets/homePage/CustomizeCanvasComponentDrawing.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -// [Start Customize_Canvas_Component_Drawing] -import { BusinessError, commonEventManager } from '@kit.BasicServicesKit'; - -@Entry -@Component -struct CustomizeCanvasComponentDrawing { - @State message: string = 'Hello world'; - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - - aboutToAppear(): void { - // 监听系统语言切换 - let subscriber: commonEventManager.CommonEventSubscriber | null = null; - let subscribeInfo2: commonEventManager.CommonEventSubscribeInfo = { - events: ['usual.event.LOCALE_CHANGED'], - } - commonEventManager.createSubscriber(subscribeInfo2, - (err: BusinessError, data: commonEventManager.CommonEventSubscriber) => { - if (err) { - console.error(`Failed to create subscriber. Code is ${err.code}, message is ${err.message}`); - return; - } - - subscriber = data; - if (subscriber !== null) { - commonEventManager.subscribe(subscriber, (err: BusinessError, data: commonEventManager.CommonEventData) => { - if (err) { - return; - } - // 监听到语言切换后,需要重新绘制Canvas内容 - this.drawText(); - }) - } else { - console.error(`MayTest Need create subscriber`); - } - }) - } - - drawText(): void { - console.error('MayTest drawText') - this.context.reset() - this.context.direction = 'inherit' - this.context.font = '30px sans-serif' - this.context.fillText('ab%123&*@', 50, 50) - } - - build() { - Row() { - Canvas(this.context) - .direction(Direction.Auto) - .width('100%') - .height('100%') - .onReady(() =>{ - this.drawText() - }) - .backgroundColor(Color.Pink) - } - .height('100%') - } - -} -// [End Customize_Canvas_Component_Drawing] \ No newline at end of file diff --git a/internationalization/entry/src/main/ets/homePage/InterfaceLayoutBorderSettings.ets b/internationalization/entry/src/main/ets/homePage/InterfaceLayoutBorderSettings.ets deleted file mode 100644 index 0d69714c89b8ac1596f35dbad89cfda14b297b20..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/ets/homePage/InterfaceLayoutBorderSettings.ets +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ -// [Start Interface_Layout_Border_Settings] -import { LengthMetrics } from '@kit.ArkUI'; - -@Entry -@Component -struct InterfaceLayoutBorderSettings { - build() { - Stack({ alignContent: Alignment.TopStart }) { - Stack({ alignContent: Alignment.TopStart }) { - Column() - .width(100) - .height(100) - .backgroundColor(Color.Red) - .position({ - start: LengthMetrics.px(200), - top: LengthMetrics.px(200) - }) //需要同时支持LTR和RTL时使用API12新增的LocalizedEdges入参类型, - //仅支持LTR时等同于.position({ x: '200px', y: '200px' }) - - }.backgroundColor(Color.Blue) - }.width('100%').height('100%').border({ color: '#880606' }) - } -} -// [End Interface_Layout_Border_Settings] \ No newline at end of file diff --git a/internationalization/entry/src/main/ets/pages/Index.ets b/internationalization/entry/src/main/ets/pages/Index.ets deleted file mode 100644 index f104708646ea3d0dd996f7f5e9fa70c216be571b..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/ets/pages/Index.ets +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { router, Router } from '@kit.ArkUI' - -@Entry -@Component -struct Index { -build() { - Column(){ - Column(){ - Text($r('app.string.Interface_Layout_Border_Settings')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - router.pushUrl({url:'homePage/InterfaceLayoutBorderSettings'}); - }) - Column(){ - Text($r('app.string.Customize_Canvas_Component_Drawing')).backgroundColor(Color.Green) - }.width('100%').height(50) - .onClick(()=>{ - router.pushUrl({url:'homePage/CustomizeCanvasComponentDrawing'}); - }) - } -} -} \ No newline at end of file diff --git a/internationalization/entry/src/main/module.json5 b/internationalization/entry/src/main/module.json5 deleted file mode 100644 index 8930831ba2f2326ee0eabe8a6eac4a9c44ad5c96..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/module.json5 +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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" - ], - "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": [ - "ohos.want.action.home" - ] - } - ] - } - ], - "extensionAbilities": [ - { - "name": "EntryBackupAbility", - "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", - "type": "backup", - "exported": false, - "metadata": [ - { - "name": "ohos.extension.backup", - "resource": "$profile:backup_config" - } - ], - } - ] - } -} \ No newline at end of file diff --git a/internationalization/entry/src/main/resources/base/element/color.json b/internationalization/entry/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/internationalization/entry/src/main/resources/base/element/float.json b/internationalization/entry/src/main/resources/base/element/float.json deleted file mode 100644 index 33ea22304f9b1485b5f22d811023701b5d4e35b6..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/resources/base/element/float.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "float": [ - { - "name": "page_text_font_size", - "value": "50fp" - } - ] -} diff --git a/internationalization/entry/src/main/resources/base/element/string.json b/internationalization/entry/src/main/resources/base/element/string.json deleted file mode 100644 index a7b3de5d3fb733d40ab0c507e8635dfba819e0f0..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "EntryAbility_desc", - "value": "description" - }, - { - "name": "EntryAbility_label", - "value": "label" - }, - { - "name": "Customize_Canvas_Component_Drawing", - "value": "点击自定义绘制Canvas组件" - }, - { - "name": "Interface_Layout_Border_Settings", - "value": "点击界面布局和边框设置" - } - ] -} \ No newline at end of file diff --git a/internationalization/entry/src/main/resources/base/media/background.png b/internationalization/entry/src/main/resources/base/media/background.png deleted file mode 100644 index 923f2b3f27e915d6871871deea0420eb45ce102f..0000000000000000000000000000000000000000 Binary files a/internationalization/entry/src/main/resources/base/media/background.png and /dev/null differ diff --git a/internationalization/entry/src/main/resources/base/media/foreground.png b/internationalization/entry/src/main/resources/base/media/foreground.png deleted file mode 100644 index 97014d3e10e5ff511409c378cd4255713aecd85f..0000000000000000000000000000000000000000 Binary files a/internationalization/entry/src/main/resources/base/media/foreground.png and /dev/null differ diff --git a/internationalization/entry/src/main/resources/base/media/layered_image.json b/internationalization/entry/src/main/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/internationalization/entry/src/main/resources/base/media/startIcon.png b/internationalization/entry/src/main/resources/base/media/startIcon.png deleted file mode 100644 index 205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b..0000000000000000000000000000000000000000 Binary files a/internationalization/entry/src/main/resources/base/media/startIcon.png and /dev/null differ diff --git a/internationalization/entry/src/main/resources/base/profile/backup_config.json b/internationalization/entry/src/main/resources/base/profile/backup_config.json deleted file mode 100644 index 78f40ae7c494d71e2482278f359ec790ca73471a..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/resources/base/profile/backup_config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "allowToBackupRestore": true -} \ No newline at end of file diff --git a/internationalization/entry/src/main/resources/base/profile/main_pages.json b/internationalization/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index da62efe7fd33f0e2935b747e2623fb8d26052d1b..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "src": [ - "pages/Index", - "homePage/CustomizeCanvasComponentDrawing", - "homePage/InterfaceLayoutBorderSettings" - ] -} diff --git a/internationalization/entry/src/main/resources/dark/element/color.json b/internationalization/entry/src/main/resources/dark/element/color.json deleted file mode 100644 index 79b11c2747aec33e710fd3a7b2b3c94dd9965499..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/main/resources/dark/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#000000" - } - ] -} \ No newline at end of file diff --git a/internationalization/entry/src/mock/mock-config.json5 b/internationalization/entry/src/mock/mock-config.json5 deleted file mode 100644 index 323d1d611fecf4ecb751976e3a71500b3712a445..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/mock/mock-config.json5 +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ -{ -} \ No newline at end of file diff --git a/internationalization/entry/src/ohosTest/ets/test/Ability.test.ets b/internationalization/entry/src/ohosTest/ets/test/Ability.test.ets deleted file mode 100644 index 7f30942b81554a399e89aa253c7089eca4f8d8d1..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/ohosTest/ets/test/Ability.test.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 { hilog } from '@kit.PerformanceAnalysisKit'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; - -export default function abilityTest() { - describe('ActsAbilityTest', () => { - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(() => { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - }) - beforeEach(() => { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - }) - afterEach(() => { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - }) - afterAll(() => { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - }) - it('assertContain', 0, () => { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); - let a = 'abc'; - let b = 'b'; - // Defines a variety of assertion methods, which are used to declare expected boolean conditions. - expect(a).assertContain(b); - expect(a).assertEqual(a); - }) - }) -} \ No newline at end of file diff --git a/internationalization/entry/src/ohosTest/ets/test/Index.test.ets b/internationalization/entry/src/ohosTest/ets/test/Index.test.ets deleted file mode 100644 index 05c0e716c7bed80b22e9ef59dd20697f0f45043e..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/ohosTest/ets/test/Index.test.ets +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 { describe, it, expect, beforeAll, Level } from '@ohos/hypium'; -// 导入测试依赖kit -import { abilityDelegatorRegistry, Driver, ON, MouseButton,MatchPattern, UiDirection, On } from '@kit.TestKit'; -import { UIAbility, Want } from '@kit.AbilityKit'; -import { Point } from '@ohos.UiTest'; - -const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator(); -const bundleName = abilityDelegatorRegistry.getArguments().bundleName; -let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator(); -let want: Want; - -async function getResourceString(resource: Resource): Promise { - let manage = abilityDelegator.getAppContext().resourceManager; - let textString: string = await manage.getStringValue(resource); - return textString; -} -export default function IndexTest() { - describe('IndexTest', () => { - beforeAll(async (done: Function) => { - want = { - bundleName: bundleName, - abilityName: 'EntryAbility' - }; - await delegator.startAbility(want); - let driver = Driver.create(); - await driver.delayMs(1000); - const ability: UIAbility = await delegator.getCurrentTopAbility(); - expect(ability.context.abilityInfo.name).assertEqual('EntryAbility'); - done(); - }) - - /** - * @tc.number UiTest_001 - * @tc.name InterfaceLayoutBorderSettings001 - * @tc.desc 点击界面布局和边框设置 - */ - it('InterfaceLayoutBorderSettings001', Level.LEVEL1, async (done: Function) => { - let driver = Driver.create(); - await driver.delayMs(1000); - let str = await getResourceString($r('app.string.Interface_Layout_Border_Settings')); - let openModel = await driver.findComponent(ON.text(str, MatchPattern.CONTAINS)); - await openModel.click(); - await driver.delayMs(1000); - await driver.pressBack(); - done(); - }) - /** - * @tc.number UiTest_001 - * @tc.name CustomizeCanvasComponentDrawing001 - * @tc.desc 点击自定义绘制Canvas组件 - */ - it('CustomizeCanvasComponentDrawing001', Level.LEVEL1, async (done: Function) => { - let driver = Driver.create(); - await driver.delayMs(1000); - let str = await getResourceString($r('app.string.Customize_Canvas_Component_Drawing')); - let openModel = await driver.findComponent(ON.text(str, MatchPattern.CONTAINS)); - await openModel.click(); - await driver.delayMs(1000); - await driver.pressBack(); - done(); - }) - }) -} \ No newline at end of file diff --git a/internationalization/entry/src/ohosTest/ets/test/List.test.ets b/internationalization/entry/src/ohosTest/ets/test/List.test.ets deleted file mode 100644 index a1951e50c73703b8b1fe39390c5287b68a1bf394..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/ohosTest/ets/test/List.test.ets +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 abilityTest from './Ability.test'; -import IndexTest from './Index.test'; - -export default function testsuite() { - abilityTest(); - IndexTest(); -} \ No newline at end of file diff --git a/internationalization/entry/src/ohosTest/module.json5 b/internationalization/entry/src/ohosTest/module.json5 deleted file mode 100644 index 1cafc28b86d7d9f2b34f24d26a75c0dbd7299715..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/ohosTest/module.json5 +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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_test", - "type": "feature", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false - } -} diff --git a/internationalization/entry/src/test/List.test.ets b/internationalization/entry/src/test/List.test.ets deleted file mode 100644 index a60c87c5cbb0badf7c3fd8975034590e6fafa992..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 localUnitTest from './LocalUnit.test'; - -export default function testsuite() { - localUnitTest(); -} \ No newline at end of file diff --git a/internationalization/entry/src/test/LocalUnit.test.ets b/internationalization/entry/src/test/LocalUnit.test.ets deleted file mode 100644 index 841bfd77e56060e50ec0924302a5ae624e76e3aa..0000000000000000000000000000000000000000 --- a/internationalization/entry/src/test/LocalUnit.test.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; - -export default function localUnitTest() { - describe('localUnitTest', () => { - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(() => { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - }); - beforeEach(() => { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - }); - afterEach(() => { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - }); - afterAll(() => { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - }); - it('assertContain', 0, () => { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - let a = 'abc'; - let b = 'b'; - // Defines a variety of assertion methods, which are used to declare expected boolean conditions. - expect(a).assertContain(b); - expect(a).assertEqual(a); - }); - }); -} \ No newline at end of file diff --git a/internationalization/hvigor/hvigor-config.json5 b/internationalization/hvigor/hvigor-config.json5 deleted file mode 100644 index 3b057578a1bb4d591ee53054e39ab0154fc2e43a..0000000000000000000000000000000000000000 --- a/internationalization/hvigor/hvigor-config.json5 +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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": "6.0.0", - "dependencies": { - }, - "execution": { - // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | 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 */ - // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */ - }, - "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/internationalization/hvigorfile.ts b/internationalization/hvigorfile.ts deleted file mode 100644 index ae9086af35844176c08f1be3772d081d95d267c6..0000000000000000000000000000000000000000 --- a/internationalization/hvigorfile.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. */ -} \ No newline at end of file diff --git a/internationalization/oh-package.json5 b/internationalization/oh-package.json5 deleted file mode 100644 index 837c0ff9f35a6bb9eea849fead7955c19bcdec8d..0000000000000000000000000000000000000000 --- a/internationalization/oh-package.json5 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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": "6.0.0", - "description": "Please describe the basic information.", - "dependencies": { - }, - "devDependencies": { - "@ohos/hypium": "1.0.24", - "@ohos/hamock": "1.0.0" - } -} diff --git a/internationalization/ohosTest.md b/internationalization/ohosTest.md deleted file mode 100644 index 2ac7b2a67153d829ad177818f2cf19bf161f2efe..0000000000000000000000000000000000000000 --- a/internationalization/ohosTest.md +++ /dev/null @@ -1,9 +0,0 @@ -# 使用点击界面效果测试用例 - -## 用例表 - -| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | -|--------|------------------|---------------------------|------------|------| -------- | -| 拉起应用 | 设备正常运行 | | 成功拉起应用 | Yes | Pass | -| 示例代码验证 | EntryAbility正常调用 | | 定义的类可以正常使用 | Yes | Pass | - diff --git a/internationalization/screenshots/device/image1.png b/internationalization/screenshots/device/image1.png deleted file mode 100644 index 1e8e7e3d05904ec6ade7c2c57ff36c5f075dee88..0000000000000000000000000000000000000000 Binary files a/internationalization/screenshots/device/image1.png and /dev/null differ diff --git a/internationalization/screenshots/device/image2.png b/internationalization/screenshots/device/image2.png deleted file mode 100644 index 5832e1fda05ef954561fabe5a53e2c484a0cd57e..0000000000000000000000000000000000000000 Binary files a/internationalization/screenshots/device/image2.png and /dev/null differ