diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..446a13a2660048da29764b7a223119ddd834a612 --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.multiwindowpractice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b35095cafeeb19d91bf39a64eee25b7af234843e --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiWindowPractice" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3 Binary files /dev/null and b/AppScope/resources/base/media/app_icon.png differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + + 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. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index ee0b98e25dc9a5c4682bef2031ce770bc5532ad8..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# MultiWindowPractice - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index dea6e885825413584dd94b40849552ed2bcd167b..d7f49aaf98055a27ca46e9d5b1209bac9df442ab 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,56 @@ -# MultiWindowPractice +# 智慧多窗开发实践 -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} +### 介绍 -#### 软件架构 -软件架构说明 +本示例展示了智慧多窗(分屏/悬浮窗)开发过程中界面适配问题的解决方案。 +### 效果预览 -#### 安装教程 +部分效果图如下 -1. xxxx -2. xxxx -3. xxxx +| 页面被截断问题优化 | Video组件分屏状态下被截断问题优化 | 悬浮窗顶部操作栏无法响应操作问题优化 | +|-----------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------| +| ![Question1.png](screenshots/devices/Question1.png) | ![Question3.png](screenshots/devices/Question3.png) | ![Question7.png](screenshots/devices/Question7.png) | -#### 使用说明 +### 目录结构 -1. xxxx -2. xxxx -3. xxxx +``` +├──entry/src/main/ets/ +│ ├──common +│ │ ├──AVPlayerUtil.ets // 视频播放工具类 +│ │ ├──Constants.ets // 常量封装类 +│ │ └──Logger.ets // 日志打印工具类 +│ ├──entryability +│ │ └──EntryAbility.ets // Ability的生命周期回调内容 +│ ├──entrybackupability +│ │ └──EntryBackupAbility.ets // 程序入口类 +│ └──pages +│ ├──Index.ets // 应用入口页 +│ ├──Question.ets // 通用问题场景入口菜单 +│ ├──Question1Correct.ets // 问题场景一优化后 +│ ├──Question1Incorrect.ets // 问题场景一优化前 +│ ├──... // 此处省略其它问题场景描述 +│ └──Question8Incorrect8.ets // 问题场景八优化前 +└──entry/src/main/resources // 应用静态资源目录 +``` -#### 参与贡献 +### 相关权限 -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +不涉及。 + +### 依赖 + +不涉及。 + +### 约束与限制 + +1.本示例仅支持标准系统上运行,支持设备:华为手机。 + +2.HarmonyOS系统:HarmonyOS NEXT Release及以上。 + +3.DevEco Studio版本:DevEco Studio NEXT Release及以上。 + +4.HarmonyOS SDK版本:HarmonyOS NEXT Release SDK及以上。 -#### 特技 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/build-profile.json5 b/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..080fd5dc2df3a9b68aaa72f170efde91d56f7f7a --- /dev/null +++ b/build-profile.json5 @@ -0,0 +1,40 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": 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/entry/build-profile.json5 b/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4d611879c7913fb0610c686e2399258ab3a6dad1 --- /dev/null +++ b/entry/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/entry/hvigorfile.ts b/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/entry/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/entry/obfuscation-rules.txt b/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/entry/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a --- /dev/null +++ b/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/entry/src/main/ets/common/AVPlayerUtil.ets b/entry/src/main/ets/common/AVPlayerUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3ce471b18d8d456f51b58b8b62e19cb040ff8bd --- /dev/null +++ b/entry/src/main/ets/common/AVPlayerUtil.ets @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2024 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 { media } from '@kit.MediaKit'; +import { common } from '@kit.AbilityKit'; +import Logger from './Logger'; + +export class AVPlayerUtil { + private surfaceId: string = ''; + private avPlayer: media.AVPlayer | undefined = undefined; + private callBack: Function = () => { + }; + + setSurfaceId(surfaceId: string) { + this.surfaceId = surfaceId; + } + + setAVPlayerCallback() { + if (this.avPlayer) { + this.avPlayer.on('stateChange', async (state: string) => { + switch (state) { + case 'idle': + Logger.info('AVPlayer state idle called.'); + this.avPlayer?.release(); + break; + case 'initialized': + Logger.info('AVPlayer state initialized called.'); + this.avPlayer!.surfaceId = this.surfaceId; + this.avPlayer?.prepare(); + break; + case 'prepared': + Logger.info('AVPlayer state prepared called.'); + this.avPlayer?.play(); + break; + case 'playing': + Logger.info('AVPlayer state playing called.'); + break; + case 'paused': + Logger.info('AVPlayer state paused called.'); + break; + case 'completed': + Logger.info('AVPlayer state completed called.'); + this.avPlayer?.play(); + break; + case 'stopped': + Logger.info('AVPlayer state stopped called.'); + this.avPlayer?.reset(); + break; + case 'released': + Logger.info('AVPlayer state released called.'); + break; + default: + break; + } + }) + + // get video height and width + this.avPlayer?.on('videoSizeChange', (width: number, height: number) => { + Logger.info(`videoSizeChange called,and width is: ${width} , height is : ${height}`); + this.callBack(width / height); + }) + } + } + + async initPlayer(url: string, callBack: Function) { + this.avPlayer = await media.createAVPlayer(); + this.callBack = callBack; + this.setAVPlayerCallback(); + + let context = getContext(this) as common.UIAbilityContext; + let fileDescriptor = await context.resourceManager.getRawFd(url); + let avFileDescriptor: media.AVFileDescriptor = + { fd: fileDescriptor.fd, offset: fileDescriptor.offset, length: fileDescriptor.length }; + this.avPlayer.fdSrc = avFileDescriptor; + Logger.info(`fdSrc: ${this.avPlayer.fdSrc}`); + } + + stopPlay() { + this.avPlayer?.off('videoSizeChange'); + this.avPlayer?.stop(); + } +} diff --git a/entry/src/main/ets/common/Constants.ets b/entry/src/main/ets/common/Constants.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f4d877ca7613c5531edec07ac0896a268350233 --- /dev/null +++ b/entry/src/main/ets/common/Constants.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class Constants { + /** + * Question title array + */ + static readonly QUESTION_ARRAY: Array = + [$r('app.string.Question1'), $r('app.string.Question2'), $r('app.string.Question3'), $r('app.string.Question4'), + $r('app.string.Question5'), $r('app.string.Question6'), $r('app.string.Question7'), $r('app.string.Question8')]; +} \ No newline at end of file diff --git a/entry/src/main/ets/common/Logger.ets b/entry/src/main/ets/common/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..f82cad7f847c28c544d3e1588fd34721b9467d93 --- /dev/null +++ b/entry/src/main/ets/common/Logger.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 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'; + +class Logger { + private domain: number; + private prefix: string; + private format: string = "%{public}s, %{public}s"; + + constructor(prefix: string) { + this.prefix = prefix; + this.domain = 0xFF00; + } + + debug(...args: Object[]): void { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: Object[]): void { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: Object[]): void { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: Object[]): void { + hilog.error(this.domain, this.prefix, this.format, args); + } +} + +export default new Logger('[MultiWindowPractice]'); diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..0702d292035b126055fc19f6456c3fd8d76eac76 --- /dev/null +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 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, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + let windowClass: window.Window = windowStage.getMainWindowSync(); + windowClass.setWindowLayoutFullScreen(true); + let naviBarArea: window.AvoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); + let area: window.AvoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + AppStorage.setOrCreate('naviIndicatorHeight', px2vp(naviBarArea.bottomRect.height)); + AppStorage.setOrCreate('statusBarHeight', px2vp(area.topRect.height)); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.'); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b744d7eaa66e51e79fc4e0896e251292ee767c5 --- /dev/null +++ b/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 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'; + +export default class EntryBackupAbility extends BackupExtensionAbility { + async onBackup() { + hilog.info(0x0000, 'testTag', 'onBackup ok'); + } + + async onRestore(bundleVersion: BundleVersion) { + hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..33b2d8df22065a80dd1f5fc805510da04d776a58 --- /dev/null +++ b/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 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 { Constants } from '../common/Constants'; + +@Entry +@Component +struct Index { + @Provide navPathStack: NavPathStack = new NavPathStack(); + + build() { + Navigation(this.navPathStack) { + Scroll() { + Column({ space: 12 }) { + Blank() + .layoutWeight(1) + + ForEach(Constants.QUESTION_ARRAY, (item: Resource, index: number) => { + Button(item) + .height(40) + .width('100%') + .onClick(() => { + this.navPathStack.pushPath({ name: 'Question', param: index }); + }) + }, (item: string) => item) + } + .padding(16) + .justifyContent(FlexAlign.End) + } + .height('100%') + .width('100%') + .padding({ + bottom: AppStorage.get('naviIndicatorHeight') ?? 0 + }) + } + .mode(NavigationMode.Stack) + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question.ets b/entry/src/main/ets/pages/Question.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee98145a930c15e1c6ad6662f99781fd9e3982a2 --- /dev/null +++ b/entry/src/main/ets/pages/Question.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 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 { Constants } from '../common/Constants'; + +@Builder +export function QuestionBuilder() { + Question() +} + +@Component +export struct Question { + @Consume('navPathStack') navPathStack: NavPathStack; + @State title: string = ''; + @State questionTag: number = 0; + + aboutToAppear(): void { + let params: Array = this.navPathStack.getParamByName('Question') as Array + if (params && params.length > 0) { + this.questionTag = params[0]; + this.title = getContext().resourceManager.getStringSync(Constants.QUESTION_ARRAY[this.questionTag].id); + } + } + + build() { + NavDestination() { + Column({ space: 12 }) { + Button($r('app.string.before_optimization')) + .height(40) + .width('100%') + .onClick(() => { + this.navPathStack.pushPath({ name: `Question${this.questionTag + 1}Incorrect` }); + }) + Button($r('app.string.after_optimization')) + .height(40) + .width('100%') + .onClick(() => { + this.navPathStack.pushPath({ name: `Question${this.questionTag + 1}Correct` }); + }) + } + .height('100%') + .width('100%') + .padding({ left: 16, right: 16 }) + .justifyContent(FlexAlign.End) + } + .title(this.title) + .padding({ + top: AppStorage.get('statusBarHeight') ?? 0, + bottom: (AppStorage.get('naviIndicatorHeight') ?? 0) + 16 + }) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question1Correct.ets b/entry/src/main/ets/pages/Question1Correct.ets new file mode 100644 index 0000000000000000000000000000000000000000..db2c40371e39282223a6b0a756cc654d5def8edf --- /dev/null +++ b/entry/src/main/ets/pages/Question1Correct.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question1CorrectBuilder() { + Question1Correct() +} + +@Component +export struct Question1Correct { + build() { + NavDestination() { + Scroll() { + Column({ space: 12 }) { + Text('Text1') + .fontSize(50) + .width('100%') + .textAlign(TextAlign.Center) + .height(350) + .backgroundColor(Color.Brown) + + Text('Text2') + .fontSize(50) + .width('100%') + .textAlign(TextAlign.Center) + .height(350) + .backgroundColor(Color.Orange) + } + } + .padding({ + left: 16, + right: 16 + }) + } + .hideTitleBar(true) + .padding({ + top: AppStorage.get('statusBarHeight') ?? 0, + bottom: (AppStorage.get('naviIndicatorHeight') ?? 0) + 16 + }) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question1Incorrect.ets b/entry/src/main/ets/pages/Question1Incorrect.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c0e3f69849037447e69159184dd107d4bfa7511 --- /dev/null +++ b/entry/src/main/ets/pages/Question1Incorrect.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question1IncorrectBuilder() { + Question1Incorrect() +} + +@Component +export struct Question1Incorrect { + build() { + NavDestination() { + Column({ space: 12 }) { + Text('Text1') + .fontSize(50) + .width('100%') + .textAlign(TextAlign.Center) + .height(350) + .backgroundColor(Color.Brown) + + Text('Text2') + .fontSize(50) + .width('100%') + .textAlign(TextAlign.Center) + .height(350) + .backgroundColor(Color.Orange) + } + .height('100%') + .width('100%') + .padding({ + left: 16, + right: 16 + }) + } + .hideTitleBar(true) + .padding({ + top: AppStorage.get('statusBarHeight') ?? 0, + bottom:( AppStorage.get('naviIndicatorHeight') ?? 0) + 16 + }) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question2Correct.ets b/entry/src/main/ets/pages/Question2Correct.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b37820ceffd1b2bb80c929494133500c32193a9 --- /dev/null +++ b/entry/src/main/ets/pages/Question2Correct.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 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 { AVPlayerUtil } from '../common/AVPlayerUtil'; + +@Builder +export function Question2CorrectBuilder() { + Question2Correct() +} + +@Component +export struct Question2Correct { + @State aspect: number = 9 / 16; // default video width/height ratio value + private xComponentController: XComponentController = new XComponentController(); + private player?: AVPlayerUtil; + + aboutToDisappear(): void { + this.player?.stopPlay(); + } + + build() { + NavDestination() { + Stack() { + XComponent({ id: 'video_player_id', type: XComponentType.SURFACE, controller: this.xComponentController }) + .onLoad(() => { + this.player = new AVPlayerUtil(); + this.player.setSurfaceId(this.xComponentController.getXComponentSurfaceId()); + this.player.initPlayer('testVideo2.mp4', (aspect: number) => { + this.aspect = aspect; + }); + }) + .aspectRatio(this.aspect) + } + .width('100%') + .height('100%') + .backgroundColor(Color.Black) + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question2Incorrect.ets b/entry/src/main/ets/pages/Question2Incorrect.ets new file mode 100644 index 0000000000000000000000000000000000000000..aab7594366fce99ffe8e620cd5dd550b8be4a6d3 --- /dev/null +++ b/entry/src/main/ets/pages/Question2Incorrect.ets @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2024 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 { display } from '@kit.ArkUI'; +import { AVPlayerUtil } from '../common/AVPlayerUtil'; + +@Builder +export function Question2IncorrectBuilder() { + Question2Incorrect() +} + +@Component +export struct Question2Incorrect { + @State aspect: number = 9 / 16; // default video height/width ratio value + @State xComponentWidth: number = px2vp(display.getDefaultDisplaySync().width); + @State xComponentHeight: number = px2vp(display.getDefaultDisplaySync().width * this.aspect); + private xComponentController: XComponentController = new XComponentController(); + private player?: AVPlayerUtil; + + aboutToDisappear(): void { + this.player?.stopPlay(); + } + + build() { + NavDestination() { + Stack() { + XComponent({ id: 'video_player_id', type: XComponentType.SURFACE, controller: this.xComponentController }) + .onLoad(() => { + this.player = new AVPlayerUtil(); + this.player.setSurfaceId(this.xComponentController.getXComponentSurfaceId()); + this.player.initPlayer('testVideo2.mp4', (aspect: number) => { + this.aspect = aspect; + this.xComponentHeight = px2vp(display.getDefaultDisplaySync().height); + this.xComponentWidth = px2vp(display.getDefaultDisplaySync().height * aspect); + }); + }) + .width(this.xComponentWidth) + .height(this.xComponentHeight) + } + .width('100%') + .height('100%') + .backgroundColor(Color.Black) + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question3Correct.ets b/entry/src/main/ets/pages/Question3Correct.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb8072199302d22fc2e250ec2c1b7bc6441a1697 --- /dev/null +++ b/entry/src/main/ets/pages/Question3Correct.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question3CorrectBuilder() { + Question3Correct() +} + +@Component +export struct Question3Correct { + build() { + NavDestination() { + Column() { + Video({ src: $rawfile('testVideo2.mp4') }) + .height('100%') + .width('100%') + .autoPlay(true) + .objectFit(ImageFit.Contain) + .controls(false) + } + .height('100%') + .width('100%') + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question3Incorrect.ets b/entry/src/main/ets/pages/Question3Incorrect.ets new file mode 100644 index 0000000000000000000000000000000000000000..bfe6cdf1c419b9b19e9266a38f4f88952d52d83e --- /dev/null +++ b/entry/src/main/ets/pages/Question3Incorrect.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question3IncorrectBuilder() { + Question3Incorrect() +} + +@Component +export struct Question3Incorrect { + build() { + NavDestination() { + Column() { + Video({ src: $rawfile('testVideo2.mp4') }) + .height('100%') + .width('100%') + .autoPlay(true) + .controls(false) + } + .height('100%') + .width('100%') + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question4Correct.ets b/entry/src/main/ets/pages/Question4Correct.ets new file mode 100644 index 0000000000000000000000000000000000000000..b5aa92da1acbf4a10a6e2990abee297c969e6261 --- /dev/null +++ b/entry/src/main/ets/pages/Question4Correct.ets @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 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'; + +@Builder +export function Question4CorrectBuilder() { + Question4Correct() +} + +@Component +export struct Question4Correct { + @Builder + customDialogComp() { + Column() { + Text('Top') + .height(60) + .width('100%') + .textAlign(TextAlign.Center) + .fontSize(24) + .fontWeight(FontWeight.Bold) + .backgroundColor('#2887DA') + + Scroll() { + Text('Middle') + .height('100%') + .width('100%') + .textAlign(TextAlign.Center) + .fontSize(24) + .fontWeight(FontWeight.Bold) + .backgroundColor('#18A98D') + } + .layoutWeight(1) + + Text('Bottom') + .height(60) + .width('100%') + .textAlign(TextAlign.Center) + .fontSize(24) + .fontWeight(FontWeight.Bold) + .backgroundColor('#F69C00') + } + .height(500) + .justifyContent(FlexAlign.SpaceBetween) + .constraintSize({ + maxHeight: '90%' + }) + } + + build() { + NavDestination() { + Column() { + Button('Show Dialog') + .height(40) + .width('100%') + .onClick(() => { + promptAction.openCustomDialog({ + builder: () => { + this.customDialogComp(); + } + }); + }) + } + .height('100%') + .width('100%') + .justifyContent(FlexAlign.End) + .padding({ + left: 16, + right: 16 + }) + } + .hideTitleBar(true) + .padding({ + top: AppStorage.get('statusBarHeight') ?? 0, + bottom: (AppStorage.get('naviIndicatorHeight') ?? 0) + 16 + }) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question4Incorrect.ets b/entry/src/main/ets/pages/Question4Incorrect.ets new file mode 100644 index 0000000000000000000000000000000000000000..0cc00d476eb83260bfc895fab071862361af1144 --- /dev/null +++ b/entry/src/main/ets/pages/Question4Incorrect.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 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'; + +@Builder +export function Question4IncorrectBuilder() { + Question4Incorrect() +} + +@Component +export struct Question4Incorrect { + @Builder + customDialogComp() { + Column() { + Text('Top') + .height(60) + .width('100%') + .textAlign(TextAlign.Center) + .fontSize(24) + .fontWeight(FontWeight.Bold) + .backgroundColor('#2887DA') + + Scroll() { + Text('Middle') + .height('100%') + .width('100%') + .textAlign(TextAlign.Center) + .fontSize(24) + .fontWeight(FontWeight.Bold) + .backgroundColor('#18A98D') + } + .layoutWeight(1) + + Text('Bottom') + .height(60) + .width('100%') + .textAlign(TextAlign.Center) + .fontSize(24) + .fontWeight(FontWeight.Bold) + .backgroundColor('#F69C00') + } + .height(500) + .justifyContent(FlexAlign.SpaceBetween) + } + + build() { + NavDestination() { + Column() { + Button('Show Dialog') + .height(40) + .width('100%') + .onClick(() => { + promptAction.openCustomDialog({ + builder: () => { + this.customDialogComp(); + } + }); + }) + } + .height('100%') + .width('100%') + .justifyContent(FlexAlign.End) + .padding({ + left: 16, + right: 16 + }) + } + .hideTitleBar(true) + .padding({ + top: AppStorage.get('statusBarHeight') ?? 0, + bottom: (AppStorage.get('naviIndicatorHeight') ?? 0) + 16 + }) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question5Correct.ets b/entry/src/main/ets/pages/Question5Correct.ets new file mode 100644 index 0000000000000000000000000000000000000000..63dcbe86f9f9671e63469d5a80b4d9d9292f23df --- /dev/null +++ b/entry/src/main/ets/pages/Question5Correct.ets @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question5CorrectBuilder() { + Question5Correct() +} + +@Component +export struct Question5Correct { + build() { + NavDestination() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text($r('app.string.login_page')) + .fontSize(24) + .fontWeight(FontWeight.Medium) + .fontColor($r('sys.color.font_primary')) + .displayPriority(4) + + Text($r('app.string.login_more')) + .fontSize(16) + .fontColor($r('sys.color.font_secondary')) + .displayPriority(3) + + Image($r('app.media.login_pic')) + .width(200) + .height(200) + .margin({ + bottom: 12, + top: 35 + }) + .displayPriority(2) + + Column() { + TextInput({ placeholder: $r('app.string.account') }) + .maxLength(11) + .type(InputType.Number) + .inputStyle() + + TextInput({ placeholder: $r('app.string.password') }) + .maxLength(8) + .type(InputType.Password) + .inputStyle() + } + .margin({ top: 16 }) + .borderRadius(24) + .displayPriority(5) + + Blank() + .height(24) + .displayPriority(3) + + Button($r('app.string.login')) + .width('100%') + .height(40) + .fontSize(16) + .fontWeight(FontWeight.Medium) + .backgroundColor($r('sys.color.brand')) + .margin({ bottom: 12, top: 16 }) + .displayPriority(5) + } + .height('100%') + .width('100%') + .align(Alignment.Center) + .padding(12) + } + .hideTitleBar(true) + .backgroundColor('#F1F3F5') + .padding({ top: AppStorage.get('statusBarHeight') ?? 0 }) + } +} + +@Extend(TextInput) +function inputStyle() { + .placeholderColor($r('sys.color.font_secondary')) + .height(48) + .fontSize(16) + .backgroundColor(Color.White) + .margin({ top: 4 }) + .padding({ left: 12 }) +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question5Incorrect.ets b/entry/src/main/ets/pages/Question5Incorrect.ets new file mode 100644 index 0000000000000000000000000000000000000000..0dcc30b21ab307010bac4ad9979a520e04cdb556 --- /dev/null +++ b/entry/src/main/ets/pages/Question5Incorrect.ets @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question5IncorrectBuilder() { + Question5Incorrect() +} + +@Component +export struct Question5Incorrect { + build() { + NavDestination() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text($r('app.string.login_page')) + .fontSize(24) + .fontWeight(FontWeight.Medium) + .fontColor($r('sys.color.font_primary')) + .margin({ top: 30 }) + Text($r('app.string.login_more')) + .fontSize(16) + .fontColor($r('sys.color.font_secondary')) + + Image($r('app.media.login_pic')) + .width(200) + .height(200) + .margin({ + bottom: 12, + top: 35 + }) + + Column() { + TextInput({ placeholder: $r('app.string.account') }) + .maxLength(11) + .type(InputType.Number) + .inputStyle() + + Line() + .width('100%') + .height(0.5) + .margin({ + left: 12, + right: 12 + }) + .backgroundColor('#0D182431') + + TextInput({ placeholder: $r('app.string.password') }) + .maxLength(8) + .type(InputType.Password) + .inputStyle() + } + .margin({ top: 16 }) + .borderRadius(24) + + Button($r('app.string.login')) + .width('100%') + .height(40) + .fontSize(16) + .fontWeight(FontWeight.Medium) + .backgroundColor($r('sys.color.brand')) + .margin({ bottom: 12, top: 36 }) + } + .height('100%') + .width('100%') + .align(Alignment.Center) + .padding(12) + } + .hideTitleBar(true) + .backgroundColor('#F1F3F5') + .padding({ top: AppStorage.get('statusBarHeight') ?? 0 }) + } +} + +@Extend(TextInput) +function inputStyle() { + .placeholderColor($r('sys.color.font_secondary')) + .height(48) + .fontSize(16) + .backgroundColor(Color.White) + .margin({ top: 4 }) + .padding({ left: 12 }) +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question6Correct.ets b/entry/src/main/ets/pages/Question6Correct.ets new file mode 100644 index 0000000000000000000000000000000000000000..db65921cae135a169fa64aec6c7dec75f2dffa59 --- /dev/null +++ b/entry/src/main/ets/pages/Question6Correct.ets @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question6CorrectBuilder() { + Question6Correct() +} + +@CustomDialog +struct CustomDialogComp { + controller: CustomDialogController = new CustomDialogController({ 'builder': '' }); + + build() { + Column() { + Text($r('app.string.welcome')) + .fontColor($r('sys.color.font_primary')) + .height(56) + .fontSize(20) + .textAlign(TextAlign.Center) + .fontWeight(700) + + Column() { + Scroll() { + Text($r('app.string.dialog_content')) + .fontSize(18) + .lineHeight(25) + .width('100%') + } + } + .layoutWeight(1) + + Row({ space: 12 }) { + Button($r('app.string.disagree')) + .backgroundColor('rgba(0,0,0,0.05)') + .fontColor('#0A59F7') + .layoutWeight(1) + .height(40) + Button($r('app.string.agree')) + .layoutWeight(1) + .height(40) + } + .height(56) + .alignItems(VerticalAlign.Top) + } + .constraintSize({ + maxHeight: '80%' + }) + .height(400) + .width('calc(100% - 32vp)') + .padding({ + left: 16, + right: 16 + }) + .borderRadius(24) + .backgroundColor(Color.White) + } +} + +@Component +export struct Question6Correct { + dialogController: CustomDialogController = new CustomDialogController({ + builder: CustomDialogComp(), + alignment: DialogAlignment.Center, + customStyle: true, + autoCancel: false + }); + + build() { + NavDestination() { + Column({ space: 20 }) { + Button('Show dialog') + .height(40) + .width('100%') + .onClick(() => { + this.dialogController.open(); + }) + } + .height('100%') + .width('100%') + .justifyContent(FlexAlign.End) + .padding(16) + } + .hideTitleBar(true) + .padding({ + top: AppStorage.get('statusBarHeight') ?? 0, + bottom: AppStorage.get('naviIndicatorHeight') ?? 0 + }) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question6Incorrect.ets b/entry/src/main/ets/pages/Question6Incorrect.ets new file mode 100644 index 0000000000000000000000000000000000000000..c8337e6549bf65a474e8d9cf92b77e8f56324f49 --- /dev/null +++ b/entry/src/main/ets/pages/Question6Incorrect.ets @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question6IncorrectBuilder() { + Question6Incorrect() +} + +@CustomDialog +struct CustomDialogComp1 { + controller: CustomDialogController = new CustomDialogController({ 'builder': '' }); + + build() { + Column() { + Text($r('app.string.welcome')) + .fontColor($r('sys.color.font_primary')) + .height(56) + .fontSize(20) + .textAlign(TextAlign.Center) + .fontWeight(700) + + Column() { + Scroll() { + Text($r('app.string.dialog_content')) + .fontSize(18) + .lineHeight(25) + .width('100%') + } + } + + Row({ space: 12 }) { + Button($r('app.string.disagree')) + .backgroundColor('rgba(0,0,0,0.05)') + .fontColor('#0A59F7') + .layoutWeight(1) + .height(40) + Button($r('app.string.agree')) + .layoutWeight(1) + .height(40) + } + .height(56) + .alignItems(VerticalAlign.Top) + .position({ + bottom: 0, + left: 0 + }) + } + .constraintSize({ + maxHeight: '90%' + }) + .height(400) + .width('calc(100% - 32vp)') + .padding({ + left: 16, + right: 16 + }) + .borderRadius(24) + .backgroundColor(Color.White) + } +} + +@Component +export struct Question6Incorrect { + dialogController: CustomDialogController = new CustomDialogController({ + builder: CustomDialogComp1(), + alignment: DialogAlignment.Center, + customStyle: true, + autoCancel: false + }); + + build() { + NavDestination() { + Column({ space: 20 }) { + Button('Show dialog') + .height(40) + .width('100%') + .onClick(() => { + this.dialogController.open(); + }) + } + .height('100%') + .width('100%') + .justifyContent(FlexAlign.End) + .padding(16) + } + .hideTitleBar(true) + .padding({ + top: AppStorage.get('statusBarHeight') ?? 0, + bottom: AppStorage.get('naviIndicatorHeight') ?? 0 + }) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question7Correct.ets b/entry/src/main/ets/pages/Question7Correct.ets new file mode 100644 index 0000000000000000000000000000000000000000..16c2aa075f7a540d4ea3abd067f0524470d2b235 --- /dev/null +++ b/entry/src/main/ets/pages/Question7Correct.ets @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 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 { common } from '@kit.AbilityKit'; +import { promptAction, window } from '@kit.ArkUI'; + +@Builder +export function Question7CorrectBuilder() { + Question7Correct() +} + +@Component +export struct Question7Correct { + private windowClass = (getContext(this) as common.UIAbilityContext).windowStage.getMainWindowSync(); + @State topSafeHeight: number = 0; + @State windowStatus: WindowStatusType = window.WindowStatusType.FULL_SCREEN; + + aboutToAppear(): void { + this.windowClass.setSpecificSystemBarEnabled('status', false); + this.windowStatus = this.windowClass.getWindowStatus(); + + if (this.windowStatus === window.WindowStatusType.FLOATING) { + this.topSafeHeight = px2vp(this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height); + } + + this.windowClass.on('windowStatusChange', data => { + if (data === window.WindowStatusType.FLOATING) { + this.topSafeHeight = + px2vp(this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height); + } else { + this.topSafeHeight = 0; + } + }) + } + + aboutToDisappear(): void { + this.windowClass.setSpecificSystemBarEnabled('status', true); + } + + build() { + NavDestination() { + Stack() { + Image($r('app.media.game_bg')) + .height('100%') + + Row() { + Image($r('app.media.icon_pause')) + .height(40) + .margin({ + right: 16, + top: this.topSafeHeight + 5 + }) + .onClick(() => { + promptAction.showToast({ + message: 'Action success' + }); + }) + } + .height('100%') + .width('100%') + .justifyContent(FlexAlign.End) + .alignItems(VerticalAlign.Top) + } + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question7Incorrect.ets b/entry/src/main/ets/pages/Question7Incorrect.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ed594ab462c2695d2b81d39942fcfd7e47535e5 --- /dev/null +++ b/entry/src/main/ets/pages/Question7Incorrect.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 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 { common } from '@kit.AbilityKit'; +import { promptAction } from '@kit.ArkUI'; + +@Builder +export function Question7IncorrectBuilder() { + Question7Incorrect() +} + +@Component +export struct Question7Incorrect { + private windowClass = (getContext(this) as common.UIAbilityContext).windowStage.getMainWindowSync(); + + aboutToAppear(): void { + this.windowClass.setSpecificSystemBarEnabled('status', false); + } + + aboutToDisappear(): void { + this.windowClass.setSpecificSystemBarEnabled('status', true); + } + + build() { + NavDestination() { + Stack() { + Image($r('app.media.game_bg')) + .height('100%') + + Row() { + Image($r('app.media.icon_pause')) + .height(40) + .margin({ + right: 16, + top: 5 + }) + .onClick(() => { + promptAction.showToast({ + message: 'Action success' + }); + }) + } + .height('100%') + .width('100%') + .justifyContent(FlexAlign.End) + .alignItems(VerticalAlign.Top) + } + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question8Correct.ets b/entry/src/main/ets/pages/Question8Correct.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2cbd1f9c58a4eed907866acc9370c52021499f5 --- /dev/null +++ b/entry/src/main/ets/pages/Question8Correct.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 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 { common } from '@kit.AbilityKit'; + +@Builder +export function Question8CorrectBuilder() { + Question8Correct() +} + +@Component +export struct Question8Correct { + private windowClass = (getContext(this) as common.UIAbilityContext).windowStage.getMainWindowSync(); + + aboutToAppear(): void { + this.windowClass.enableLandscapeMultiWindow(); + } + + aboutToDisappear(): void { + this.windowClass.disableLandscapeMultiWindow(); + } + + build() { + NavDestination() { + Column() { + Video({ src: $rawfile('testVideo1.mp4') }) + .height('100%') + .width('100%') + .autoPlay(true) + .objectFit(ImageFit.Contain) + .controls(false) + } + .height('100%') + .width('100%') + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/Question8Incorrect.ets b/entry/src/main/ets/pages/Question8Incorrect.ets new file mode 100644 index 0000000000000000000000000000000000000000..18f53351bf2bd98629d3e2bb8fd8bc1d43d9385b --- /dev/null +++ b/entry/src/main/ets/pages/Question8Incorrect.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 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. + */ + +@Builder +export function Question8IncorrectBuilder() { + Question8Incorrect() +} + +@Component +export struct Question8Incorrect { + build() { + NavDestination() { + Column() { + Video({ src: $rawfile('testVideo1.mp4') }) + .height('100%') + .width('100%') + .autoPlay(true) + .objectFit(ImageFit.Contain) + .controls(false) + } + .height('100%') + .width('100%') + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6f79f46e8c81ff6252d45ca62afbe85a9b1b6c00 --- /dev/null +++ b/entry/src/main/module.json5 @@ -0,0 +1,52 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "routerMap": "$profile:route_map", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "preferMultiWindowOrientation": "landscape_auto" + } + ], + "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/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c48f3654eca9c2395f4bf648f2b312061ed350f6 --- /dev/null +++ b/entry/src/main/resources/base/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiWindowPractice" + }, + { + "name": "Question1", + "value": "The page is truncated and cannot be swiped up or down" + }, + { + "name": "Question2", + "value": "XComponent video playback is incomplete" + }, + { + "name": "Question3", + "value": "The video component is truncated in the split-screen state" + }, + { + "name": "Question4", + "value": "The child component is out of scope for the parent component" + }, + { + "name": "Question5", + "value": "The image component has an abnormal ratio in the split-screen state" + }, + { + "name": "Question6", + "value": "The pop-up window is out of order" + }, + { + "name": "Question7", + "value": "The action bar at the top of the overlay window does not respond to actions" + }, + { + "name": "Question8", + "value": "The horizontal floating window is not adapted" + }, + { + "name": "before_optimization", + "value": "Before optimization" + }, + { + "name": "after_optimization", + "value": "After optimization" + }, + { + "name": "login_page", + "value": "Login Page" + }, + { + "name": "login_more", + "value": "Login in to access more services" + }, + { + "name": "account", + "value": "Account" + }, + { + "name": "password", + "value": "Password" + }, + { + "name": "login", + "value": "Login" + }, + { + "name": "welcome", + "value": "Welcome to My App" + }, + { + "name": "dialog_content", + "value": "This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice" + }, + { + "name": "agree", + "value": "Agree" + }, + { + "name": "disagree", + "value": "Disagree" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/media/background.png b/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/entry/src/main/resources/base/media/background.png differ diff --git a/entry/src/main/resources/base/media/foreground.png b/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/entry/src/main/resources/base/media/foreground.png differ diff --git a/entry/src/main/resources/base/media/game_bg.png b/entry/src/main/resources/base/media/game_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..c2b42e424d4828f71a266ba46401647fcc8cf458 Binary files /dev/null and b/entry/src/main/resources/base/media/game_bg.png differ diff --git a/entry/src/main/resources/base/media/icon_pause.svg b/entry/src/main/resources/base/media/icon_pause.svg new file mode 100644 index 0000000000000000000000000000000000000000..9acee8d84e6ed0c09edb45241f533ac4372dafd8 --- /dev/null +++ b/entry/src/main/resources/base/media/icon_pause.svg @@ -0,0 +1,12 @@ + + + Created with Pixso. + + + + + + + + + diff --git a/entry/src/main/resources/base/media/layered_image.json b/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/entry/src/main/resources/base/media/login_pic.png b/entry/src/main/resources/base/media/login_pic.png new file mode 100644 index 0000000000000000000000000000000000000000..d7857938505d025b48286b4cd53a7ebe4d81f6bd Binary files /dev/null and b/entry/src/main/resources/base/media/login_pic.png differ diff --git a/entry/src/main/resources/base/media/startIcon.png b/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/entry/src/main/resources/base/media/startIcon.png differ diff --git a/entry/src/main/resources/base/profile/backup_config.json b/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..55c3f007f87b7ce5206d325f968cc56f2f79441f --- /dev/null +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/profile/route_map.json b/entry/src/main/resources/base/profile/route_map.json new file mode 100644 index 0000000000000000000000000000000000000000..e9d57bccce224cf6e6f16d00d619a844fe33df48 --- /dev/null +++ b/entry/src/main/resources/base/profile/route_map.json @@ -0,0 +1,89 @@ +{ + "routerMap": [ + { + "name": "Question", + "pageSourceFile": "src/main/ets/pages/Question.ets", + "buildFunction": "QuestionBuilder" + }, + { + "name": "Question1Correct", + "pageSourceFile": "src/main/ets/pages/Question1Correct.ets", + "buildFunction": "Question1CorrectBuilder" + }, + { + "name": "Question1Incorrect", + "pageSourceFile": "src/main/ets/pages/Question1Incorrect.ets", + "buildFunction": "Question1IncorrectBuilder" + }, + { + "name": "Question2Correct", + "pageSourceFile": "src/main/ets/pages/Question2Correct.ets", + "buildFunction": "Question2CorrectBuilder" + }, + { + "name": "Question2Incorrect", + "pageSourceFile": "src/main/ets/pages/Question2Incorrect.ets", + "buildFunction": "Question2IncorrectBuilder" + }, + { + "name": "Question3Correct", + "pageSourceFile": "src/main/ets/pages/Question3Correct.ets", + "buildFunction": "Question3CorrectBuilder" + }, + { + "name": "Question3Incorrect", + "pageSourceFile": "src/main/ets/pages/Question3Incorrect.ets", + "buildFunction": "Question3IncorrectBuilder" + }, + { + "name": "Question4Correct", + "pageSourceFile": "src/main/ets/pages/Question4Correct.ets", + "buildFunction": "Question4CorrectBuilder" + }, + { + "name": "Question4Incorrect", + "pageSourceFile": "src/main/ets/pages/Question4Incorrect.ets", + "buildFunction": "Question4IncorrectBuilder" + }, + { + "name": "Question5Correct", + "pageSourceFile": "src/main/ets/pages/Question5Correct.ets", + "buildFunction": "Question5CorrectBuilder" + }, + { + "name": "Question5Incorrect", + "pageSourceFile": "src/main/ets/pages/Question5Incorrect.ets", + "buildFunction": "Question5IncorrectBuilder" + }, + { + "name": "Question6Correct", + "pageSourceFile": "src/main/ets/pages/Question6Correct.ets", + "buildFunction": "Question6CorrectBuilder" + }, + { + "name": "Question6Incorrect", + "pageSourceFile": "src/main/ets/pages/Question6Incorrect.ets", + "buildFunction": "Question6IncorrectBuilder" + }, + { + "name": "Question7Correct", + "pageSourceFile": "src/main/ets/pages/Question7Correct.ets", + "buildFunction": "Question7CorrectBuilder" + }, + { + "name": "Question7Incorrect", + "pageSourceFile": "src/main/ets/pages/Question7Incorrect.ets", + "buildFunction": "Question7IncorrectBuilder" + }, + { + "name": "Question8Correct", + "pageSourceFile": "src/main/ets/pages/Question8Correct.ets", + "buildFunction": "Question8CorrectBuilder" + }, + { + "name": "Question8Incorrect", + "pageSourceFile": "src/main/ets/pages/Question8Incorrect.ets", + "buildFunction": "Question8IncorrectBuilder" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c48f3654eca9c2395f4bf648f2b312061ed350f6 --- /dev/null +++ b/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiWindowPractice" + }, + { + "name": "Question1", + "value": "The page is truncated and cannot be swiped up or down" + }, + { + "name": "Question2", + "value": "XComponent video playback is incomplete" + }, + { + "name": "Question3", + "value": "The video component is truncated in the split-screen state" + }, + { + "name": "Question4", + "value": "The child component is out of scope for the parent component" + }, + { + "name": "Question5", + "value": "The image component has an abnormal ratio in the split-screen state" + }, + { + "name": "Question6", + "value": "The pop-up window is out of order" + }, + { + "name": "Question7", + "value": "The action bar at the top of the overlay window does not respond to actions" + }, + { + "name": "Question8", + "value": "The horizontal floating window is not adapted" + }, + { + "name": "before_optimization", + "value": "Before optimization" + }, + { + "name": "after_optimization", + "value": "After optimization" + }, + { + "name": "login_page", + "value": "Login Page" + }, + { + "name": "login_more", + "value": "Login in to access more services" + }, + { + "name": "account", + "value": "Account" + }, + { + "name": "password", + "value": "Password" + }, + { + "name": "login", + "value": "Login" + }, + { + "name": "welcome", + "value": "Welcome to My App" + }, + { + "name": "dialog_content", + "value": "This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice,This is a user notice" + }, + { + "name": "agree", + "value": "Agree" + }, + { + "name": "disagree", + "value": "Disagree" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/testVideo1.mp4 b/entry/src/main/resources/rawfile/testVideo1.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..a3ff983ced59a4a5fa0bb44b7c2b6ebaab93bc2d Binary files /dev/null and b/entry/src/main/resources/rawfile/testVideo1.mp4 differ diff --git a/entry/src/main/resources/rawfile/testVideo2.mp4 b/entry/src/main/resources/rawfile/testVideo2.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..2d71a4e6b1abd049ed2691d162468bb61f8c65b7 Binary files /dev/null and b/entry/src/main/resources/rawfile/testVideo2.mp4 differ diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b7f9bbcc713a778c291d92baba65a3621df63071 --- /dev/null +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiWindowPractice" + }, + { + "name": "Question1", + "value": "页面被截断,无法上下滑动" + }, + { + "name": "Question2", + "value": "XComponent视频播放显示不全" + }, + { + "name": "Question3", + "value": "Video组件在分屏状态下被截断" + }, + { + "name": "Question4", + "value": "子组件超出父组件范围" + }, + { + "name": "Question5", + "value": "Image组件在分屏状态下比例异常" + }, + { + "name": "Question6", + "value": "弹窗布局错乱" + }, + { + "name": "Question7", + "value": "悬浮窗顶部操作栏无法响应操作" + }, + { + "name": "Question8", + "value": "横屏悬浮窗未适配" + }, + { + "name": "before_optimization", + "value": "优化前" + }, + { + "name": "after_optimization", + "value": "优化后" + }, + { + "name": "login_page", + "value": "登录界面" + }, + { + "name": "login_more", + "value": "登录帐好以使用更多服务" + }, + { + "name": "account", + "value": "帐号" + }, + { + "name": "password", + "value": "密码" + }, + { + "name": "login", + "value": "登录" + }, + { + "name": "welcome", + "value": "欢迎使用我的应用" + }, + { + "name": "dialog_content", + "value": "这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知,这是用户使用须知" + }, + { + "name": "agree", + "value": "同意" + }, + { + "name": "disagree", + "value": "不同意" + } + ] +} \ No newline at end of file diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..06b2783670a348f95533b352c1ceda909a842bbc --- /dev/null +++ b/hvigor/hvigor-config.json5 @@ -0,0 +1,22 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/hvigorfile.ts b/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775 --- /dev/null +++ b/hvigorfile.ts @@ -0,0 +1,6 @@ +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/oh-package.json5 b/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0cec98259052cc175d04dbcf61780de4bc9785f4 --- /dev/null +++ b/oh-package.json5 @@ -0,0 +1,7 @@ +{ + "modelVersion": "5.0.0", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": {} +} diff --git a/screenshots/devices/Question1.png b/screenshots/devices/Question1.png new file mode 100644 index 0000000000000000000000000000000000000000..8afb8aa991ad8b55329a73208f97413a84aedf47 Binary files /dev/null and b/screenshots/devices/Question1.png differ diff --git a/screenshots/devices/Question3.png b/screenshots/devices/Question3.png new file mode 100644 index 0000000000000000000000000000000000000000..1a966d1d1e787aa8c70466b17a3b384a050d5651 Binary files /dev/null and b/screenshots/devices/Question3.png differ diff --git a/screenshots/devices/Question7.png b/screenshots/devices/Question7.png new file mode 100644 index 0000000000000000000000000000000000000000..636bf4e9a7413987ebc2bb8fa16bab46ee132044 Binary files /dev/null and b/screenshots/devices/Question7.png differ