diff --git a/MultiWindowPractice/LICENSE b/AppDataSecurity/LICENSE
similarity index 100%
rename from MultiWindowPractice/LICENSE
rename to AppDataSecurity/LICENSE
diff --git a/AvoidTimeComsume/LICENSE b/AvoidTimeComsume/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0
--- /dev/null
+++ b/AvoidTimeComsume/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/AvoidTimeComsume/code-linter.json5 b/AvoidTimeComsume/code-linter.json5
deleted file mode 100644
index 77b31b517a3e5c2f34c3ae1bf44083c0c06cbd6d..0000000000000000000000000000000000000000
--- a/AvoidTimeComsume/code-linter.json5
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "files": [
- "**/*.ets"
- ],
- "ignore": [
- "**/src/ohosTest/**/*",
- "**/src/test/**/*",
- "**/src/mock/**/*",
- "**/node_modules/**/*",
- "**/oh_modules/**/*",
- "**/build/**/*",
- "**/.preview/**/*"
- ],
- "ruleSet": [
- "plugin:@performance/recommended",
- "plugin:@typescript-eslint/recommended"
- ],
- "rules": {
- }
-}
\ No newline at end of file
diff --git a/AvoidTimeComsume/local.properties b/AvoidTimeComsume/local.properties
deleted file mode 100644
index 20f608699522ce5b5f170457336fbfbf96165c62..0000000000000000000000000000000000000000
--- a/AvoidTimeComsume/local.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-# This file is automatically generated by DevEco Studio.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file should *NOT* be checked into Version Control Systems,
-# as it contains information specific to your local configuration.
-#
-# For customization when using a Version Control System, please read the header note.
-
-
diff --git a/FuzzySceneOptimization/AppScope/app.json5 b/FuzzySceneOptimization/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..f050d50443df2ca2ef23fb10c5078ab59dcc00af
--- /dev/null
+++ b/FuzzySceneOptimization/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.example.fuzzysceneoptimization",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/FuzzySceneOptimization/AppScope/resources/base/element/string.json b/FuzzySceneOptimization/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..7cca12b9c9ca098ec9d980c0747d01643e8fde53
--- /dev/null
+++ b/FuzzySceneOptimization/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "FuzzySceneOptimization"
+ }
+ ]
+}
diff --git a/MultiWindowPractice/AppScope/resources/base/media/app_icon.png b/FuzzySceneOptimization/AppScope/resources/base/media/app_icon.png
similarity index 100%
rename from MultiWindowPractice/AppScope/resources/base/media/app_icon.png
rename to FuzzySceneOptimization/AppScope/resources/base/media/app_icon.png
diff --git a/FuzzySceneOptimization/LICENSE b/FuzzySceneOptimization/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0
--- /dev/null
+++ b/FuzzySceneOptimization/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/FuzzySceneOptimization/README.md b/FuzzySceneOptimization/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..1a7de4bf7ff887690973092c31c15f1da8233135
--- /dev/null
+++ b/FuzzySceneOptimization/README.md
@@ -0,0 +1,59 @@
+# 图像模糊动效优化
+
+### 简介
+
+本示例展示了在“转场结合图片模糊”场景中静态模糊与动态模糊的应用。
+
+### 效果预览
+
+| 动态模糊 | 静态模糊 |
+|----------------------------------------|----------------------------------------|
+| | |
+
+
+### 使用说明
+
+1、父页面点击"motion blur"按钮,跳转子页面MotionBlur。
+
+2、在子页面MotionBlur中,点击"motion blur"按钮拉起图片动态模糊处理后的全屏模态页面。
+
+3、父页面点击"static blur"按钮,跳转子页面StaticBlur。
+
+4、在子页面StaticBlur中,点击"static blur"按钮拉起图片静态模糊处理后的全屏模态页面。
+
+### 工程目录
+```
+├──entry/src/main/ets
+│ ├──entryability
+│ │ └──EntryAbility.ets // Ability的生命周期回调内容
+│ ├──entrybackupability
+│ │ └──EntryBackupAbility.ets // 程序入口类
+│ └──pages
+│ ├──MainPage.ets // 视图层-父页面
+│ ├──MotionBlur.ets // 视图层-动态模糊页面
+│ └──StaticBlur.ets // 视图层-静态模糊页面
+└──entry/src/main/resources // 应用静态资源目录
+```
+
+### 具体实现
+
+1. 动态模糊通过直接对Image组件设置blur,为Image添加模糊效果。
+2. 静态模糊先createPixelMap创建图片的PixelMap,然后createEffect创建Filter实例,最后使用Filter图像效果类中的blur,为Image添加模糊效果。
+
+### 相关权限
+
+不涉及。
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1.本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2.HarmonyOS系统:HarmonyOS NEXT Release及以上。
+
+3.DevEco Studio版本:DevEco Studio NEXT Release及以上。
+
+4.HarmonyOS SDK版本:HarmonyOS NEXT Release SDK及以上。
diff --git a/FuzzySceneOptimization/build-profile.json5 b/FuzzySceneOptimization/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c033ce4278fb0641d84107c3c134047ac487368e
--- /dev/null
+++ b/FuzzySceneOptimization/build-profile.json5
@@ -0,0 +1,35 @@
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.0(12)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/build-profile.json5 b/FuzzySceneOptimization/entry/build-profile.json5
similarity index 93%
rename from MultiWindowPractice/entry/build-profile.json5
rename to FuzzySceneOptimization/entry/build-profile.json5
index 4d611879c7913fb0610c686e2399258ab3a6dad1..b695582d3680556f4cce2ec518f65720a9413ca3 100644
--- a/MultiWindowPractice/entry/build-profile.json5
+++ b/FuzzySceneOptimization/entry/build-profile.json5
@@ -8,7 +8,7 @@
"arkOptions": {
"obfuscation": {
"ruleOptions": {
- "enable": false,
+ "enable": true,
"files": [
"./obfuscation-rules.txt"
]
diff --git a/MultiWindowPractice/entry/hvigorfile.ts b/FuzzySceneOptimization/entry/hvigorfile.ts
similarity index 100%
rename from MultiWindowPractice/entry/hvigorfile.ts
rename to FuzzySceneOptimization/entry/hvigorfile.ts
diff --git a/FuzzySceneOptimization/entry/obfuscation-rules.txt b/FuzzySceneOptimization/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..eb5c766dfc6374b931f6a57b652b5f7675765da1
--- /dev/null
+++ b/FuzzySceneOptimization/entry/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# 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
diff --git a/MultiWindowPractice/entry/oh-package.json5 b/FuzzySceneOptimization/entry/oh-package.json5
similarity index 100%
rename from MultiWindowPractice/entry/oh-package.json5
rename to FuzzySceneOptimization/entry/oh-package.json5
diff --git a/MultiWindowPractice/entry/src/main/ets/common/Logger.ets b/FuzzySceneOptimization/entry/src/main/ets/entryability/EntryAbility.ets
similarity index 33%
rename from MultiWindowPractice/entry/src/main/ets/common/Logger.ets
rename to FuzzySceneOptimization/entry/src/main/ets/entryability/EntryAbility.ets
index f82cad7f847c28c544d3e1588fd34721b9467d93..e8c1e5db6d8cfa8003414ebb28f6a5321f3403ed 100644
--- a/MultiWindowPractice/entry/src/main/ets/common/Logger.ets
+++ b/FuzzySceneOptimization/entry/src/main/ets/entryability/EntryAbility.ets
@@ -13,33 +13,44 @@
* limitations under the License.
*/
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
-class Logger {
- private domain: number;
- private prefix: string;
- private format: string = "%{public}s, %{public}s";
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
- constructor(prefix: string) {
- this.prefix = prefix;
- this.domain = 0xFF00;
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
- debug(...args: Object[]): void {
- hilog.debug(this.domain, this.prefix, this.format, args);
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/MainPage', (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.');
+ });
}
- info(...args: Object[]): void {
- hilog.info(this.domain, this.prefix, this.format, args);
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
- warn(...args: Object[]): void {
- hilog.warn(this.domain, this.prefix, this.format, args);
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
}
- error(...args: Object[]): void {
- hilog.error(this.domain, this.prefix, this.format, args);
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
}
-
-export default new Logger('[MultiWindowPractice]');
diff --git a/MultiWindowPractice/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/FuzzySceneOptimization/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
similarity index 100%
rename from MultiWindowPractice/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
rename to FuzzySceneOptimization/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
diff --git a/MultiWindowPractice/entry/src/main/ets/pages/Question1Incorrect.ets b/FuzzySceneOptimization/entry/src/main/ets/pages/MainPage.ets
similarity index 49%
rename from MultiWindowPractice/entry/src/main/ets/pages/Question1Incorrect.ets
rename to FuzzySceneOptimization/entry/src/main/ets/pages/MainPage.ets
index 3c0e3f69849037447e69159184dd107d4bfa7511..65f883fd66dbfaa3b41bbf5c12e1e0d1f4db6c03 100644
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question1Incorrect.ets
+++ b/FuzzySceneOptimization/entry/src/main/ets/pages/MainPage.ets
@@ -13,41 +13,44 @@
* limitations under the License.
*/
-@Builder
-export function Question1IncorrectBuilder() {
- Question1Incorrect()
-}
+import { MotionBlur } from './MotionBlur';
+import { StaticBlur } from './StaticBlur';
+@Entry
@Component
-export struct Question1Incorrect {
+struct MainPage {
+ @Provide('navPathStack') navPathStack: NavPathStack = new NavPathStack();
+
+ @Builder
+ myRouter(name: string) {
+ if (name === 'MotionBlur') {
+ MotionBlur();
+ } else if (name === 'StaticBlur') {
+ StaticBlur();
+ }
+ }
+
build() {
- NavDestination() {
+ Navigation(this.navPathStack) {
Column({ space: 12 }) {
- Text('Text1')
- .fontSize(50)
+ Button('motion blur')
.width('100%')
- .textAlign(TextAlign.Center)
- .height(350)
- .backgroundColor(Color.Brown)
-
- Text('Text2')
- .fontSize(50)
+ .height(40)
+ .onClick(() => {
+ this.navPathStack.pushPathByName('MotionBlur', null);
+ })
+ Button('static blur')
.width('100%')
- .textAlign(TextAlign.Center)
- .height(350)
- .backgroundColor(Color.Orange)
+ .height(40)
+ .onClick(() => {
+ this.navPathStack.pushPathByName('StaticBlur', null);
+ })
}
.height('100%')
.width('100%')
- .padding({
- left: 16,
- right: 16
- })
+ .padding(16)
+ .justifyContent(FlexAlign.Center)
}
- .hideTitleBar(true)
- .padding({
- top: AppStorage.get('statusBarHeight') ?? 0,
- bottom:( AppStorage.get('naviIndicatorHeight') ?? 0) + 16
- })
+ .navDestination(this.myRouter)
}
}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/src/main/ets/pages/Question4Incorrect.ets b/FuzzySceneOptimization/entry/src/main/ets/pages/MotionBlur.ets
similarity index 39%
rename from MultiWindowPractice/entry/src/main/ets/pages/Question4Incorrect.ets
rename to FuzzySceneOptimization/entry/src/main/ets/pages/MotionBlur.ets
index 0cc00d476eb83260bfc895fab071862361af1144..204041228b5707952f68bc9301d7a007fe3f7328 100644
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question4Incorrect.ets
+++ b/FuzzySceneOptimization/entry/src/main/ets/pages/MotionBlur.ets
@@ -13,75 +13,65 @@
* limitations under the License.
*/
-import { promptAction } from '@kit.ArkUI';
-
-@Builder
-export function Question4IncorrectBuilder() {
- Question4Incorrect()
-}
+import { window } from '@kit.ArkUI';
@Component
-export struct Question4Incorrect {
- @Builder
- customDialogComp() {
- Column() {
- Text('Top')
- .height(60)
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontSize(24)
- .fontWeight(FontWeight.Bold)
- .backgroundColor('#2887DA')
+export struct MotionBlur {
+ @Consume('navPathStack') navPathStack: NavPathStack;
+ @State isShowMotionBlur: boolean = false;
+ @State bottomSafeHeight: number = 0; // bottom navigation bar height
- Scroll() {
- Text('Middle')
- .height('100%')
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontSize(24)
- .fontWeight(FontWeight.Bold)
- .backgroundColor('#18A98D')
+ aboutToAppear() {
+ window.getLastWindow(getContext(this), (err, windowBar) => {
+ if (err.code) {
+ return;
}
- .layoutWeight(1)
+ // get the height of the bottom navigation bar
+ this.bottomSafeHeight =
+ px2vp(windowBar.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect.height);
+ windowBar.setWindowLayoutFullScreen(true);
+ });
+ }
- Text('Bottom')
- .height(60)
+ // modal page with dynamically blurred image settings
+ @Builder
+ motionBlurBuilder() {
+ Stack({ alignContent: Alignment.Bottom }) {
+ Image($r('app.media.test'))
.width('100%')
- .textAlign(TextAlign.Center)
- .fontSize(24)
- .fontWeight(FontWeight.Bold)
- .backgroundColor('#F69C00')
+ .height('100%')
+ .objectFit(ImageFit.Fill)
+ .blur(13) // add motion blur effect
+ Button('close')
+ .width('90%')
+ .height(40)
+ .margin({ bottom: this.bottomSafeHeight + 16 })
+ .onClick(() => {
+ this.isShowMotionBlur = false;
+ })
}
- .height(500)
- .justifyContent(FlexAlign.SpaceBetween)
+ .width('100%')
+ .height('100%')
}
build() {
NavDestination() {
Column() {
- Button('Show Dialog')
+ Button('motion blur')
+ .width('90%')
.height(40)
- .width('100%')
.onClick(() => {
- promptAction.openCustomDialog({
- builder: () => {
- this.customDialogComp();
- }
- });
+ this.isShowMotionBlur = true;
+ })
+ .bindContentCover(this.isShowMotionBlur, this.motionBlurBuilder(), {
+ modalTransition: ModalTransition.DEFAULT
})
}
- .height('100%')
+ .padding({ bottom: this.bottomSafeHeight + 16 })
.width('100%')
+ .height('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/FuzzySceneOptimization/entry/src/main/ets/pages/StaticBlur.ets b/FuzzySceneOptimization/entry/src/main/ets/pages/StaticBlur.ets
new file mode 100644
index 0000000000000000000000000000000000000000..515439f7fc706222a7e6e9455b365e97ff4e3015
--- /dev/null
+++ b/FuzzySceneOptimization/entry/src/main/ets/pages/StaticBlur.ets
@@ -0,0 +1,111 @@
+/*
+ * 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 { image } from '@kit.ImageKit';
+import { effectKit } from '@kit.ArkGraphics2D';
+import { window } from '@kit.ArkUI';
+
+@Component
+export struct StaticBlur {
+ @Consume('navPathStack') navPathStack: NavPathStack;
+ @State isShowStaticBlur: boolean = false;
+ @State pixelMap: image.PixelMap | undefined = undefined;
+ @State imgSource: image.ImageSource | undefined = undefined;
+ @State bottomSafeHeight: number = 0; // bottom navigation bar height
+
+ aboutToAppear() {
+ window.getLastWindow(getContext(this), (err, windowBar) => {
+ if (err.code) {
+ return;
+ }
+ // get the height of the bottom navigation bar
+ this.bottomSafeHeight =
+ px2vp(windowBar.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect.height);
+ windowBar.setWindowLayoutFullScreen(true);
+ });
+ }
+
+ async staticBlur() {
+ let context = getContext(this);
+ let resourceMgr = context.resourceManager; // retrieve the resourceManager object
+ const fileData = await resourceMgr.getRawFileContent('test.png'); // retrieve images from the rawfile directory
+ let buffer: ArrayBuffer = fileData.buffer.slice(0); // create an ArrayBuffer instance
+ this.imgSource = image.createImageSource(buffer); // create an image source instance
+ // create attributes for pixels
+ let opts: image.InitializationOptions = {
+ editable: true, // is it editable
+ pixelFormat: 3, // pixel format. 3 represents RGBA_8888
+ size: {
+ // create image size
+ height: 4,
+ width: 6
+ }
+ };
+ // create PixelMap
+ await this.imgSource.createPixelMap(opts).then((pixelMap: image.PixelMap) => {
+ const blurRadius = 3;
+ let headFilter = effectKit.createEffect(pixelMap); // create Filter Instance
+ if (headFilter !== null) {
+ headFilter.blur(blurRadius); // set static blur. Add the blur effect to the effect list
+ // retrieve the image of the source image with the added linked list effect PixelMap
+ headFilter.getEffectPixelMap().then((pixelMap: image.PixelMap) => {
+ this.pixelMap = pixelMap;
+ });
+ }
+ })
+ }
+
+ @Builder
+ staticBlurBuilder() {
+ Stack({ alignContent: Alignment.Bottom }) {
+ Image(this.pixelMap)
+ .width('100%')
+ .height('100%')
+ .objectFit(ImageFit.Fill)
+ Button('close')
+ .width('90%')
+ .height(40)
+ .margin({ bottom: this.bottomSafeHeight + 16 })
+ .onClick(() => {
+ this.isShowStaticBlur = false;
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+
+ build() {
+ NavDestination() {
+ Column() {
+ Button('static blur')
+ .width('90%')
+ .height(40)
+ .onClick(() => {
+ this.isShowStaticBlur = true;
+ // set static blur
+ this.staticBlur();
+ })
+ .bindContentCover(this.isShowStaticBlur, this.staticBlurBuilder(), {
+ modalTransition: ModalTransition.DEFAULT
+ })
+ }
+ .padding({ bottom: this.bottomSafeHeight + 16 })
+ .width('100%')
+ .height('100%')
+ .justifyContent(FlexAlign.End)
+ }
+ .hideTitleBar(true)
+ }
+}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/src/main/module.json5 b/FuzzySceneOptimization/entry/src/main/module.json5
similarity index 92%
rename from MultiWindowPractice/entry/src/main/module.json5
rename to FuzzySceneOptimization/entry/src/main/module.json5
index 6f79f46e8c81ff6252d45ca62afbe85a9b1b6c00..ad219d733f6afa5ea07f85f580208b08cc3b9041 100644
--- a/MultiWindowPractice/entry/src/main/module.json5
+++ b/FuzzySceneOptimization/entry/src/main/module.json5
@@ -10,7 +10,6 @@
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
- "routerMap": "$profile:route_map",
"abilities": [
{
"name": "EntryAbility",
@@ -30,8 +29,7 @@
"action.system.home"
]
}
- ],
- "preferMultiWindowOrientation": "landscape_auto"
+ ]
}
],
"extensionAbilities": [
@@ -45,7 +43,7 @@
"name": "ohos.extension.backup",
"resource": "$profile:backup_config"
}
- ]
+ ],
}
]
}
diff --git a/MultiWindowPractice/entry/src/main/resources/base/element/color.json b/FuzzySceneOptimization/entry/src/main/resources/base/element/color.json
similarity index 100%
rename from MultiWindowPractice/entry/src/main/resources/base/element/color.json
rename to FuzzySceneOptimization/entry/src/main/resources/base/element/color.json
diff --git a/FuzzySceneOptimization/entry/src/main/resources/base/element/string.json b/FuzzySceneOptimization/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..70ee4276fd7158c44cde053fc429e0fa0d831f37
--- /dev/null
+++ b/FuzzySceneOptimization/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "FuzzySceneOptimization"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/src/main/resources/base/media/background.png b/FuzzySceneOptimization/entry/src/main/resources/base/media/background.png
similarity index 100%
rename from MultiWindowPractice/entry/src/main/resources/base/media/background.png
rename to FuzzySceneOptimization/entry/src/main/resources/base/media/background.png
diff --git a/MultiWindowPractice/entry/src/main/resources/base/media/foreground.png b/FuzzySceneOptimization/entry/src/main/resources/base/media/foreground.png
similarity index 100%
rename from MultiWindowPractice/entry/src/main/resources/base/media/foreground.png
rename to FuzzySceneOptimization/entry/src/main/resources/base/media/foreground.png
diff --git a/MultiWindowPractice/entry/src/main/resources/base/media/layered_image.json b/FuzzySceneOptimization/entry/src/main/resources/base/media/layered_image.json
similarity index 100%
rename from MultiWindowPractice/entry/src/main/resources/base/media/layered_image.json
rename to FuzzySceneOptimization/entry/src/main/resources/base/media/layered_image.json
diff --git a/MultiWindowPractice/entry/src/main/resources/base/media/startIcon.png b/FuzzySceneOptimization/entry/src/main/resources/base/media/startIcon.png
similarity index 100%
rename from MultiWindowPractice/entry/src/main/resources/base/media/startIcon.png
rename to FuzzySceneOptimization/entry/src/main/resources/base/media/startIcon.png
diff --git a/FuzzySceneOptimization/entry/src/main/resources/base/media/test.png b/FuzzySceneOptimization/entry/src/main/resources/base/media/test.png
new file mode 100644
index 0000000000000000000000000000000000000000..1683fd99ffefa7ff4181f911e27a2888a120bce8
Binary files /dev/null and b/FuzzySceneOptimization/entry/src/main/resources/base/media/test.png differ
diff --git a/MultiWindowPractice/entry/src/main/resources/base/profile/backup_config.json b/FuzzySceneOptimization/entry/src/main/resources/base/profile/backup_config.json
similarity index 100%
rename from MultiWindowPractice/entry/src/main/resources/base/profile/backup_config.json
rename to FuzzySceneOptimization/entry/src/main/resources/base/profile/backup_config.json
diff --git a/FuzzySceneOptimization/entry/src/main/resources/base/profile/main_pages.json b/FuzzySceneOptimization/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..f4241ef2f72e78047b4c449d92bd1a92accc39fb
--- /dev/null
+++ b/FuzzySceneOptimization/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/MainPage"
+ ]
+}
diff --git a/FuzzySceneOptimization/entry/src/main/resources/en_US/element/string.json b/FuzzySceneOptimization/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..70ee4276fd7158c44cde053fc429e0fa0d831f37
--- /dev/null
+++ b/FuzzySceneOptimization/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "FuzzySceneOptimization"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/FuzzySceneOptimization/entry/src/main/resources/rawfile/test.png b/FuzzySceneOptimization/entry/src/main/resources/rawfile/test.png
new file mode 100644
index 0000000000000000000000000000000000000000..1683fd99ffefa7ff4181f911e27a2888a120bce8
Binary files /dev/null and b/FuzzySceneOptimization/entry/src/main/resources/rawfile/test.png differ
diff --git a/FuzzySceneOptimization/entry/src/main/resources/zh_CN/element/string.json b/FuzzySceneOptimization/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..931ea5a7c252c2a8b82e106632abb7a0bf349074
--- /dev/null
+++ b/FuzzySceneOptimization/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "FuzzySceneOptimization"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultiWindowPractice/hvigor/hvigor-config.json5 b/FuzzySceneOptimization/hvigor/hvigor-config.json5
similarity index 100%
rename from MultiWindowPractice/hvigor/hvigor-config.json5
rename to FuzzySceneOptimization/hvigor/hvigor-config.json5
diff --git a/MultiWindowPractice/hvigorfile.ts b/FuzzySceneOptimization/hvigorfile.ts
similarity index 100%
rename from MultiWindowPractice/hvigorfile.ts
rename to FuzzySceneOptimization/hvigorfile.ts
diff --git a/MultiWindowPractice/oh-package.json5 b/FuzzySceneOptimization/oh-package.json5
similarity index 100%
rename from MultiWindowPractice/oh-package.json5
rename to FuzzySceneOptimization/oh-package.json5
diff --git a/FuzzySceneOptimization/screenshots/devices/motion_blur.gif b/FuzzySceneOptimization/screenshots/devices/motion_blur.gif
new file mode 100644
index 0000000000000000000000000000000000000000..873a93acb538252f5dd037063ad8a3622a921981
Binary files /dev/null and b/FuzzySceneOptimization/screenshots/devices/motion_blur.gif differ
diff --git a/MultiWindowPractice/entry/src/main/resources/rawfile/testVideo1.mp4 b/FuzzySceneOptimization/screenshots/devices/static_blur.gif
similarity index 32%
rename from MultiWindowPractice/entry/src/main/resources/rawfile/testVideo1.mp4
rename to FuzzySceneOptimization/screenshots/devices/static_blur.gif
index a3ff983ced59a4a5fa0bb44b7c2b6ebaab93bc2d..2c86a59459ff049ec99266fcf7ee0d968f32ba1e 100644
Binary files a/MultiWindowPractice/entry/src/main/resources/rawfile/testVideo1.mp4 and b/FuzzySceneOptimization/screenshots/devices/static_blur.gif differ
diff --git a/MultiWindowPractice/README.md b/MultiWindowPractice/README.md
deleted file mode 100644
index 28d2fe9b7848fcbc6051389171e75a864a30ad9b..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/README.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# 智慧多窗开发实践
-
-### 介绍
-
-本示例展示了智慧多窗(分屏/悬浮窗)开发过程中界面适配问题的解决方案。
-
-### 效果预览
-
-部分效果图如下
-
-| 页面被截断无法上下滑动 问题优化 | Video组件分屏状态下被截断 问题优化 | 子组件超出父组件范围 问题优化 | 悬浮窗顶部操作栏无法响应操作 问题优化 |
-|:------------------------------------------------------------------------------:|:------------------------------------------------------------------------------:|:------------------------------------------------------------------------------:|:------------------------------------------------------------------------------:|
-| | | | |
-
-### 目录结构
-
-```
-├──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.本示例仅支持标准系统上运行,支持设备:华为手机。
-
-2.HarmonyOS系统:HarmonyOS NEXT Release及以上。
-
-3.DevEco Studio版本:DevEco Studio NEXT Release及以上。
-
-4.HarmonyOS SDK版本:HarmonyOS NEXT Release SDK及以上。
-
-
-
diff --git a/MultiWindowPractice/entry/src/main/ets/common/AVPlayerUtil.ets b/MultiWindowPractice/entry/src/main/ets/common/AVPlayerUtil.ets
deleted file mode 100644
index e408fc2f521c9d0962e54e479180ef636b9b2bdf..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/common/AVPlayerUtil.ets
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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(height / width);
- })
- }
- }
-
- 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/MultiWindowPractice/entry/src/main/ets/common/Constants.ets b/MultiWindowPractice/entry/src/main/ets/common/Constants.ets
deleted file mode 100644
index 5f4d877ca7613c5531edec07ac0896a268350233..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/common/Constants.ets
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Index.ets b/MultiWindowPractice/entry/src/main/ets/pages/Index.ets
deleted file mode 100644
index 33b2d8df22065a80dd1f5fc805510da04d776a58..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Index.ets
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question1Correct.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question1Correct.ets
deleted file mode 100644
index db2c40371e39282223a6b0a756cc654d5def8edf..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question1Correct.ets
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question2Correct.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question2Correct.ets
deleted file mode 100644
index 7fd553233a2b71659d751a4f05b6982f95b26b29..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question2Correct.ets
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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 { display } from '@kit.ArkUI';
-import { AVPlayerUtil } from '../common/AVPlayerUtil';
-
-const context: Context = getContext(this);
-
-@Builder
-export function Question2CorrectBuilder() {
- Question2Correct()
-}
-
-@Component
-export struct Question2Correct {
- @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;
- private windowClass = (context as common.UIAbilityContext).windowStage.getMainWindowSync();
-
- aboutToAppear(): void {
- this.windowClass.on('windowSizeChange', () => {
- this.calculateVideoSize();
- });
- }
-
- aboutToDisappear(): void {
- this.player?.stopPlay();
- }
-
- calculateVideoSize() {
- let size = this.windowClass.getWindowProperties().windowRect;
- let windowWidth = px2vp(size.width);
- let windowHeight = px2vp(size.height);
- if (windowWidth * this.aspect > windowHeight) {
- this.xComponentHeight = windowHeight;
- this.xComponentWidth = windowHeight / this.aspect;
- } else {
- this.xComponentHeight = windowHeight * this.aspect;
- this.xComponentWidth = windowWidth;
- }
- }
-
- 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.calculateVideoSize();
- });
- })
- .width(this.xComponentWidth)
- .height(this.xComponentHeight)
- }
- .width('100%')
- .height('100%')
- .backgroundColor(Color.Black)
- }
- .hideTitleBar(true)
- }
-}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/src/main/ets/pages/Question2Incorrect.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question2Incorrect.ets
deleted file mode 100644
index f7d11536b7d9ad738298fbd351272ab0862b39ba..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question2Incorrect.ets
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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().width * aspect);
- this.xComponentWidth = px2vp(display.getDefaultDisplaySync().width);
- });
- })
- .width(this.xComponentWidth)
- .height(this.xComponentHeight)
- }
- .width('100%')
- .height('100%')
- .backgroundColor(Color.Black)
- }
- .hideTitleBar(true)
- }
-}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/src/main/ets/pages/Question3Correct.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question3Correct.ets
deleted file mode 100644
index bb8072199302d22fc2e250ec2c1b7bc6441a1697..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question3Correct.ets
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question5Correct.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question5Correct.ets
deleted file mode 100644
index 35f5f3b7f000d402a91e3efe67c043e5f5b34a02..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question5Correct.ets
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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 { window } from '@kit.ArkUI';
-
-@Builder
-export function Question5CorrectBuilder() {
- Question5Correct()
-}
-
-@Component
-export struct Question5Correct {
- @State windowStatus: WindowStatusType = window.WindowStatusType.FULL_SCREEN;
-
- aboutToAppear(): void {
- let windowClass = (getContext(this) as common.UIAbilityContext).windowStage.getMainWindowSync();
- this.windowStatus = windowClass.getWindowStatus();
- windowClass.on('windowStatusChange', data => {
- this.windowStatus = data;
- })
- }
-
- 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: this.windowStatus === window.WindowStatusType.FULL_SCREEN ? 30 : 0 })
-
- if (this.windowStatus === window.WindowStatusType.FULL_SCREEN) {
- 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/MultiWindowPractice/entry/src/main/ets/pages/Question5Incorrect.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question5Incorrect.ets
deleted file mode 100644
index 0dcc30b21ab307010bac4ad9979a520e04cdb556..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question5Incorrect.ets
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question6Correct.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question6Correct.ets
deleted file mode 100644
index db65921cae135a169fa64aec6c7dec75f2dffa59..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question6Correct.ets
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question6Incorrect.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question6Incorrect.ets
deleted file mode 100644
index c8337e6549bf65a474e8d9cf92b77e8f56324f49..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question6Incorrect.ets
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question7Correct.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question7Correct.ets
deleted file mode 100644
index 16c2aa075f7a540d4ea3abd067f0524470d2b235..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question7Correct.ets
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question7Incorrect.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question7Incorrect.ets
deleted file mode 100644
index 7ed594ab462c2695d2b81d39942fcfd7e47535e5..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question7Incorrect.ets
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question8Correct.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question8Correct.ets
deleted file mode 100644
index c2cbd1f9c58a4eed907866acc9370c52021499f5..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question8Correct.ets
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/ets/pages/Question8Incorrect.ets b/MultiWindowPractice/entry/src/main/ets/pages/Question8Incorrect.ets
deleted file mode 100644
index 18f53351bf2bd98629d3e2bb8fd8bc1d43d9385b..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question8Incorrect.ets
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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/MultiWindowPractice/entry/src/main/resources/base/element/string.json b/MultiWindowPractice/entry/src/main/resources/base/element/string.json
deleted file mode 100644
index c48f3654eca9c2395f4bf648f2b312061ed350f6..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/resources/base/element/string.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "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/MultiWindowPractice/entry/src/main/resources/base/media/game_bg.png b/MultiWindowPractice/entry/src/main/resources/base/media/game_bg.png
deleted file mode 100644
index c2b42e424d4828f71a266ba46401647fcc8cf458..0000000000000000000000000000000000000000
Binary files a/MultiWindowPractice/entry/src/main/resources/base/media/game_bg.png and /dev/null differ
diff --git a/MultiWindowPractice/entry/src/main/resources/base/media/icon_pause.svg b/MultiWindowPractice/entry/src/main/resources/base/media/icon_pause.svg
deleted file mode 100644
index 9acee8d84e6ed0c09edb45241f533ac4372dafd8..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/resources/base/media/icon_pause.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/MultiWindowPractice/entry/src/main/resources/base/media/login_pic.png b/MultiWindowPractice/entry/src/main/resources/base/media/login_pic.png
deleted file mode 100644
index d7857938505d025b48286b4cd53a7ebe4d81f6bd..0000000000000000000000000000000000000000
Binary files a/MultiWindowPractice/entry/src/main/resources/base/media/login_pic.png and /dev/null differ
diff --git a/MultiWindowPractice/entry/src/main/resources/base/profile/route_map.json b/MultiWindowPractice/entry/src/main/resources/base/profile/route_map.json
deleted file mode 100644
index e9d57bccce224cf6e6f16d00d619a844fe33df48..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/resources/base/profile/route_map.json
+++ /dev/null
@@ -1,89 +0,0 @@
-{
- "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/MultiWindowPractice/entry/src/main/resources/en_US/element/string.json b/MultiWindowPractice/entry/src/main/resources/en_US/element/string.json
deleted file mode 100644
index c48f3654eca9c2395f4bf648f2b312061ed350f6..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/resources/en_US/element/string.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "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/MultiWindowPractice/entry/src/main/resources/zh_CN/element/string.json b/MultiWindowPractice/entry/src/main/resources/zh_CN/element/string.json
deleted file mode 100644
index b7f9bbcc713a778c291d92baba65a3621df63071..0000000000000000000000000000000000000000
--- a/MultiWindowPractice/entry/src/main/resources/zh_CN/element/string.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "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/MultiWindowPractice/screenshots/devices/Question1.png b/MultiWindowPractice/screenshots/devices/Question1.png
deleted file mode 100644
index 8afb8aa991ad8b55329a73208f97413a84aedf47..0000000000000000000000000000000000000000
Binary files a/MultiWindowPractice/screenshots/devices/Question1.png and /dev/null differ
diff --git a/MultiWindowPractice/screenshots/devices/Question3.png b/MultiWindowPractice/screenshots/devices/Question3.png
deleted file mode 100644
index 1a966d1d1e787aa8c70466b17a3b384a050d5651..0000000000000000000000000000000000000000
Binary files a/MultiWindowPractice/screenshots/devices/Question3.png and /dev/null differ
diff --git a/MultiWindowPractice/screenshots/devices/Question4.png b/MultiWindowPractice/screenshots/devices/Question4.png
deleted file mode 100644
index bf4af20223f8621a8397ffa84f23bd5e7d1b9e64..0000000000000000000000000000000000000000
Binary files a/MultiWindowPractice/screenshots/devices/Question4.png and /dev/null differ
diff --git a/MultiWindowPractice/screenshots/devices/Question7.png b/MultiWindowPractice/screenshots/devices/Question7.png
deleted file mode 100644
index 636bf4e9a7413987ebc2bb8fa16bab46ee132044..0000000000000000000000000000000000000000
Binary files a/MultiWindowPractice/screenshots/devices/Question7.png and /dev/null differ
diff --git a/MultiWindowPractice/AppScope/app.json5 b/NetworkManagement/AppScope/app.json5
similarity index 75%
rename from MultiWindowPractice/AppScope/app.json5
rename to NetworkManagement/AppScope/app.json5
index 446a13a2660048da29764b7a223119ddd834a612..56be1b14223c7c167684981d5f639aa8f2d4e698 100644
--- a/MultiWindowPractice/AppScope/app.json5
+++ b/NetworkManagement/AppScope/app.json5
@@ -1,6 +1,6 @@
{
"app": {
- "bundleName": "com.example.multiwindowpractice",
+ "bundleName": "com.example.networkmanagement",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
diff --git a/MultiWindowPractice/AppScope/resources/base/element/string.json b/NetworkManagement/AppScope/resources/base/element/string.json
similarity index 61%
rename from MultiWindowPractice/AppScope/resources/base/element/string.json
rename to NetworkManagement/AppScope/resources/base/element/string.json
index b35095cafeeb19d91bf39a64eee25b7af234843e..2986afea96c407cf7fc13cc13b68da919622b7ee 100644
--- a/MultiWindowPractice/AppScope/resources/base/element/string.json
+++ b/NetworkManagement/AppScope/resources/base/element/string.json
@@ -2,7 +2,7 @@
"string": [
{
"name": "app_name",
- "value": "MultiWindowPractice"
+ "value": "NetworkManagement"
}
]
}
diff --git a/NetworkManagement/AppScope/resources/base/media/app_icon.png b/NetworkManagement/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/NetworkManagement/AppScope/resources/base/media/app_icon.png differ
diff --git a/NetworkManagement/LICENSE b/NetworkManagement/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0
--- /dev/null
+++ b/NetworkManagement/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/NetworkManagement/README.md b/NetworkManagement/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..ddc574f031406b37156319959c65ee79a5980c8f
--- /dev/null
+++ b/NetworkManagement/README.md
@@ -0,0 +1,58 @@
+# **网络管理与状态监听**
+## 介绍
+日常生活中,经常会使用网络。网络质量在不同场景下会有所变化,当使用场景发生变化时,需要对网络状态进行监听,如查询当前网络是否可用、判断网络质量的优劣等,并据此做出切换网络或提示用户等操作,从而提升用户体验。
+## 预览效果
+
+## 工程目录
+```
+├──entry/src/main/ets // 代码区
+│ ├──entryability
+│ │ └──EntryAbility.ets // 程序入口类
+│ ├──entrybackupability
+│ │ └──EntryBackupAbility.ets
+│ └──pages
+│ ├──CellularNetworkQuery.ets // 蜂窝网络查询页
+│ ├──GetCurrentNetworkInfo.ets // 当前网络信息查询页
+│ ├──GetNetworkConnectionInfo.ets // 网络连接信息查询页
+│ ├──Index.ets // 首页
+│ ├──ListeningNetworkStatus.ets // 网络状态监听页
+│ └──WiFiQuery.ets // WiFi网络查询页
+└──entry/src/main/resources // 应用资源目录
+```
+## 使用说明
+运行程序,点击“查询网络连接信息”按钮,进入页面后,可查询当前网络连接类型、查询当前网络是否可用、查询网络路由信息、网络链路信息。
+
+点击“查询当前网络信息”按钮,进入页面后,可进行蜂窝网络相关查询和WiFi网络相关查询。
+
+点击“网络状态监听”按钮,进入页面后, 点击视频左下方的播放按键,视频会开始播放。然后可以执行下方的操作:
+
+* 点击“模拟网络不可用”按钮时,模拟当前网络不可正常使用的场景,若视频正在播放,此时会暂停视频播放,并弹出相应提示。
+
+* 点击“模拟网络丢失”按钮时,模拟网络连接丢失的场景,若视频正在播放,此时会暂停视频播放,并弹出相应提示。
+
+* 点击“模拟弱网环境”按钮时,模拟当前处于弱网环境,若视频正在播放,此时会暂停视频播放,并弹出相应提示。
+
+* 点击“模拟模拟网络低质量环境”按钮时,模拟当前处于网络低质量环境,若视频正在播放,此时会暂停视频播放,并弹出相应提示。
+
+* 点击“切换视频到低清晰度”按钮时,会切换当前视频到更低的清晰度,当网络质量差的情况下可自行切换。
+
+* 点击“切换视频到高清晰度”按钮时,会切换当前视频到较高的清晰度,当网络质量好的情况下可自行切换。
+
+注:此示例代码使用的是加载本地视频的方式,开发时,可以根据需要使用其他加载视频资源的方式,如加载沙箱路径视频、加载网络视频。具体请参见:[加载视频资源](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-common-components-video-player-V5#加载视频资源)
+## 相关权限
+
+* ohos.permission.SET_WIFI_INFO 设置WIFI信息
+
+
+* ohos.permission.GET_WIFI_INFO 获取WIFI信息
+
+
+* ohos.permission.GET_NETWORK_INFO 获取网络信息
+## 约束与限制
+* 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+* HarmonyOS系统:HarmonyOS NEXT Release及以上。
+
+* DevEco Studio版本:DevEco Studio NEXT Release及以上。
+
+* HarmonyOS SDK版本:HarmonyOS NEXT Release SDK及以上。
\ No newline at end of file
diff --git a/MultiWindowPractice/build-profile.json5 b/NetworkManagement/build-profile.json5
similarity index 95%
rename from MultiWindowPractice/build-profile.json5
rename to NetworkManagement/build-profile.json5
index 080fd5dc2df3a9b68aaa72f170efde91d56f7f7a..fa7eee97c4c4a03703690c00d450e612f3c76784 100644
--- a/MultiWindowPractice/build-profile.json5
+++ b/NetworkManagement/build-profile.json5
@@ -1,6 +1,7 @@
{
"app": {
- "signingConfigs": [],
+ "signingConfigs": [
+ ],
"products": [
{
"name": "default",
diff --git a/NetworkManagement/entry/build-profile.json5 b/NetworkManagement/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0311b505dbf43f0d22662c8d783c5f4464d15b15
--- /dev/null
+++ b/NetworkManagement/entry/build-profile.json5
@@ -0,0 +1,25 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/NetworkManagement/entry/hvigorfile.ts b/NetworkManagement/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3
--- /dev/null
+++ b/NetworkManagement/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/MultiWindowPractice/entry/obfuscation-rules.txt b/NetworkManagement/entry/obfuscation-rules.txt
similarity index 100%
rename from MultiWindowPractice/entry/obfuscation-rules.txt
rename to NetworkManagement/entry/obfuscation-rules.txt
diff --git a/NetworkManagement/entry/oh-package.json5 b/NetworkManagement/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a
--- /dev/null
+++ b/NetworkManagement/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/MultiWindowPractice/entry/src/main/ets/entryability/EntryAbility.ets b/NetworkManagement/entry/src/main/ets/entryability/EntryAbility.ets
similarity index 79%
rename from MultiWindowPractice/entry/src/main/ets/entryability/EntryAbility.ets
rename to NetworkManagement/entry/src/main/ets/entryability/EntryAbility.ets
index 0702d292035b126055fc19f6456c3fd8d76eac76..217744d8eb6d893e1138cd660209ce4d0441ac4f 100644
--- a/MultiWindowPractice/entry/src/main/ets/entryability/EntryAbility.ets
+++ b/NetworkManagement/entry/src/main/ets/entryability/EntryAbility.ets
@@ -30,13 +30,6 @@ export default class EntryAbility extends UIAbility {
// 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) ?? '');
diff --git a/MultiWindowPractice/entry/src/main/ets/pages/Question3Incorrect.ets b/NetworkManagement/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
similarity index 59%
rename from MultiWindowPractice/entry/src/main/ets/pages/Question3Incorrect.ets
rename to NetworkManagement/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
index bfe6cdf1c419b9b19e9266a38f4f88952d52d83e..6b744d7eaa66e51e79fc4e0896e251292ee767c5 100644
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question3Incorrect.ets
+++ b/NetworkManagement/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -13,25 +13,15 @@
* limitations under the License.
*/
-@Builder
-export function Question3IncorrectBuilder() {
- Question3Incorrect()
-}
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
-@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)
+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/NetworkManagement/entry/src/main/ets/pages/CellularNetworkQuery.ets b/NetworkManagement/entry/src/main/ets/pages/CellularNetworkQuery.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f06946d71710fa94953b5731c470c03d6e00899f
--- /dev/null
+++ b/NetworkManagement/entry/src/main/ets/pages/CellularNetworkQuery.ets
@@ -0,0 +1,142 @@
+/*
+ * 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 { BusinessError } from '@kit.BasicServicesKit';
+import { radio } from '@kit.TelephonyKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+
+@Builder
+export function CellularNetworkQueryBuilder() {
+ CellularNetworkQuery()
+}
+
+@Component
+export struct CellularNetworkQuery {
+ @State text: ResourceStr = '';
+ @State textArea: string = '';
+
+ // DocsCode 1
+ getNetworkStatus() {
+ radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => {
+ if (err) {
+ hilog.error(0x0000, 'Sample', 'getNetworkState failed, callback: err->: %{public}s', JSON.stringify(err));
+ return;
+ }
+ hilog.info(0x0000, 'Sample', 'getNetworkState success, callback: data->: %{public}s', JSON.stringify(data));
+ // DocsDot
+ this.textArea = `getNetworkState success, callback: data->${JSON.stringify(data)}`;
+ // DocsDot
+ });
+ }
+
+ // DocsCode 1
+
+ // DocsCode 2
+ getSignalType() {
+ let slotId: number = 0;
+ radio.getSignalInformation(slotId, (err: BusinessError, data: Array) => {
+ if (err) {
+ hilog.error(0x0000, 'Sample', 'getSignalInformation failed, callback: err->: %{public}s', JSON.stringify(err));
+ return;
+ }
+ hilog.info(0x0000, 'Sample', 'getSignalInformation success, callback: data->: %{public}s', JSON.stringify(data));
+ let signalType = data[0]?.signalType;
+ // DocsDot
+ this.textArea = `signalType is: ${signalType}`;
+ // DocsDot
+ });
+ }
+
+ // DocsCode 2
+
+ // DocsCode 3
+ getRadioStatus() {
+ radio.isRadioOn((err: BusinessError, data: boolean) => {
+ if (err) {
+ hilog.error(0x0000, 'Sample', 'isRadioOn failed, callback: err->: %{public}s', JSON.stringify(err));
+ // DocsDot
+ this.textArea = `isRadioOn failed, callback: err->${JSON.stringify(err)}`;
+ // DocsDot
+ return;
+ }
+ hilog.info(0x0000, 'Sample', 'isRadioOn success, callback: data->: %{public}s', JSON.stringify(data));
+ // DocsDot
+ this.textArea = `isRadioOn success, callback: data->${JSON.stringify(data)}`;
+ // DocsDot
+ });
+ }
+
+ // DocsCode 3
+
+ @Builder
+ NavDestinationTitle() {
+ Column() {
+ Text($r('app.string.cellular_network_query'))
+ .fontSize(20)
+ .lineHeight(40)
+ .fontWeight(700)
+ .width('100%')
+ .padding({ left: 12 })
+ }
+ .width('100%')
+ }
+
+ build() {
+ NavDestination() {
+ Column() {
+ Column() {
+ Text(this.text)
+ .margin({ bottom: 12 })
+ .textAlign(TextAlign.Start)
+ .width('100%')
+ .height(20)
+ TextArea({ text: this.textArea })
+ .width('100%')
+ .height('45%')
+ .focusable(false)
+ }
+
+ Column({ space: 12 }) {
+ Button($r('app.string.get_network_status'))
+ .onClick(() => {
+ this.text = $r('app.string.current_network_status');
+ this.getNetworkStatus();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.check_current_network'))
+ .onClick(() => {
+ this.text = $r('app.string.current_network');
+ this.getSignalType();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.check_radio_status'))
+ .onClick(() => {
+ this.text = $r('app.string.radio_status');
+ this.getRadioStatus();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ }
+ }
+ .width('100%')
+ .height('100%')
+ .justifyContent(FlexAlign.SpaceBetween)
+ .padding(16)
+ }
+ .title(this.NavDestinationTitle())
+ }
+}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/src/main/ets/pages/Question.ets b/NetworkManagement/entry/src/main/ets/pages/GetCurrentNetworkInfo.ets
similarity index 45%
rename from MultiWindowPractice/entry/src/main/ets/pages/Question.ets
rename to NetworkManagement/entry/src/main/ets/pages/GetCurrentNetworkInfo.ets
index ee98145a930c15e1c6ad6662f99781fd9e3982a2..3ce94af885f7b7d497059fe2f1c7df320ecfb8a0 100644
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question.ets
+++ b/NetworkManagement/entry/src/main/ets/pages/GetCurrentNetworkInfo.ets
@@ -13,52 +13,54 @@
* limitations under the License.
*/
-import { Constants } from '../common/Constants';
-
@Builder
-export function QuestionBuilder() {
- Question()
+export function GetCurrentNetworkInfoBuilder() {
+ GetCurrentNetworkInfo()
}
+@Entry
@Component
-export struct Question {
- @Consume('navPathStack') navPathStack: NavPathStack;
- @State title: string = '';
- @State questionTag: number = 0;
+struct GetCurrentNetworkInfo {
+ @State text: string = '';
+ @State textArea: string = '';
+ pathStack: NavPathStack = new NavPathStack();
- 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);
+ @Builder
+ NavDestinationTitle() {
+ Column() {
+ Text($r('app.string.query_current_network_information'))
+ .fontSize(20)
+ .lineHeight(40)
+ .fontWeight(700)
+ .width('100%')
+ .padding({ left: 12 })
}
+ .width('100%')
}
build() {
NavDestination() {
Column({ space: 12 }) {
- Button($r('app.string.before_optimization'))
- .height(40)
- .width('100%')
+ Button($r('app.string.cellular_network_query'))
.onClick(() => {
- this.navPathStack.pushPath({ name: `Question${this.questionTag + 1}Incorrect` });
+ this.pathStack.pushPathByName('CellularNetworkQuery', null, false);
})
- Button($r('app.string.after_optimization'))
- .height(40)
.width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.wifi_query'))
.onClick(() => {
- this.navPathStack.pushPath({ name: `Question${this.questionTag + 1}Correct` });
+ this.pathStack.pushPathByName('WiFiQuery', null, false);
})
+ .width('100%')
+ .backgroundColor('#0A59F7')
}
- .height('100%')
- .width('100%')
- .padding({ left: 16, right: 16 })
.justifyContent(FlexAlign.End)
+ .height('100%')
+ .padding(16)
}
- .title(this.title)
- .padding({
- top: AppStorage.get('statusBarHeight') ?? 0,
- bottom: (AppStorage.get('naviIndicatorHeight') ?? 0) + 16
+ .onReady((context: NavDestinationContext) => {
+ this.pathStack = context.pathStack;
})
+ .title(this.NavDestinationTitle())
}
}
\ No newline at end of file
diff --git a/NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets b/NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a7e133981e29d6f246edb88877d5d99dab27a481
--- /dev/null
+++ b/NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets
@@ -0,0 +1,167 @@
+/*
+ * 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 { connection } from '@kit.NetworkKit';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+
+@Builder
+export function GetNetworkConnectionInfoBuilder() {
+ GetNetworkConnectionInfo()
+}
+
+@Component
+export struct GetNetworkConnectionInfo {
+ @State text: ResourceStr = '';
+ @State textArea: string = '';
+
+ // DocsCode 1
+ getNetworkConnectionType() {
+ try {
+ let netHandle = connection.getDefaultNetSync();
+ if (!netHandle || netHandle.netId === 0) {
+ return;
+ }
+ let netCapability = connection.getNetCapabilitiesSync(netHandle);
+ hilog.info(0x0000, 'Sample', 'bearerTypes: %{public}s', JSON.stringify(netCapability.bearerTypes));
+ // DocsDot
+ this.textArea = 'bearerTypes:' + JSON.stringify(netCapability.bearerTypes);
+ // DocsDot
+ } catch (e) {
+ let err = e as BusinessError;
+ hilog.error(0x0000, 'Sample', 'errCode: %{public}s, errMessage: %{public}s', (err as BusinessError).code,
+ (err as BusinessError).message);
+ }
+ }
+
+ // DocsCode 1
+
+ // DocsCode 2
+ judgeHasNet(): boolean {
+ try {
+ let netHandle = connection.getDefaultNetSync();
+ if (!netHandle || netHandle.netId === 0) {
+ return false;
+ }
+ let netCapability = connection.getNetCapabilitiesSync(netHandle);
+ let cap = netCapability.networkCap || [];
+ if (cap.includes(connection.NetCap.NET_CAPABILITY_VALIDATED)) {
+ // connection.NetCap.NET_CAPABILITY_VALIDATED,The value indicates that the network is normal and HTTP and HTTPS requests can be initiated。
+ // The network information changes and the network is available
+ // DocsDot
+ this.textArea = 'true';
+ // DocsDot
+ return true;
+ } else {
+ // The network information changes and the network is unavailable.
+ // DocsDot
+ this.textArea = 'false';
+ // DocsDot
+ return false;
+ }
+ } catch (e) {
+ let err = e as BusinessError;
+ hilog.error(0x0000, 'Sample', 'JudgeHasNet: %{public}s', JSON.stringify(err));
+ }
+ return false;
+ }
+
+ // DocsCode 2
+
+ // DocsCode 3
+ getRouteInfoAndLinkAddress() {
+ connection.getDefaultNet().then((netHandle: connection.NetHandle) => {
+ if (!netHandle || netHandle.netId === 0) {
+ // If there is no default network, the netid of the obtained netHandler is 0, which is an exception. You can add some processing mechanisms as required.
+ return;
+ }
+ connection.getConnectionProperties(netHandle, (error: BusinessError, data: connection.ConnectionProperties) => {
+ if (error) {
+ hilog.error(0x0000, 'Sample', 'errCode: %{public}s, errMessage: %{public}s', error.code, error.message);
+ return;
+ }
+ hilog.info(0x0000, 'Sample', 'Succeeded to get data: %{public}s', JSON.stringify(data));
+ let routeInfo = data.routes;
+ let linkAddress = data.linkAddresses;
+ // DocsDot
+ this.textArea =
+ 'routeInfo is: ' + JSON.stringify(routeInfo) + '\n' + 'linkAddress is: ' + JSON.stringify(linkAddress);
+ // DocsDot
+ })
+ });
+ }
+
+ // DocsCode 3
+
+ @Builder
+ NavDestinationTitle() {
+ Column() {
+ Text($r('app.string.query_Network_connection_information'))
+ .fontSize(20)
+ .lineHeight(40)
+ .fontWeight(700)
+ .width('100%')
+ .padding({ left: 12 })
+ }
+ .width('100%')
+ }
+
+ build() {
+ NavDestination() {
+ Column() {
+ Column() {
+ Text(this.text)
+ .margin({ bottom: 12 })
+ .textAlign(TextAlign.Start)
+ .width('100%')
+ .height(20)
+ TextArea({ text: this.textArea })
+ .width('100%')
+ .height('45%')
+ .focusable(false)
+ }
+
+ Column({ space: 12 }) {
+ Button($r('app.string.get_current_network_connection_type'))
+ .onClick(() => {
+ this.text = $r('app.string.current_network_connection_type');
+ this.getNetworkConnectionType();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.check_network_is_available'))
+ .onClick(() => {
+ this.text = $r('app.string.network_is_available');
+ this.judgeHasNet();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.query_route_and_link_information'))
+ .onClick(() => {
+ this.text = $r('app.string.route_and_link_information');
+ this.getRouteInfoAndLinkAddress();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ }
+ }
+ .width('100%')
+ .height('100%')
+ .justifyContent(FlexAlign.SpaceBetween)
+ .padding(16)
+ }
+ .title(this.NavDestinationTitle())
+ }
+}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/src/main/ets/pages/Question4Correct.ets b/NetworkManagement/entry/src/main/ets/pages/Index.ets
similarity index 40%
rename from MultiWindowPractice/entry/src/main/ets/pages/Question4Correct.ets
rename to NetworkManagement/entry/src/main/ets/pages/Index.ets
index b5aa92da1acbf4a10a6e2990abee297c969e6261..01be9e2eb8c561d7f0ad754fa5940acc8827ec9d 100644
--- a/MultiWindowPractice/entry/src/main/ets/pages/Question4Correct.ets
+++ b/NetworkManagement/entry/src/main/ets/pages/Index.ets
@@ -13,78 +13,52 @@
* limitations under the License.
*/
-import { promptAction } from '@kit.ArkUI';
-
-@Builder
-export function Question4CorrectBuilder() {
- Question4Correct()
-}
-
+@Entry
@Component
-export struct Question4Correct {
+struct Index {
+ pathStack: NavPathStack = new NavPathStack();
+
@Builder
- customDialogComp() {
+ NavigationTitle() {
Column() {
- Text('Top')
- .height(60)
+ Text($r('app.string.EntryAbility_label'))
+ .fontSize(30)
+ .lineHeight(48)
+ .fontWeight(700)
.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')
+ .padding({ left: 16 })
}
- .height(500)
- .justifyContent(FlexAlign.SpaceBetween)
- .constraintSize({
- maxHeight: '90%'
- })
+ .width('100%')
}
build() {
- NavDestination() {
- Column() {
- Button('Show Dialog')
- .height(40)
+ Navigation(this.pathStack) {
+ Column({ space: 12 }) {
+ Button($r('app.string.query_Network_connection_information'), { stateEffect: true, type: ButtonType.Capsule })
+ .onClick(() => {
+ this.pathStack.pushPathByName('GetNetworkConnectionInfo', null, false);
+ })
.width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.query_current_network_information'), { stateEffect: true, type: ButtonType.Capsule })
.onClick(() => {
- promptAction.openCustomDialog({
- builder: () => {
- this.customDialogComp();
- }
- });
+ this.pathStack.pushPathByName('GetCurrentNetworkInfo', null, false);
})
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.network_status_listening'), { stateEffect: true, type: ButtonType.Capsule })
+ .onClick(() => {
+ this.pathStack.pushPathByName('ListeningNetworkStatus', null, false);
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
}
- .height('100%')
- .width('100%')
.justifyContent(FlexAlign.End)
- .padding({
- left: 16,
- right: 16
- })
+ .width('100%')
+ .height('100%')
+ .padding(16)
}
- .hideTitleBar(true)
- .padding({
- top: AppStorage.get('statusBarHeight') ?? 0,
- bottom: (AppStorage.get('naviIndicatorHeight') ?? 0) + 16
- })
+ .title(this.NavigationTitle())
+ .titleMode(NavigationTitleMode.Full)
}
}
\ No newline at end of file
diff --git a/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets b/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bedee70f8ad8f8bf8a8db545022f2f9985cc7f39
--- /dev/null
+++ b/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets
@@ -0,0 +1,358 @@
+/*
+ * 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 { connection } from '@kit.NetworkKit';
+import { promptAction } from '@kit.ArkUI';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { netHandover, netQuality } from '@kit.NetworkBoostKit';
+import { wifiManager } from '@kit.ConnectivityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+
+@Builder
+export function ListeningNetworkStatusBuilder() {
+ ListeningNetworkStatus()
+}
+
+@Component
+export struct ListeningNetworkStatus {
+ controller: VideoController = new VideoController();
+ @State videoSrc: Resource = $rawfile('video.mp4'); // Replace it with the actual video loading URL.
+ private netCon: connection.NetConnection | null = null;
+ private networkPause: boolean = false; // Listen to the loading status
+ private isLowQuality: boolean = false;
+
+ aboutToAppear(): void {
+ this.networkListen();
+ this.netQualityListen();
+ this.wifiChangeListen();
+ this.sceneChangeListen();
+ this.handoverChangeListen();
+ }
+
+ // DocsCode 1
+ aboutToDisappear(): void {
+ this.netCon?.unregister((error: BusinessError) => {
+ if (error) {
+ hilog.error(0x0000, 'Sample', 'unregister failed, callback: err->: %{public}s', JSON.stringify(error));
+ }
+ });
+ }
+
+ // DocsCode 1
+
+ // DocsCode 2
+ networkListen() {
+ this.netCon = connection.createNetConnection();
+ this.netCon.register((error: BusinessError) => {
+ if (error) {
+ hilog.error(0x0000, 'Sample', 'networkListen fail: %{public}s', JSON.stringify(error));
+ return;
+ }
+ });
+
+ this.netCon.on('netAvailable', (data: connection.NetHandle) => {
+ hilog.info(0x0000, 'Sample', 'Succeeded to get netAvailable: %{public}s', JSON.stringify(data));
+ if (connection.hasDefaultNetSync()) {
+ if (this.networkPause) {
+ this.controller?.start();
+ this.networkPause = false;
+ }
+ }
+ });
+
+ // Subscribe to network loss events
+ this.netCon.on('netLost', (data: connection.NetHandle) => {
+ if (connection.getAllNetsSync().length == 0) {
+ this.controller?.pause();
+ this.networkPause = true;
+ }
+ hilog.info(0x0000, 'Sample', 'Succeeded to get netLost: %{public}s', JSON.stringify(data));
+ });
+
+ this.netCon.on('netCapabilitiesChange', (data: connection.NetCapabilityInfo) => {
+ hilog.info(0x0000, 'Sample', 'Succeeded to get netCapabilitiesChange: %{public}s', JSON.stringify(data));
+ });
+
+ this.netCon.on('netUnavailable', () => {
+ hilog.info(0x0000, 'Sample', 'Succeeded to get unavailable net event');
+ });
+ }
+
+ // DocsCode 2
+
+ // DocsCode 3
+ judgeHasNet(): boolean {
+ try {
+ let netHandle = connection.getDefaultNetSync();
+ if (!netHandle || netHandle.netId === 0) {
+ return false;
+ }
+ let netCapability = connection.getNetCapabilitiesSync(netHandle);
+ let cap = netCapability.networkCap || [];
+ if (cap.includes(connection.NetCap.NET_CAPABILITY_VALIDATED)) {
+ // connection.NetCap.NET_CAPABILITY_VALIDATED,The value indicates that the network is normal and HTTP and HTTPS requests can be initiated.
+ // The network information changes and the network is available.
+ return true;
+ } else {
+ // The network information changes and the network is unavailable.
+ return false;
+ }
+ } catch (e) {
+ let err = e as BusinessError;
+ hilog.error(0x0000, 'Sample', 'errCode: %{public}s, errMessage: %{public}s', (err as BusinessError).code,
+ (err as BusinessError).message);
+ }
+ return false;
+ }
+
+ // DocsCode 3
+
+ // DocsCode 4
+ toggleLowDefinition() {
+ this.videoSrc = $rawfile('lowQuality.mp4');
+ }
+
+ // DocsCode 4
+
+ // DocsCode 5
+ netQualityListen() {
+ try {
+ netQuality.on('netQosChange', (list: Array) => {
+ if (list.length > 0) {
+ list.forEach((qos) => {
+ // Callback information processing
+ hilog.info(0x0000, 'Sample', 'Succeeded receive netQosChange info: %{public}s', JSON.stringify(qos));
+ let lowNetQuality: boolean = false;
+ // Determine the current network quality based on the network quality information. The logic needs to be customized. If the quality is low, set lowNetQuality to true.
+ // If the network quality is low, switch the video definition.
+ if (lowNetQuality) {
+ this.toggleLowDefinition();
+ }
+ });
+ }
+ });
+ } catch (err) {
+ hilog.error(0x0000, 'Sample', 'errCode: %{public}s, errMessage: %{public}s', (err as BusinessError).code,
+ (err as BusinessError).message);
+ }
+ }
+
+ // DocsCode 5
+
+ // DocsCode 6
+ wifiChangeListen() {
+ this.netCon = connection.createNetConnection({
+ netCapabilities: {
+ bearerTypes: [connection.NetBearType.BEARER_WIFI]
+ }
+ });
+ // Use the register interface to register a subscription event.
+ this.netCon.register((error: BusinessError) => {
+ if (error) {
+ hilog.error(0x0000, 'Sample', 'networkListen fail: %{public}s', JSON.stringify(error));
+ return;
+ }
+ });
+
+ // Subscribe to network availability events. This event notification can be received only after register is called.
+ this.netCon.on('netAvailable', (data: connection.NetHandle) => {
+ hilog.info(0x0000, 'Sample', 'WifiChangeListen-- Succeeded to get data: %{public}s', JSON.stringify(data));
+ });
+
+ // Subscribe to network loss events. This event notification can be received only after register is called.
+ this.netCon.on('netLost', (data: connection.NetHandle) => {
+ hilog.info(0x0000, 'Sample', 'WifiChangeListen-- Succeeded to get data: %{public}s', JSON.stringify(data));
+ });
+
+ let recvPowerNotifyFunc = (result: number) => {
+ hilog.info(0x0000, 'Sample', 'WifiChangeListen-- Receive power state change event: %{public}d', result);
+ }
+ let recvWifiConnectionChangeFunc = (result: number) => {
+ hilog.info(0x0000, 'Sample', 'WifiChangeListen-- Receive wifi connection change event: %{public}d', result);
+ }
+
+ // Registering Events
+ wifiManager.on('wifiStateChange', recvPowerNotifyFunc);
+ wifiManager.on('wifiConnectionChange', recvWifiConnectionChangeFunc);
+ }
+
+ // DocsCode 6
+
+ // DocsCode 7
+ sceneChangeListen() {
+ try {
+ netQuality.on('netSceneChange', (list: Array) => {
+ if (list.length > 0) {
+ list.forEach((networkScene) => {
+ // Callback information processing
+ hilog.info(0x0000, 'Sample', 'Succeeded receive netSceneChange info');
+ if (networkScene.scene === 'weakSignal' || networkScene.scene === 'congestion') {
+ // Indicates the weak network scenario.
+ hilog.info(0x0000, 'Sample', 'The current network is weak');
+ this.networkWeak();
+ }
+ });
+ }
+ });
+ } catch (err) {
+ hilog.error(0x0000, 'Sample', 'errCode: %{public}s, errMessage: %{public}s', (err as BusinessError).code,
+ (err as BusinessError).message);
+ }
+ }
+
+ // DocsCode 7
+
+ // DocsCode 8
+ networkWeak() {
+ promptAction.showToast({
+ message: $r('app.string.weak_network_environment_message'),
+ duration: 2000
+ });
+ }
+
+ // DocsCode 8
+
+ // DocsCode 9
+ handoverChangeListen() {
+ try {
+ netHandover.on('handoverChange', (info: netHandover.HandoverInfo) => {
+ if (info.handoverStart) {
+ // Connection migration start callback. The application adjusts the data transmission policy based on the suggestions of HandoverStart.
+ hilog.info(0x0000, 'Sample', 'handover start');
+ } else if (info.handoverComplete) {
+ // Callback after the connection migration is complete. The application performs rate adjustment and reestablishment according to the suggestions in HandoverComplete.
+ hilog.info(0x0000, 'Sample', 'handover complete');
+ }
+ });
+ } catch (err) {
+ hilog.error(0x0000, 'Sample', 'errCode: %{public}s, errMessage: %{public}s', (err as BusinessError).code,
+ (err as BusinessError).message);
+ }
+ }
+
+ // DocsCode 9
+
+ @Builder
+ NavDestinationTitle() {
+ Column() {
+ Text($r('app.string.network_status_listening'))
+ .fontSize(20)
+ .lineHeight(40)
+ .fontWeight(700)
+ .width('100%')
+ .padding({ left: 12 })
+ }
+ .width('100%')
+ }
+
+ build() {
+ NavDestination() {
+ Video({
+ src: this.videoSrc,
+ controller: this.controller
+ })
+ .objectFit(ImageFit.Cover)
+ .onStart(() => {
+ let judgeHasNet = this.judgeHasNet();
+ if (!judgeHasNet) {
+ this.controller?.reset();
+ promptAction.showToast({
+ message: $r('app.string.network_unavailable_message'),
+ duration: 2000
+ });
+ }
+ })
+ .height('50%')
+
+ Column() {
+ Button($r('app.string.simulate_network_unavailable')).onClick(() => {
+ this.controller.pause();
+ promptAction.showToast({
+ message: $r('app.string.network_unavailable_message'),
+ duration: 2000
+ });
+ })
+ .margin({ bottom: 12 })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.simulate_network_lost')).onClick(() => {
+ this.controller.pause();
+ promptAction.showToast({
+ message: $r('app.string.simulate_network_disconnected_message'),
+ duration: 2000
+ });
+ })
+ .margin({ bottom: 12 })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.simulate_weak_network_environment')).onClick(() => {
+ this.controller.pause();
+ promptAction.showToast({
+ message: $r('app.string.weak_network_toggle_video'),
+ duration: 2000
+ });
+ })
+ .margin({ bottom: 12 })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.Simulate_low_quality_network_environment')).onClick(() => {
+ this.controller.pause();
+ promptAction.showToast({
+ message: $r('app.string.low_quality_network_environment_message'),
+ duration: 2000
+ });
+ })
+ .margin({ bottom: 12 })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.toggle_video_to_low_definition')).onClick(() => {
+ if (!this.isLowQuality) {
+ this.toggleLowDefinition();
+ this.isLowQuality = true;
+ promptAction.showToast({
+ message: $r('app.string.toggle_low_definition_message'),
+ duration: 2000
+ });
+ this.controller?.reset();
+ } else {
+ promptAction.showToast({
+ message: $r('app.string.toggle_definition_message_fail'),
+ duration: 2000
+ });
+ }
+ })
+ .width('100%')
+ .margin({ bottom: 12 })
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.toggle_video_to_high_definition')).onClick(() => {
+ this.videoSrc = $rawfile('video.mp4');
+ this.isLowQuality = false;
+ this.controller?.reset();
+ promptAction.showToast({
+ message: $r('app.string.toggle_high_definition_message'),
+ duration: 2000
+ });
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ }
+ .justifyContent(FlexAlign.End)
+ .height(346)
+ .padding({ left: 16, right: 16, bottom: 24 })
+ .margin({ bottom: 16 })
+ }
+ .title(this.NavDestinationTitle())
+ }
+}
\ No newline at end of file
diff --git a/NetworkManagement/entry/src/main/ets/pages/WiFiQuery.ets b/NetworkManagement/entry/src/main/ets/pages/WiFiQuery.ets
new file mode 100644
index 0000000000000000000000000000000000000000..af4faec467dd5ac9c9166e793f7954bcff83b0ff
--- /dev/null
+++ b/NetworkManagement/entry/src/main/ets/pages/WiFiQuery.ets
@@ -0,0 +1,187 @@
+/*
+ * 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 { wifiManager } from '@kit.ConnectivityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+
+@Builder
+export function WiFiQueryBuilder() {
+ WiFiQuery()
+}
+
+@Component
+export struct WiFiQuery {
+ @State text: ResourceStr = '';
+ @State textArea: string = '';
+
+ // DocsCode 1
+ getWifiStatus() {
+ try {
+ let isWifiActive = wifiManager.isWifiActive();
+ hilog.info(0x0000, 'Sample', 'isWifiActive: %{public}s', isWifiActive);
+ // DocsDot
+ this.textArea = 'isWifiActive:' + isWifiActive;
+ // DocsDot
+ } catch (error) {
+ hilog.error(0x0000, 'Sample', 'failed: err->: %{public}s', JSON.stringify(error));
+ }
+ }
+
+ // DocsCode 1
+
+ // DocsCode 2
+ getWifiIsConnected() {
+ try {
+ let ret = wifiManager.isConnected();
+ hilog.info(0x0000, 'Sample', 'isConnected: %{public}s', ret);
+ // DocsDot
+ this.textArea = 'isConnected:' + ret;
+ // DocsDot
+ } catch (error) {
+ hilog.error(0x0000, 'Sample', 'failed: err->: %{public}s', JSON.stringify(error));
+ }
+ }
+
+ // DocsCode 2
+
+ // DocsCode 3
+ getScanInfoList() {
+ try {
+ let scanInfoList = wifiManager.getScanInfoList();
+ hilog.info(0x0000, 'Sample', 'scanInfoList: %{public}s', JSON.stringify(scanInfoList));
+ // DocsDot
+ this.textArea = 'scanInfoList:' + JSON.stringify(scanInfoList);
+ // DocsDot
+ } catch (error) {
+ hilog.error(0x0000, 'Sample', 'failed: err->: %{public}s', JSON.stringify(error));
+ }
+ }
+
+ // DocsCode 3
+
+ // DocsCode 4
+ getSignalLevel() {
+ try {
+ let rssi = 0;
+ let band = 0;
+ let level = wifiManager.getSignalLevel(rssi, band);
+ hilog.info(0x0000, 'Sample', 'level: %{public}s', JSON.stringify(level));
+ // DocsDot
+ this.textArea = 'level:' + JSON.stringify(level);
+ // DocsDot
+ } catch (error) {
+ hilog.error(0x0000, 'Sample', 'failed: err->: %{public}s', JSON.stringify(error));
+ }
+ }
+
+ // DocsCode 4
+
+ // DocsCode 5
+ addCandidateConfig() {
+ try {
+ let config: wifiManager.WifiDeviceConfig = {
+ ssid: '****',
+ preSharedKey: '****',
+ securityType: 0
+ };
+ wifiManager.addCandidateConfig(config).then(result => {
+ hilog.info(0x0000, 'Sample', 'result: %{public}s', JSON.stringify(result));
+ }).catch((err: number) => {
+ hilog.error(0x0000, 'Sample', 'failed: err->: %{public}s', JSON.stringify(err));
+ });
+ // DocsDot
+ this.textArea = JSON.stringify(config);
+ // DocsDot
+ } catch (error) {
+ hilog.error(0x0000, 'Sample', 'failed: err->: %{public}s', JSON.stringify(error));
+ }
+ }
+
+ // DocsCode 5
+
+ @Builder
+ NavDestinationTitle() {
+ Column() {
+ Text($r('app.string.wifi_query'))
+ .fontSize(20)
+ .lineHeight(40)
+ .fontWeight(700)
+ .width('100%')
+ .padding({ left: 12 })
+ }
+ .width('100%')
+ }
+
+ build() {
+ NavDestination() {
+ Column() {
+ Column() {
+ Text(this.text)
+ .margin({ bottom: 12 })
+ .textAlign(TextAlign.Start)
+ .width('100%')
+ .height(20)
+ TextArea({ text: this.textArea })
+ .width('100%')
+ .height('45%')
+ .focusable(false)
+ }
+
+ Column({ space: 12 }) {
+ Button($r('app.string.Check_wlan_is_enabled'))
+ .onClick(() => {
+ this.text = $r('app.string.wlan_is_enabled');
+ this.getWifiStatus();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.Check_wlan_is_Connected'))
+ .onClick(() => {
+ this.text = $r('app.string.wlan_is_Connected');
+ this.getWifiIsConnected();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.get_list_of_scanned_hotspots'))
+ .onClick(() => {
+ this.text = $r('app.string.list_of_scanned_hotspots');
+ this.getScanInfoList();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.get_wifi_signal_strength'))
+ .onClick(() => {
+ this.text = $r('app.string.wifi_signal_strength');
+ this.getSignalLevel();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ Button($r('app.string.add_candidate_network_configuration'))
+ .onClick(() => {
+ this.text = $r('app.string.candidate_network_configuration');
+ this.addCandidateConfig();
+ })
+ .width('100%')
+ .backgroundColor('#0A59F7')
+ }
+ }
+ .width('100%')
+ .height('100%')
+ .justifyContent(FlexAlign.SpaceBetween)
+ .padding(16)
+ }
+ .title(this.NavDestinationTitle())
+ }
+}
\ No newline at end of file
diff --git a/NetworkManagement/entry/src/main/module.json5 b/NetworkManagement/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..988825b187b18bb0d684b413fbbe2206889f2ac8
--- /dev/null
+++ b/NetworkManagement/entry/src/main/module.json5
@@ -0,0 +1,83 @@
+{
+ "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": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.SET_WIFI_INFO",
+ "reason": "$string:reason_set_wifi_info",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ {
+ "name": "ohos.permission.GET_WIFI_INFO",
+ "reason": "$string:reason_get_wifi_info",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ {
+ "name": "ohos.permission.GET_NETWORK_INFO",
+ "reason": "$string:reason_get_network_info",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when": "inuse"
+ }
+ }
+ ],
+ "routerMap": "$profile:route_map"
+ }
+}
\ No newline at end of file
diff --git a/NetworkManagement/entry/src/main/resources/base/element/color.json b/NetworkManagement/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/NetworkManagement/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/NetworkManagement/entry/src/main/resources/base/element/string.json b/NetworkManagement/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..358a8fdcb92ee06fcf7d9758b132b68d76112697
--- /dev/null
+++ b/NetworkManagement/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,192 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "Network Management and Status Listening"
+ },
+ {
+ "name": "get_network_status",
+ "value": "Querying the Network Status"
+ },
+ {
+ "name": "current_network_status",
+ "value": "Current Network Status:"
+ },
+ {
+ "name": "check_current_network",
+ "value": "Check whether the current network is 3G/4G/5G"
+ },
+ {
+ "name": "current_network",
+ "value": "Current network is:"
+ },
+ {
+ "name": "check_radio_status",
+ "value": "Check whether the radio of the primary card is enabled"
+ },
+ {
+ "name": "radio_status",
+ "value": "Indicates whether the radio of the primary card is enabled:"
+ },
+ {
+ "name": "query_current_network_information",
+ "value": "Querying Current Network Information"
+ },
+ {
+ "name": "cellular_network_query",
+ "value": "Cellular Network Query"
+ },
+ {
+ "name": "wifi_query",
+ "value": "Wi-Fi query"
+ },
+ {
+ "name": "get_current_network_connection_type",
+ "value": "Obtains the current network connection type"
+ },
+ {
+ "name": "current_network_connection_type",
+ "value": "Current network connection type:"
+ },
+ {
+ "name": "check_network_is_available",
+ "value": "Check whether the current network is available"
+ },
+ {
+ "name": "network_is_available",
+ "value": "Whether the current network is available:"
+ },
+ {
+ "name": "query_route_and_link_information",
+ "value": "Query network route information and network link information"
+ },
+ {
+ "name": "route_and_link_information",
+ "value": "Network route information and network link information is as follows:"
+ },
+ {
+ "name": "query_Network_connection_information",
+ "value": "Querying Network Connection Information"
+ },
+ {
+ "name": "network_status_listening",
+ "value": "Network status monitoring"
+ },
+ {
+ "name": "network_unavailable_message",
+ "value": "The current network is unavailable. Check the network"
+ },
+ {
+ "name": "weak_network_environment_message",
+ "value": "You are in a weak network environment. You are advised to switch to another network"
+ },
+ {
+ "name": "simulate_network_unavailable",
+ "value": "Simulate network unavailable"
+ },
+ {
+ "name": "simulate_network_lost",
+ "value": "Simulate network loss"
+ },
+ {
+ "name": "simulate_network_disconnected_message",
+ "value": "The current network is disconnected. Check the network"
+ },
+ {
+ "name": "simulate_weak_network_environment",
+ "value": "Simulate a weak network environment"
+ },
+ {
+ "name": "weak_network_toggle_video",
+ "value": "The network is weak. Switch to another network or reduce the video definition"
+ },
+ {
+ "name": "Simulate_low_quality_network_environment",
+ "value": "Simulate a low-quality network environment"
+ },
+ {
+ "name": "low_quality_network_environment_message",
+ "value": "The network quality is low. Reduce the video definition"
+ },
+ {
+ "name": "toggle_video_to_low_definition",
+ "value": "Switch the video to low definition"
+ },
+ {
+ "name": "toggle_low_definition_message",
+ "value": "Switching succeeded. Low-definition video is being played"
+ },
+ {
+ "name": "toggle_definition_message_fail",
+ "value": "Switching failed. The current video is a low-definition video"
+ },
+ {
+ "name": "toggle_video_to_high_definition",
+ "value": "Switch video to high definition"
+ },
+ {
+ "name": "toggle_high_definition_message",
+ "value": "The switch is successful. The HD video is being played"
+ },
+ {
+ "name": "Check_wlan_is_enabled",
+ "value": "Check whether WLAN is enabled"
+ },
+ {
+ "name": "wlan_is_enabled",
+ "value": "Whether the WLAN is enabled:"
+ },
+ {
+ "name": "Check_wlan_is_Connected",
+ "value": "Check whether the WLAN is connected"
+ },
+ {
+ "name": "wlan_is_Connected",
+ "value": "whether the WLAN is connected:"
+ },
+ {
+ "name": "get_list_of_scanned_hotspots",
+ "value": "Obtains the list of scanned hotspots"
+ },
+ {
+ "name": "list_of_scanned_hotspots",
+ "value": "List of Scanned Hotspots:"
+ },
+ {
+ "name": "get_wifi_signal_strength",
+ "value": "Obtains the signal strength of the currently connected Wi-Fi network"
+ },
+ {
+ "name": "wifi_signal_strength",
+ "value": "Indicates the signal strength of the current Wi-Fi connection:"
+ },
+ {
+ "name": "add_candidate_network_configuration",
+ "value": "Add Candidate Network Configuration"
+ },
+ {
+ "name": "candidate_network_configuration",
+ "value": "Add candidate network configurations as follows:"
+ },
+ {
+ "name": "reason_set_wifi_info",
+ "value": "Set Wi-Fi info"
+ },
+ {
+ "name": "reason_get_wifi_info",
+ "value": "Get Wi-Fi info"
+ },
+ {
+ "name": "reason_get_network_info",
+ "value": "Get network info"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/NetworkManagement/entry/src/main/resources/base/media/background.png b/NetworkManagement/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/NetworkManagement/entry/src/main/resources/base/media/background.png differ
diff --git a/NetworkManagement/entry/src/main/resources/base/media/foreground.png b/NetworkManagement/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/NetworkManagement/entry/src/main/resources/base/media/foreground.png differ
diff --git a/NetworkManagement/entry/src/main/resources/base/media/layered_image.json b/NetworkManagement/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/NetworkManagement/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/NetworkManagement/entry/src/main/resources/base/media/startIcon.png b/NetworkManagement/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/NetworkManagement/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/NetworkManagement/entry/src/main/resources/base/profile/backup_config.json b/NetworkManagement/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/NetworkManagement/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/MultiWindowPractice/entry/src/main/resources/base/profile/main_pages.json b/NetworkManagement/entry/src/main/resources/base/profile/main_pages.json
similarity index 94%
rename from MultiWindowPractice/entry/src/main/resources/base/profile/main_pages.json
rename to NetworkManagement/entry/src/main/resources/base/profile/main_pages.json
index 55c3f007f87b7ce5206d325f968cc56f2f79441f..1898d94f58d6128ab712be2c68acc7c98e9ab9ce 100644
--- a/MultiWindowPractice/entry/src/main/resources/base/profile/main_pages.json
+++ b/NetworkManagement/entry/src/main/resources/base/profile/main_pages.json
@@ -2,4 +2,4 @@
"src": [
"pages/Index"
]
-}
\ No newline at end of file
+}
diff --git a/NetworkManagement/entry/src/main/resources/base/profile/route_map.json b/NetworkManagement/entry/src/main/resources/base/profile/route_map.json
new file mode 100644
index 0000000000000000000000000000000000000000..6b92c3f9a9d85825fcb364cb818b74eb6eafe46b
--- /dev/null
+++ b/NetworkManagement/entry/src/main/resources/base/profile/route_map.json
@@ -0,0 +1,44 @@
+{
+ "routerMap": [
+ {
+ "name": "GetCurrentNetworkInfo",
+ "pageSourceFile": "src/main/ets/pages/GetCurrentNetworkInfo.ets",
+ "buildFunction": "GetCurrentNetworkInfoBuilder",
+ "data": {
+ "description": "this is GetCurrentNetworkInfo"
+ }
+ },
+ {
+ "name": "GetNetworkConnectionInfo",
+ "pageSourceFile": "src/main/ets/pages/GetNetworkConnectionInfo.ets",
+ "buildFunction": "GetNetworkConnectionInfoBuilder",
+ "data": {
+ "description": "this is GetNetworkConnectionInfo"
+ }
+ },
+ {
+ "name": "CellularNetworkQuery",
+ "pageSourceFile": "src/main/ets/pages/CellularNetworkQuery.ets",
+ "buildFunction": "CellularNetworkQueryBuilder",
+ "data": {
+ "description": "this is CellularNetworkQuery"
+ }
+ },
+ {
+ "name": "WiFiQuery",
+ "pageSourceFile": "src/main/ets/pages/WiFiQuery.ets",
+ "buildFunction": "WiFiQueryBuilder",
+ "data": {
+ "description": "this is WiFiQuery"
+ }
+ },
+ {
+ "name": "ListeningNetworkStatus",
+ "pageSourceFile": "src/main/ets/pages/ListeningNetworkStatus.ets",
+ "buildFunction": "ListeningNetworkStatusBuilder",
+ "data": {
+ "description": "this is ListeningNetworkStatus"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/NetworkManagement/entry/src/main/resources/en_US/element/string.json b/NetworkManagement/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..269613c52e8e14141ae1bea4306d44a1f6025b26
--- /dev/null
+++ b/NetworkManagement/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,192 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "NetworkManagementAndListening"
+ },
+ {
+ "name": "get_network_status",
+ "value": "Querying the Network Status"
+ },
+ {
+ "name": "current_network_status",
+ "value": "Current Network Status:"
+ },
+ {
+ "name": "check_current_network",
+ "value": "Check whether the current network is 3G/4G/5G"
+ },
+ {
+ "name": "current_network",
+ "value": "Current network is:"
+ },
+ {
+ "name": "check_radio_status",
+ "value": "Check whether the radio of the primary card is enabled"
+ },
+ {
+ "name": "radio_status",
+ "value": "Indicates whether the radio of the primary card is enabled:"
+ },
+ {
+ "name": "query_current_network_information",
+ "value": "Querying Current Network Information"
+ },
+ {
+ "name": "cellular_network_query",
+ "value": "Cellular Network Query"
+ },
+ {
+ "name": "wifi_query",
+ "value": "Wi-Fi query"
+ },
+ {
+ "name": "get_current_network_connection_type",
+ "value": "Obtains the current network connection type"
+ },
+ {
+ "name": "current_network_connection_type",
+ "value": "Current network connection type:"
+ },
+ {
+ "name": "check_network_is_available",
+ "value": "Check whether the current network is available"
+ },
+ {
+ "name": "network_is_available",
+ "value": "Whether the current network is available:"
+ },
+ {
+ "name": "query_route_and_link_information",
+ "value": "Query network route information and network link information"
+ },
+ {
+ "name": "route_and_link_information",
+ "value": "Network route information and network link information is as follows:"
+ },
+ {
+ "name": "query_Network_connection_information",
+ "value": "Querying Network Connection Information"
+ },
+ {
+ "name": "network_status_listening",
+ "value": "Network status monitoring"
+ },
+ {
+ "name": "network_unavailable_message",
+ "value": "The current network is unavailable. Check the network"
+ },
+ {
+ "name": "weak_network_environment_message",
+ "value": "You are in a weak network environment. You are advised to switch to another network"
+ },
+ {
+ "name": "simulate_network_unavailable",
+ "value": "Simulate network unavailable"
+ },
+ {
+ "name": "simulate_network_lost",
+ "value": "Simulate network loss"
+ },
+ {
+ "name": "simulate_network_disconnected_message",
+ "value": "The current network is disconnected. Check the network"
+ },
+ {
+ "name": "simulate_weak_network_environment",
+ "value": "Simulate a weak network environment"
+ },
+ {
+ "name": "weak_network_toggle_video",
+ "value": "The network is weak. Switch to another network or reduce the video definition"
+ },
+ {
+ "name": "Simulate_low_quality_network_environment",
+ "value": "Simulate a low-quality network environment"
+ },
+ {
+ "name": "low_quality_network_environment_message",
+ "value": "The network quality is low. Reduce the video definition"
+ },
+ {
+ "name": "toggle_video_to_low_definition",
+ "value": "Switch the video to low definition"
+ },
+ {
+ "name": "toggle_low_definition_message",
+ "value": "Switching succeeded. Low-definition video is being played"
+ },
+ {
+ "name": "toggle_definition_message_fail",
+ "value": "Switching failed. The current video is a low-definition video"
+ },
+ {
+ "name": "toggle_video_to_high_definition",
+ "value": "Switch video to high definition"
+ },
+ {
+ "name": "toggle_high_definition_message",
+ "value": "The switch is successful. The HD video is being played"
+ },
+ {
+ "name": "Check_wlan_is_enabled",
+ "value": "Check whether WLAN is enabled"
+ },
+ {
+ "name": "wlan_is_enabled",
+ "value": "Whether the WLAN is enabled:"
+ },
+ {
+ "name": "Check_wlan_is_Connected",
+ "value": "Check whether the WLAN is connected"
+ },
+ {
+ "name": "wlan_is_Connected",
+ "value": "whether the WLAN is connected:"
+ },
+ {
+ "name": "get_list_of_scanned_hotspots",
+ "value": "Obtains the list of scanned hotspots"
+ },
+ {
+ "name": "list_of_scanned_hotspots",
+ "value": "List of Scanned Hotspots:"
+ },
+ {
+ "name": "get_wifi_signal_strength",
+ "value": "Obtains the signal strength of the currently connected Wi-Fi network"
+ },
+ {
+ "name": "wifi_signal_strength",
+ "value": "Indicates the signal strength of the current Wi-Fi connection:"
+ },
+ {
+ "name": "add_candidate_network_configuration",
+ "value": "Add Candidate Network Configuration"
+ },
+ {
+ "name": "candidate_network_configuration",
+ "value": "Add candidate network configurations as follows:"
+ },
+ {
+ "name": "reason_set_wifi_info",
+ "value": "Set Wi-Fi info"
+ },
+ {
+ "name": "reason_get_wifi_info",
+ "value": "Get Wi-Fi info"
+ },
+ {
+ "name": "reason_get_network_info",
+ "value": "Get network info"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/NetworkManagement/entry/src/main/resources/rawfile/lowQuality.mp4 b/NetworkManagement/entry/src/main/resources/rawfile/lowQuality.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..4f79f0a4f36e0ccad93163ac30951bacfb08842d
Binary files /dev/null and b/NetworkManagement/entry/src/main/resources/rawfile/lowQuality.mp4 differ
diff --git a/MultiWindowPractice/entry/src/main/resources/rawfile/testVideo2.mp4 b/NetworkManagement/entry/src/main/resources/rawfile/video.mp4
similarity index 44%
rename from MultiWindowPractice/entry/src/main/resources/rawfile/testVideo2.mp4
rename to NetworkManagement/entry/src/main/resources/rawfile/video.mp4
index 2d71a4e6b1abd049ed2691d162468bb61f8c65b7..ba0eb3fe065eee6b19e806bd1895deccabeb4576 100644
Binary files a/MultiWindowPractice/entry/src/main/resources/rawfile/testVideo2.mp4 and b/NetworkManagement/entry/src/main/resources/rawfile/video.mp4 differ
diff --git a/NetworkManagement/entry/src/main/resources/zh_CN/element/string.json b/NetworkManagement/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f3bf025229f2c2af6aff46be895b8992a15f6618
--- /dev/null
+++ b/NetworkManagement/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,192 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "网络管理与状态监听"
+ },
+ {
+ "name": "get_network_status",
+ "value": "查询网络状态"
+ },
+ {
+ "name": "current_network_status",
+ "value": "当前网络状态:"
+ },
+ {
+ "name": "check_current_network",
+ "value": "查询当前网络是3G/4G/5G"
+ },
+ {
+ "name": "current_network",
+ "value": "当前网络是:"
+ },
+ {
+ "name": "check_radio_status",
+ "value": "判断主卡的Radio是否打开"
+ },
+ {
+ "name": "radio_status",
+ "value": "主卡的Radio是否打开:"
+ },
+ {
+ "name": "query_current_network_information",
+ "value": "查询当前网络信息"
+ },
+ {
+ "name": "cellular_network_query",
+ "value": "蜂窝网络查询"
+ },
+ {
+ "name": "wifi_query",
+ "value": "Wi-Fi查询"
+ },
+ {
+ "name": "get_current_network_connection_type",
+ "value": "获取当前网络连接类型"
+ },
+ {
+ "name": "current_network_connection_type",
+ "value": "当前网络连接类型:"
+ },
+ {
+ "name": "check_network_is_available",
+ "value": "判断当前网络是否可用"
+ },
+ {
+ "name": "network_is_available",
+ "value": "当前网络是否可用:"
+ },
+ {
+ "name": "query_route_and_link_information",
+ "value": "查询网络路由信息、网络链路信息"
+ },
+ {
+ "name": "route_and_link_information",
+ "value": "网络路由信息、网络链路信息如下:"
+ },
+ {
+ "name": "query_Network_connection_information",
+ "value": "查询网络连接信息"
+ },
+ {
+ "name": "network_status_listening",
+ "value": "网络状态监听"
+ },
+ {
+ "name": "network_unavailable_message",
+ "value": "当前网络不可用,请检查网络"
+ },
+ {
+ "name": "weak_network_environment_message",
+ "value": "当前处于弱网环境,建议您切换网络"
+ },
+ {
+ "name": "simulate_network_unavailable",
+ "value": "模拟网络不可用"
+ },
+ {
+ "name": "simulate_network_lost",
+ "value": "模拟网络丢失"
+ },
+ {
+ "name": "simulate_network_disconnected_message",
+ "value": "当前网络断开,请检查网络"
+ },
+ {
+ "name": "simulate_weak_network_environment",
+ "value": "模拟弱网环境"
+ },
+ {
+ "name": "weak_network_toggle_video",
+ "value": "当前处于弱网环境,请切换网络或者降低视频清晰度"
+ },
+ {
+ "name": "Simulate_low_quality_network_environment",
+ "value": "模拟网络低质量环境"
+ },
+ {
+ "name": "low_quality_network_environment_message",
+ "value": "当前处于网络低质量环境,请降低视频清晰度"
+ },
+ {
+ "name": "toggle_video_to_low_definition",
+ "value": "切换视频到低清晰度"
+ },
+ {
+ "name": "toggle_low_definition_message",
+ "value": "切换成功,当前播放低清晰度视频"
+ },
+ {
+ "name": "toggle_definition_message_fail",
+ "value": "切换失败,当前已是低清晰度视频"
+ },
+ {
+ "name": "toggle_video_to_high_definition",
+ "value": "切换视频到高清晰度"
+ },
+ {
+ "name": "toggle_high_definition_message",
+ "value": "切换成功,当前播放高清晰度视频"
+ },
+ {
+ "name": "Check_wlan_is_enabled",
+ "value": "查询WLAN是否已使能"
+ },
+ {
+ "name": "wlan_is_enabled",
+ "value": "WLAN是否已使能:"
+ },
+ {
+ "name": "Check_wlan_is_Connected",
+ "value": "查询WLAN是否已连接"
+ },
+ {
+ "name": "wlan_is_Connected",
+ "value": "WLAN是否已连接:"
+ },
+ {
+ "name": "get_list_of_scanned_hotspots",
+ "value": "获取扫描到的热点列表"
+ },
+ {
+ "name": "list_of_scanned_hotspots",
+ "value": "扫描到的热点列表如下:"
+ },
+ {
+ "name": "get_wifi_signal_strength",
+ "value": "获取当前连接Wi-Fi的信号强度"
+ },
+ {
+ "name": "wifi_signal_strength",
+ "value": "当前连接Wi-Fi的信号强度:"
+ },
+ {
+ "name": "add_candidate_network_configuration",
+ "value": "添加候选网络配置"
+ },
+ {
+ "name": "candidate_network_configuration",
+ "value": "添加候选网络配置如下:"
+ },
+ {
+ "name": "reason_set_wifi_info",
+ "value": "设置Wi-Fi信息"
+ },
+ {
+ "name": "reason_get_wifi_info",
+ "value": "获取Wi-Fi信息"
+ },
+ {
+ "name": "reason_get_network_info",
+ "value": "获取网络信息"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/NetworkManagement/hvigor/hvigor-config.json5 b/NetworkManagement/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..06b2783670a348f95533b352c1ceda909a842bbc
--- /dev/null
+++ b/NetworkManagement/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/NetworkManagement/hvigorfile.ts b/NetworkManagement/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775
--- /dev/null
+++ b/NetworkManagement/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/NetworkManagement/oh-package.json5 b/NetworkManagement/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..8bf916d4a165e0466c65bc49f58ab2e3c27e8931
--- /dev/null
+++ b/NetworkManagement/oh-package.json5
@@ -0,0 +1,8 @@
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ }
+}
diff --git a/NetworkManagement/screenshots/image.gif b/NetworkManagement/screenshots/image.gif
new file mode 100644
index 0000000000000000000000000000000000000000..91e4516f259134340751a3ae1e856c758606dd93
Binary files /dev/null and b/NetworkManagement/screenshots/image.gif differ
diff --git a/PreHttpRequestUseFiles/.gitignore b/PreHttpRequestUseFiles/.gitignore
deleted file mode 100644
index d2ff20141ceed86d87c0ea5d99481973005bab2b..0000000000000000000000000000000000000000
--- a/PreHttpRequestUseFiles/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-/node_modules
-/oh_modules
-/local.properties
-/.idea
-**/build
-/.hvigor
-.cxx
-/.clangd
-/.clang-format
-/.clang-tidy
-**/.test
-/.appanalyzer
\ No newline at end of file
diff --git a/README.md b/README.md
index b20937e3d4c0347cb35ce68d3533cf97f4d0f603..56e7772e21c162852a5a914ea7e1dc9ce50ad43d 100644
--- a/README.md
+++ b/README.md
@@ -4,9 +4,10 @@
* [AppDataSecurity: 应用数据安全](AppDataSecurity)
* [AppPrivacyProtection:应用隐私保护](AppPrivacyProtection)
-* [MultiWindowPractice: 智慧多窗开发实践](MultiWindowPractice)
-* [PreHttpRequestUseFiles:Image白块解决指导](PreHttpRequestUseFiles)
* [AvoidTimeComsume:主线程耗时操作优化指导](AvoidTimeComsume)
+* [FuzzySceneOptimization:图像模糊动效优化](FuzzySceneOptimization)
+* [NetworkManagement:网络管理与状态监听](NetworkManagement)
+* [PreHttpRequestUseFiles:Image白块解决指导](PreHttpRequestUseFiles)
## 使用说明