diff --git a/AnimationDemo/LICENSE b/AnimationDemo/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c357dc828cf7d8c783f10ed6bb1bac8a1e903c1 --- /dev/null +++ b/AnimationDemo/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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. + +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/AnimationDemo/README.md b/AnimationDemo/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dca5d5e4acedf88f26ea2adf6c485a87b6be6258 --- /dev/null +++ b/AnimationDemo/README.md @@ -0,0 +1,47 @@ +# AnimationDemo +简介 +• 此demo使用的是通用动画样式,我们通过一个简单的样例,实现了平移、旋转、缩放以及透明度变化的效果。 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? +This demo uses the general animation style. We use a simple example to implement translation, rotation, scaling, and transparency changes. + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. + diff --git a/AnimationDemo/RELEASE-NOTES.MD b/AnimationDemo/RELEASE-NOTES.MD new file mode 100644 index 0000000000000000000000000000000000000000..9087a1482627f316280b762b6c5adc73c0d438d1 --- /dev/null +++ b/AnimationDemo/RELEASE-NOTES.MD @@ -0,0 +1 @@ +1.0.0.1 Initial version \ No newline at end of file diff --git a/AnimationDemo/build.gradle b/AnimationDemo/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..053b598314427762ef9ed02bced2d2b234093d42 --- /dev/null +++ b/AnimationDemo/build.gradle @@ -0,0 +1,36 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 4 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/AnimationDemo/entry/build.gradle b/AnimationDemo/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..6618a979327905114e1a5efa61aca8805144d664 --- /dev/null +++ b/AnimationDemo/entry/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 4 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' +} +decc { + supportType = ['html', 'xml'] +} diff --git a/AnimationDemo/entry/package.json b/AnimationDemo/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/AnimationDemo/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/AnimationDemo/entry/proguard-rules.pro b/AnimationDemo/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/AnimationDemo/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/AnimationDemo/entry/src/main/config.json b/AnimationDemo/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..dcd3b9daf8d4224dabc681cceb30fc5dd52d8108 --- /dev/null +++ b/AnimationDemo/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.codelab", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.codelab", + "name": ".MyApplication", + "mainAbility": "com.huawei.codelab.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.codelab.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/AnimationDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java b/AnimationDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..dc322f31e26af610b5dc38d763fb0499fc5768bd --- /dev/null +++ b/AnimationDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.codelab; + +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; + +/** + * MainAbility + * + * @since 2021-08-13 + */ +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/AnimationDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java b/AnimationDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..187dc063c4a35a429e2be829805292c21a510910 --- /dev/null +++ b/AnimationDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.codelab; + +import ohos.aafwk.ability.AbilityPackage; + +/** + * MyApplication + * + * @since 2021-08-13 + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/AnimationDemo/entry/src/main/js/default/app.js b/AnimationDemo/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..b6ace9fa8c02f05c988f27c74b5552bfc26dac95 --- /dev/null +++ b/AnimationDemo/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 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 default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/AnimationDemo/entry/src/main/js/default/common/images/cat.png b/AnimationDemo/entry/src/main/js/default/common/images/cat.png new file mode 100644 index 0000000000000000000000000000000000000000..0776613aeac149df3b36d0fb2929f80edfd85543 Binary files /dev/null and b/AnimationDemo/entry/src/main/js/default/common/images/cat.png differ diff --git a/AnimationDemo/entry/src/main/js/default/i18n/en-US.json b/AnimationDemo/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/AnimationDemo/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/AnimationDemo/entry/src/main/js/default/i18n/zh-CN.json b/AnimationDemo/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/AnimationDemo/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/AnimationDemo/entry/src/main/js/default/pages/index/index.css b/AnimationDemo/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..d94b82e831ac9c1f9cb3441bab4f7ed0efa47b69 --- /dev/null +++ b/AnimationDemo/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2021 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. + */ + +.container { + background-color: #F8FCF5; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.img { + margin-top: 10px; + height: 100px; + width: 100px; + animation-timing-function: ease; + animation-duration: 2s; + animation-delay: 0s; + animation-fill-mode: forwards; + animation-iteration-count: infinite; +} + +.text { + font-size: 20px; +} + +.img-translate { + animation-name: translateAnim; +} + +.img-rotate { + animation-name: rotateAnim; +} + +.img-rotateY { + animation-name: rotateYAnim; +} + +.img-scale { + animation-name: scaleAnim; +} + +.img-mixes { + animation-name: mixesAnim; +} + +.img-opacity { + animation-name: opacityAnim; +} + +/*从-100px平移到100px*/ +@keyframes translateAnim { + from { + transform: translate(-100px); + } + + to { + transform: translate(100px); + } +} + +/*从0°旋转到360°*/ +@keyframes rotateAnim { + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } +} + +/*沿Y轴旋转,从0°旋转到360°*/ +@keyframes rotateYAnim { + from { + transform: rotateY(0deg); + } + + to { + transform: rotateY(360deg); + } +} + +/*从0倍缩放到1.2倍大小*/ +@keyframes scaleAnim { + from { + transform: scale(0); + } + + to { + transform: scale(1.2); + } +} + +/*不透明度值从0变化到1*/ +@keyframes opacityAnim { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + + diff --git a/AnimationDemo/entry/src/main/js/default/pages/index/index.hml b/AnimationDemo/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..0cef0f1c9f7af94237fb319af366bafa964465c5 --- /dev/null +++ b/AnimationDemo/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,25 @@ + + +
+ + translate + + rotate + + rotateY + + scale + + opacity +
diff --git a/AnimationDemo/entry/src/main/js/default/pages/index/index.js b/AnimationDemo/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c89a4e391f4a1ea4cd60dce468d20d61ec781ca7 --- /dev/null +++ b/AnimationDemo/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2021 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 default {} diff --git a/AnimationDemo/entry/src/main/resources/base/element/string.json b/AnimationDemo/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/AnimationDemo/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/AnimationDemo/entry/src/main/resources/base/media/icon.png b/AnimationDemo/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/AnimationDemo/entry/src/main/resources/base/media/icon.png differ diff --git a/AnimationDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java b/AnimationDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ac163632818a978d48332f85e6c6b4fb366af624 --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java @@ -0,0 +1,14 @@ +package com.huawei.codelab; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.huawei.cookbook", actualBundleName); + } +} \ No newline at end of file diff --git a/AnimationDemo/entry/src/ohosTest/js/default/app.js b/AnimationDemo/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/AnimationDemo/entry/src/ohosTest/js/default/i18n/en-US.json b/AnimationDemo/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/AnimationDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json b/AnimationDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.css b/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.hml b/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.js b/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8be2df2479a8da755ed800ad70d2b6247e21b8a2 --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/AnimationDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/AnimationDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/AnimationDemo/entry/src/ohosTest/js/test/List.test.js b/AnimationDemo/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/AnimationDemo/entry/src/ohosTest/resources/base/element/string.json b/AnimationDemo/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c9a7178aa896d985f3ae55b48178b37de4380c77 --- /dev/null +++ b/AnimationDemo/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AnimationDemo" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/AnimationDemo/entry/src/ohosTest/resources/base/media/icon.png b/AnimationDemo/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/AnimationDemo/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/AnimationDemo/gradle/wrapper/gradle-wrapper.jar b/AnimationDemo/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/AnimationDemo/gradle/wrapper/gradle-wrapper.jar differ diff --git a/AnimationDemo/gradle/wrapper/gradle-wrapper.properties b/AnimationDemo/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/AnimationDemo/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/AnimationDemo/settings.gradle b/AnimationDemo/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/AnimationDemo/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/ClickableImageJsDemo/LICENSE b/ClickableImageJsDemo/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..80576ef141485b36eea4aebf25af97020bc2de44 --- /dev/null +++ b/ClickableImageJsDemo/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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/ClickableImageJsDemo/README.md b/ClickableImageJsDemo/README.md new file mode 100644 index 0000000000000000000000000000000000000000..804c8180590cb0c48975b5b77662a18f49c9cdea --- /dev/null +++ b/ClickableImageJsDemo/README.md @@ -0,0 +1,46 @@ +# ClickableImageJsDemo +简介 +• HarmonyOS JSUI提供了常用的布局、组件等页面元素,并且为这些组件提供了很多属性与可监听到的事件(例如动画属性与点击、触碰事件),开发者可以根据实际场景和开发需求,选用不同的组件、事件、属性来实现界面交互效果的设计。 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? + HarmonyOS JSUI provides commonly used layout, components, and other page elements, and provides many properties and audible events (such as animated properties and click-and-touch events) for these components, allowing developers to design different components, events, and properties to achieve interface interaction based on actual scenes and development needs + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/ClickableImageJsDemo/RELEASE-NOTES.md b/ClickableImageJsDemo/RELEASE-NOTES.md new file mode 100644 index 0000000000000000000000000000000000000000..ea23a13e3d4407d06cba3aa7155a23e5081b50b4 --- /dev/null +++ b/ClickableImageJsDemo/RELEASE-NOTES.md @@ -0,0 +1,2 @@ +1.0.0 +1.Initial version \ No newline at end of file diff --git a/ClickableImageJsDemo/build.gradle b/ClickableImageJsDemo/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..ffb7d0b2406a4957aad77fd38996e79c00dccab6 --- /dev/null +++ b/ClickableImageJsDemo/build.gradle @@ -0,0 +1,36 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/ClickableImageJsDemo/entry/.gitignore b/ClickableImageJsDemo/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9 --- /dev/null +++ b/ClickableImageJsDemo/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/ClickableImageJsDemo/entry/build.gradle b/ClickableImageJsDemo/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..f4104e638c0aaf4eb3d1d8c37046528472db9722 --- /dev/null +++ b/ClickableImageJsDemo/entry/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' +} +decc { + supportType = ['html', 'xml'] +} diff --git a/ClickableImageJsDemo/entry/package.json b/ClickableImageJsDemo/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/ClickableImageJsDemo/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/ClickableImageJsDemo/entry/proguard-rules.pro b/ClickableImageJsDemo/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/ClickableImageJsDemo/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/main/config.json b/ClickableImageJsDemo/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..310deec2ebab28b05cf52be23c3355ee78a087c4 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.cookbook", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.codelab", + "name": ".MyApplication", + "mainAbility": "com.huawei.codelab.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.codelab.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java b/ClickableImageJsDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..a650b41958d05c8cfc40e3d3f15e58067b311091 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.codelab; + +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; + +/*** + * 主能力 + * + * @since 2021-07-22 + */ +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/ClickableImageJsDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java b/ClickableImageJsDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..ebaef9f3399415fb04f2c88763e10206dce016e3 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.codelab; + +import ohos.aafwk.ability.AbilityPackage; + +/*** + * 应用 + * + * @since 2021-07-22 + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/ClickableImageJsDemo/entry/src/main/js/default/app.js b/ClickableImageJsDemo/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/css/style.css b/ClickableImageJsDemo/entry/src/main/js/default/common/css/style.css new file mode 100644 index 0000000000000000000000000000000000000000..f2d37897b2724cb05494dd486db31b364893d3a0 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/js/default/common/css/style.css @@ -0,0 +1,113 @@ +.margin-left-10{ + margin-left: 10px; +} +.margin-left-20{ + margin-left: 20px; +} +.margin-left-30{ + margin-left: 30px; +} +.margin-left-40{ + margin-left: 40px; +} +.margin-left-50{ + margin-left: 50px; +} +.margin-right-10{ + margin-right: 10px; +} +.margin-right-20{ + margin-right: 20px; +} +.margin-right-30{ + margin-right: 30px; +} +.margin-right-40{ + margin-right: 40px; +} +.margin-right-50{ + margin-right: 50px; +} + +.margin-top-10{ + margin-top: 10px; +} +.margin-top-20{ + margin-top: 20px; +} +.margin-top-30{ + margin-top: 30px; +} +.margin-top-40{ + margin-top: 40px; +} +.margin-top-50{ + margin-top: 50px; +} + +.margin-bottom-10{ + margin-bottom: 10px; +} +.margin-bottom-20{ + margin-bottom: 20px; +} +.margin-bottom-30{ + margin-bottom: 30px; +} +.margin-bottom-40{ + margin-bottom: 40px; +} +.margin-bottom-50{ + margin-bottom: 50px; +} + + + +.font-size-2{ + font-size: 2px; +} +.font-size-4{ + font-size: 4px; +} +.font-size-6{ + font-size: 6px; +} +.font-size-8{ + font-size: 8px; +} +.font-size-10{ + font-size: 10px; +} +.font-size-12{ + font-size: 12px; +} +.font-size-14{ + font-size: 14px; +} +.font-size-16{ + font-size: 16px; +} +.font-size-18{ + font-size: 18px; +} +.font-size-20{ + font-size: 20px; +} +.font-size-22{ + font-size: 22px; +} +.font-size-24{ + font-size: 24px; +} +.font-size-26{ + font-size: 26px; +} +.font-size-28{ + font-size: 28px; +} +.font-size-30{ + font-size: 30px; +} + + + diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/fork.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/fork.png new file mode 100644 index 0000000000000000000000000000000000000000..35db0a141cf7bbb1ddcfd27f113c42040d8b0c1f Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/fork.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_0.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_0.png new file mode 100644 index 0000000000000000000000000000000000000000..865e7d1ff981e0b08270ef9144bf776890d4262b Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_0.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_1.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_1.png new file mode 100644 index 0000000000000000000000000000000000000000..792311f499673b07a703a46e1c049e72dbfb9965 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_1.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_10.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_10.png new file mode 100644 index 0000000000000000000000000000000000000000..19a5aa595bd45c5870e1e39a431e6563949fcec1 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_10.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_11.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_11.png new file mode 100644 index 0000000000000000000000000000000000000000..08e64c721faba2af64ef34798dadb71e93d1f32d Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_11.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_12.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_12.png new file mode 100644 index 0000000000000000000000000000000000000000..65c848007fcbe42f4bae1784dd402196d8f822ca Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_12.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_13.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_13.png new file mode 100644 index 0000000000000000000000000000000000000000..3f4323ef1699f9be712aee2b1209ce471253b4d2 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_13.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_2.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_2.png new file mode 100644 index 0000000000000000000000000000000000000000..6995dd9511facaf330ed3acfcb958168765bab66 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_2.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_3.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_3.png new file mode 100644 index 0000000000000000000000000000000000000000..74a8ec45e534463a22e3284b2a6d592e4258da14 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_3.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_4.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_4.png new file mode 100644 index 0000000000000000000000000000000000000000..6d5182d7909f4536069e063f61c012b8bcbf1956 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_4.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_5.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_5.png new file mode 100644 index 0000000000000000000000000000000000000000..0a923cce664084e7ad96686d0dd01a4b83c7425a Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_5.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_6.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_6.png new file mode 100644 index 0000000000000000000000000000000000000000..431c261935f49d8bb64278deeaea7e24acfec0ed Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_6.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_7.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_7.png new file mode 100644 index 0000000000000000000000000000000000000000..c375f9e4aa51aaf702c5f700b053fcb5eb3a1d85 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_7.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_8.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_8.png new file mode 100644 index 0000000000000000000000000000000000000000..6d605ba1244dd0209c9efb791ec8557ec748afa9 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_8.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_9.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_9.png new file mode 100644 index 0000000000000000000000000000000000000000..ef572ff0c5478a2b14f0bbfe64e53cea85db90f4 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadBack/arrowhead_back_9.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_0.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_0.png new file mode 100644 index 0000000000000000000000000000000000000000..207e396e77f4ac868c1f93269ffbe26ff091a090 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_0.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_1.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_1.png new file mode 100644 index 0000000000000000000000000000000000000000..e81084fe9a22d6ead8e2eecbec8fc3c10c58dc90 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_1.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_10.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_10.png new file mode 100644 index 0000000000000000000000000000000000000000..4aa0b4b223ea7e5124ebc60728ac8ad273ebdb69 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_10.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_11.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_11.png new file mode 100644 index 0000000000000000000000000000000000000000..a69c6485d4e582b3deba5056628d3161ade27152 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_11.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_12.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_12.png new file mode 100644 index 0000000000000000000000000000000000000000..2dc68f103d52bd25a324c7d59a4130c1d2f0e3b5 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_12.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_13.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_13.png new file mode 100644 index 0000000000000000000000000000000000000000..865e7d1ff981e0b08270ef9144bf776890d4262b Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_13.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_2.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_2.png new file mode 100644 index 0000000000000000000000000000000000000000..742f7145eb6680decc1c3961069cc373460aba27 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_2.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_3.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_3.png new file mode 100644 index 0000000000000000000000000000000000000000..7b898409609c6ccfc8fe88b4de6ac96602047e2e Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_3.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_4.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_4.png new file mode 100644 index 0000000000000000000000000000000000000000..8773c6a78d4fac6764f07cd83e4063e857c56ddc Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_4.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_5.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_5.png new file mode 100644 index 0000000000000000000000000000000000000000..0008c063632225a3da5e046f59e98ef712b62711 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_5.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_6.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_6.png new file mode 100644 index 0000000000000000000000000000000000000000..d58e6949f2563558a117f9406504937c36d5e7de Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_6.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_7.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_7.png new file mode 100644 index 0000000000000000000000000000000000000000..fccd49918e89ef6f0fe59bfce10c4c07ede46c5c Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_7.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_8.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_8.png new file mode 100644 index 0000000000000000000000000000000000000000..fc52e5a5fc30ce057d5331af1e4c42093c816f32 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_8.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_9.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_9.png new file mode 100644 index 0000000000000000000000000000000000000000..9f75e37bfd4c6db8a7a2eb1ca45feed81fad23d9 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/arrowheadCollapse/arrowhead_collapse_9.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_0.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_0.png new file mode 100644 index 0000000000000000000000000000000000000000..d7dc6ea99c4f33ee226a23b6ef82b588d15034c2 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_0.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_1.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_1.png new file mode 100644 index 0000000000000000000000000000000000000000..9d1edc6fafa9fe63aa92616d04a9c82fab67767d Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_1.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_10.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_10.png new file mode 100644 index 0000000000000000000000000000000000000000..ad886dd048df4bb85625871414d491f4149a30d8 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_10.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_11.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_11.png new file mode 100644 index 0000000000000000000000000000000000000000..3fc09a44585dd6c74d428c0394a223ab8f775a00 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_11.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_12.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_12.png new file mode 100644 index 0000000000000000000000000000000000000000..502aa7be506ac2f09d411380a3c7d10b0ec0db66 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_12.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_13.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_13.png new file mode 100644 index 0000000000000000000000000000000000000000..19d7a3b93df247ac0f3df60e5676d1add0564963 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_13.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_14.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_14.png new file mode 100644 index 0000000000000000000000000000000000000000..93d24d0e3e7b8442f24c6403ec59269ccc7e88e3 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_14.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_15.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_15.png new file mode 100644 index 0000000000000000000000000000000000000000..78f3a9b22ae9905f9e0f078eabf955e97b9ee5a6 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_15.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_16.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_16.png new file mode 100644 index 0000000000000000000000000000000000000000..bf0a6e4b47ca32c935b056288969e26a37ab21bc Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_16.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_17.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_17.png new file mode 100644 index 0000000000000000000000000000000000000000..56a1ff7231418596d77445959778e5136cfd9942 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_17.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_18.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_18.png new file mode 100644 index 0000000000000000000000000000000000000000..177b91b594b0c4a54a55f42d026a708e1a62a76c Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_18.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_19.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_19.png new file mode 100644 index 0000000000000000000000000000000000000000..008cb58a6456551dcb92ce07b24ff9d538453dd5 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_19.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_2.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_2.png new file mode 100644 index 0000000000000000000000000000000000000000..19f199ca04c2262e2e91947046d4a10aee3897e6 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_2.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_20.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_20.png new file mode 100644 index 0000000000000000000000000000000000000000..38a2b95a78fa879923919dce556eb35adb948090 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_20.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_21.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_21.png new file mode 100644 index 0000000000000000000000000000000000000000..5d8a9dd6d11f1ed09ad164dc4c63883080ba4161 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_21.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_22.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_22.png new file mode 100644 index 0000000000000000000000000000000000000000..411055b2fa93d91877a7acf9970d22df115f9729 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_22.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_23.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_23.png new file mode 100644 index 0000000000000000000000000000000000000000..191fbce09e63817a38884bb1ea3f128460e1ba68 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_23.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_24.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_24.png new file mode 100644 index 0000000000000000000000000000000000000000..43e64be46edd9f3a60e17266c5e1ec74572311a0 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_24.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_25.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_25.png new file mode 100644 index 0000000000000000000000000000000000000000..3fad6912db2e5cc3ee2140435f7685b5a99c9650 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_25.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_26.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_26.png new file mode 100644 index 0000000000000000000000000000000000000000..87d5dbf74e2de44bfc029983de9d13d528b3302e Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_26.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_27.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_27.png new file mode 100644 index 0000000000000000000000000000000000000000..68d511275719fd573094ca7199a068f31f88bd5c Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_27.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_28.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_28.png new file mode 100644 index 0000000000000000000000000000000000000000..be980c97a537fb65961eaf8209eeef0e1542a796 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_28.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_29.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_29.png new file mode 100644 index 0000000000000000000000000000000000000000..871680756a23231e931de1ae5658c9507e1c1e71 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_29.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_3.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_3.png new file mode 100644 index 0000000000000000000000000000000000000000..8cd9509573e3d81b16c7cf99b39f2e161e1fa738 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_3.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_30.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_30.png new file mode 100644 index 0000000000000000000000000000000000000000..24012c3ad404073b280643b2a365d01d9d682903 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_30.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_31.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_31.png new file mode 100644 index 0000000000000000000000000000000000000000..51a00b5fd9abc7d16d8ed4f9434e8a45f32abf70 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_31.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_32.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_32.png new file mode 100644 index 0000000000000000000000000000000000000000..b64bd83b57082cc4a8ded3d7e48ec6cd92e275ef Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_32.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_33.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_33.png new file mode 100644 index 0000000000000000000000000000000000000000..742dc96cab44c48026971caed7a8c1608c817250 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_33.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_34.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_34.png new file mode 100644 index 0000000000000000000000000000000000000000..80f891ab3064664bbcbbe768a78e578eafeafc1e Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_34.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_35.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_35.png new file mode 100644 index 0000000000000000000000000000000000000000..d174a30f6c25122ce6e6a80cf8eef852be9274e4 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_35.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_4.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_4.png new file mode 100644 index 0000000000000000000000000000000000000000..d180a0328e7629a34ac649547fcd327286adc5fe Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_4.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_5.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_5.png new file mode 100644 index 0000000000000000000000000000000000000000..3ff764f84312842b01d38232de0cc4084312e6d0 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_5.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_6.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_6.png new file mode 100644 index 0000000000000000000000000000000000000000..9fb03b79d852e766572034b7d7f68b0f62bba1ba Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_6.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_7.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_7.png new file mode 100644 index 0000000000000000000000000000000000000000..7b6a3293dfb077a18885dabda563c6981972121f Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_7.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_8.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_8.png new file mode 100644 index 0000000000000000000000000000000000000000..75ae26cb75bc8c60f98f034db35d2872acab0adb Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_8.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_9.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_9.png new file mode 100644 index 0000000000000000000000000000000000000000..7b3ec8bd509a4ac142c6482e24e48d5bcb209143 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/frames/phone/phone_9.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/hook.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/hook.png new file mode 100644 index 0000000000000000000000000000000000000000..d815c5ebc5e7a0ee4e0180c5bbba76b27d130b12 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/hook.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/common/images/sky_blue.png b/ClickableImageJsDemo/entry/src/main/js/default/common/images/sky_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..fed525962e62c58a5174005fe7d1c93dc8801962 Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/js/default/common/images/sky_blue.png differ diff --git a/ClickableImageJsDemo/entry/src/main/js/default/i18n/en-US.json b/ClickableImageJsDemo/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/main/js/default/i18n/zh-CN.json b/ClickableImageJsDemo/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.css b/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5384b96419299e6f26ad872b1a882ebf01e19747 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,49 @@ +@import '../../common/css/style.css'; +.container { + flex-direction: column; + align-items: center; +} + +.container-son-div{ + width: 100%; + height: 200px; +} +.line-div{ + flex-direction: column; + width: 50%; + height: 180px; +} +.line-div-son{ + flex-direction: column; + width: 100%; + align-items: center; + justify-content: center; +} +.text-div{ + position: absolute; + bottom: 0; + left: 50%; + transform: translate(-50%, -50%); +} + +.img-normal{ + width:80px; + height:80px +} + +.main-img-unTouch{ + width: 100px; + height: 100px; + border:0px solid #777676; +} + +.main-img-touch{ + width: 110px; + height: 110px; + border:4px solid #777676; +} + +.animator { + width: 100px; + height: 100px; +} diff --git a/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.hml b/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..56dadb6198b79dff8d1da652dc209734763f2a3b --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,38 @@ +
+
+
+
+ +
+
+ {{imageNormal.title}} +
+
+
+
+ +
+
+ {{imageSelect.title}} +
+
+
+
+
+
+ +
+
+ {{frameContainerPhone.title}} +
+
+
+
+ +
+
+ {{frameContainerState.title}} +
+
+
+
diff --git a/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.js b/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..57aa343d7b0c2e8efc4b833073baaf37a0e34db9 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,140 @@ +export default { + data: { + imageNormal: { + classType: 'main-img-unTouch', + src: '/common/images/sky_blue.png', + title: '点击阴影' + }, + imageSelect: { + src: '/common/images/hook.png', + title: '点击切换状态', + hook: true + }, + frameContainerPhone: { + frames: [ + {src: '/common/images/frames/phone/phone_0.png'}, + {src: '/common/images/frames/phone/phone_1.png'}, + {src: '/common/images/frames/phone/phone_2.png'}, + {src: '/common/images/frames/phone/phone_3.png'}, + {src: '/common/images/frames/phone/phone_4.png'}, + {src: '/common/images/frames/phone/phone_5.png'}, + {src: '/common/images/frames/phone/phone_6.png'}, + {src: '/common/images/frames/phone/phone_7.png'}, + {src: '/common/images/frames/phone/phone_8.png'}, + {src: '/common/images/frames/phone/phone_9.png'}, + {src: '/common/images/frames/phone/phone_10.png'}, + {src: '/common/images/frames/phone/phone_11.png'}, + {src: '/common/images/frames/phone/phone_12.png'}, + {src: '/common/images/frames/phone/phone_13.png'}, + {src: '/common/images/frames/phone/phone_14.png'}, + {src: '/common/images/frames/phone/phone_15.png'}, + {src: '/common/images/frames/phone/phone_16.png'}, + {src: '/common/images/frames/phone/phone_17.png'}, + {src: '/common/images/frames/phone/phone_18.png'}, + {src: '/common/images/frames/phone/phone_19.png'}, + {src: '/common/images/frames/phone/phone_20.png'}, + {src: '/common/images/frames/phone/phone_21.png'}, + {src: '/common/images/frames/phone/phone_22.png'}, + {src: '/common/images/frames/phone/phone_23.png'}, + {src: '/common/images/frames/phone/phone_24.png'}, + {src: '/common/images/frames/phone/phone_25.png'}, + {src: '/common/images/frames/phone/phone_26.png'}, + {src: '/common/images/frames/phone/phone_27.png'}, + {src: '/common/images/frames/phone/phone_28.png'}, + {src: '/common/images/frames/phone/phone_29.png'}, + {src: '/common/images/frames/phone/phone_30.png'}, + {src: '/common/images/frames/phone/phone_31.png'}, + {src: '/common/images/frames/phone/phone_32.png'}, + {src: '/common/images/frames/phone/phone_33.png'}, + {src: '/common/images/frames/phone/phone_34.png'}, + {src: '/common/images/frames/phone/phone_35.png'} + ], + title: '点击动画效果', + durationTime: 3600 + }, + frameContainerState: { + frames: [], + title: '点击切换状态动效', + durationTime: 0, + flag: true + }, + durationTimeArray: [1400, 1400], + back: [ + {src: '/common/images/frames/arrowheadBack/arrowhead_back_0.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_1.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_2.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_3.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_4.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_5.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_6.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_7.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_8.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_9.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_10.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_11.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_12.png'}, + {src: '/common/images/frames/arrowheadBack/arrowhead_back_13.png'} + ], + collapse: [ + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_0.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_1.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_2.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_3.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_4.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_5.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_6.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_7.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_8.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_9.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_10.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_11.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_12.png'}, + {src: '/common/images/frames/arrowheadCollapse/arrowhead_collapse_13.png'} + ] + }, + // 初始化 + onInit() { + this.frameContainerState.frames = this.back; + this.frameContainerState.durationTime = 0; + this.frameContainerPhone.durationTime = 0; + }, + // 触碰阴影方法 + changeHookState() { + if (this.imageSelect.hook) { + this.imageSelect.src = '/common/images/fork.png'; + this.imageSelect.hook = false; + } else { + this.imageSelect.src = '/common/images/hook.png'; + this.imageSelect.hook = true; + } + }, + // 点击切换状态 + changeShadow(flag) { + if (flag) { + this.imageNormal.classType = 'main-img-touch'; + } else { + this.imageNormal.classType = 'main-img-unTouch'; + } + }, + // 点击动画效果方法 + handleStartFrameContainerPhone() { + this.frameContainerPhone.durationTime = 3600; + this.$refs.frameContainerPhone.start(); + }, + // 点击切换状态动效方法 + handleStartFrameContainerState() { + if (this.frameContainerState.flag) { + this.frameContainerState.frames = this.collapse; + this.frameContainerState.durationTime = this.durationTimeArray[0]; + this.$refs.frameContainerState.start(); + this.frameContainerState.flag = false; + this.$refs.frameContainerState.stop(); + } else { + this.frameContainerState.frames = this.back; + this.frameContainerState.durationTime = this.durationTimeArray[1]; + this.$refs.frameContainerState.start(); + this.frameContainerState.flag = true; + this.$refs.frameContainerState.stop(); + } + } +}; diff --git a/ClickableImageJsDemo/entry/src/main/resources/base/element/string.json b/ClickableImageJsDemo/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0e974a99c5a20d3482090c686f02e0e0995c192c --- /dev/null +++ b/ClickableImageJsDemo/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "ClickableJsImage" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/main/resources/base/media/icon.png b/ClickableImageJsDemo/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ClickableImageJsDemo/entry/src/main/resources/base/media/icon.png differ diff --git a/ClickableImageJsDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java b/ClickableImageJsDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..14b7d6de20b7e60fd1672df6bd7c7a2e737fdd45 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java @@ -0,0 +1,14 @@ +package com.huawei.codelab; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.huawei.codelab", actualBundleName); + } +} \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/ohosTest/js/default/app.js b/ClickableImageJsDemo/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/ClickableImageJsDemo/entry/src/ohosTest/js/default/i18n/en-US.json b/ClickableImageJsDemo/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json b/ClickableImageJsDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.css b/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.hml b/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.js b/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8be2df2479a8da755ed800ad70d2b6247e21b8a2 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/ClickableImageJsDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/ohosTest/js/test/List.test.js b/ClickableImageJsDemo/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/ClickableImageJsDemo/entry/src/ohosTest/resources/base/element/string.json b/ClickableImageJsDemo/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..528489076b491714fe10625aaf39b4cef9f590a8 --- /dev/null +++ b/ClickableImageJsDemo/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ClickableImageJsDemo" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/ClickableImageJsDemo/entry/src/ohosTest/resources/base/media/icon.png b/ClickableImageJsDemo/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ClickableImageJsDemo/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/ClickableImageJsDemo/gradle/wrapper/gradle-wrapper.jar b/ClickableImageJsDemo/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/ClickableImageJsDemo/gradle/wrapper/gradle-wrapper.jar differ diff --git a/ClickableImageJsDemo/gradle/wrapper/gradle-wrapper.properties b/ClickableImageJsDemo/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/ClickableImageJsDemo/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/ClickableImageJsDemo/settings.gradle b/ClickableImageJsDemo/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/ClickableImageJsDemo/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/ComposeLargeWatermelon/entry/build.gradle b/ComposeLargeWatermelon/entry/build.gradle index f0df1c528df6fbce316968d399adfa48a86e133e..c83c49989970f951c116598dccc7cadf3fc6ede7 100644 --- a/ComposeLargeWatermelon/entry/build.gradle +++ b/ComposeLargeWatermelon/entry/build.gradle @@ -16,17 +16,6 @@ apply plugin: 'com.huawei.ohos.hap' apply plugin: 'com.huawei.ohos.decctest' ohos { - signingConfigs { - debug { - storeFile file('D:\\证书\\ide_acg_pk.p12') - storePassword '0000001861589C0C0FA67E58013A648F89C1A4B4EAFA0853BD711FA6AF2ABC4A0EC0C35E41EEBBF9' - keyAlias = 'ide_acg_pk' - keyPassword '00000018C1B253B9A7F967965176C7FB444EF451340B59747DF2A7AB3934FB6B653D4C0B4680BF71' - signAlg = 'SHA256withECDSA' - profile file('D:\\证书\\cookbookDebug.p7b') - certpath file('D:\\证书\\ide_acg.cer') - } - } compileSdkVersion 5 defaultConfig { compatibleSdkVersion 4 diff --git a/DialogDemo/LICENSE b/DialogDemo/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c357dc828cf7d8c783f10ed6bb1bac8a1e903c1 --- /dev/null +++ b/DialogDemo/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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. + +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/DialogDemo/README.md b/DialogDemo/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d55ccc6a1f24d85f868621570b70a33628dc89fb --- /dev/null +++ b/DialogDemo/README.md @@ -0,0 +1,46 @@ +# DialogDemo +简介 +• 此Demo使用JS UI中的dialog组件,实现了dialog的几种常用的效果,点击界面上不同的button呈现不同样式的dialog。 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? +This demo uses the dialog component in the JS UI to implement several common dialog effects. You can click different buttons on the UI to display different dialog styles. + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/DialogDemo/RELEASE-NOTES.MD b/DialogDemo/RELEASE-NOTES.MD new file mode 100644 index 0000000000000000000000000000000000000000..9087a1482627f316280b762b6c5adc73c0d438d1 --- /dev/null +++ b/DialogDemo/RELEASE-NOTES.MD @@ -0,0 +1 @@ +1.0.0.1 Initial version \ No newline at end of file diff --git a/DialogDemo/build.gradle b/DialogDemo/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..053b598314427762ef9ed02bced2d2b234093d42 --- /dev/null +++ b/DialogDemo/build.gradle @@ -0,0 +1,36 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 4 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/DialogDemo/entry/build.gradle b/DialogDemo/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..6618a979327905114e1a5efa61aca8805144d664 --- /dev/null +++ b/DialogDemo/entry/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 4 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' +} +decc { + supportType = ['html', 'xml'] +} diff --git a/DialogDemo/entry/package.json b/DialogDemo/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/DialogDemo/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/DialogDemo/entry/proguard-rules.pro b/DialogDemo/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/DialogDemo/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/DialogDemo/entry/src/main/config.json b/DialogDemo/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d317ab40c8281696e270e3d855551360eb4755 --- /dev/null +++ b/DialogDemo/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.codelab", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.codelab", + "name": ".MyApplication", + "mainAbility": "com.huawei.codelab.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.codelab.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/DialogDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java b/DialogDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..dc322f31e26af610b5dc38d763fb0499fc5768bd --- /dev/null +++ b/DialogDemo/entry/src/main/java/com/huawei/codelab/MainAbility.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.codelab; + +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; + +/** + * MainAbility + * + * @since 2021-08-13 + */ +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/DialogDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java b/DialogDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..187dc063c4a35a429e2be829805292c21a510910 --- /dev/null +++ b/DialogDemo/entry/src/main/java/com/huawei/codelab/MyApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.codelab; + +import ohos.aafwk.ability.AbilityPackage; + +/** + * MyApplication + * + * @since 2021-08-13 + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/DialogDemo/entry/src/main/js/default/app.js b/DialogDemo/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..b6ace9fa8c02f05c988f27c74b5552bfc26dac95 --- /dev/null +++ b/DialogDemo/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 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 default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/DialogDemo/entry/src/main/js/default/common/images/loading.svg b/DialogDemo/entry/src/main/js/default/common/images/loading.svg new file mode 100644 index 0000000000000000000000000000000000000000..0e4ff20df418870172b0a4b3a09bf96d6fb3c1ea --- /dev/null +++ b/DialogDemo/entry/src/main/js/default/common/images/loading.svg @@ -0,0 +1 @@ +loading \ No newline at end of file diff --git a/DialogDemo/entry/src/main/js/default/i18n/en-US.json b/DialogDemo/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/DialogDemo/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/DialogDemo/entry/src/main/js/default/i18n/zh-CN.json b/DialogDemo/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/DialogDemo/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/DialogDemo/entry/src/main/js/default/pages/index/index.css b/DialogDemo/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..3bd3534d2acc27b21397653bae0e507bbdd861d3 --- /dev/null +++ b/DialogDemo/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2021 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. + */ + +.doc-page { + height: 100%; + flex-direction: column; + background-color: #E3f8F9; + justify-content: center; + align-items: center; +} + +.btn-div { + width: 100%; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.btn { + background-color: #17A98E; + margin-top: 15px; + width: 80%; + font-weight: bold; +} + +.btn-text { + color: #000000; + font-weight: bold; + font-size: 39px; +} + +.dialog-main { + width: 80%; + margin-bottom: 40%; +} + +.dialog-div { + flex-direction: column; + align-items: center; +} + +.inner-txt { + height: 120px; + flex-direction: column; + align-items: center; + justify-content: space-around; +} + +.inner-btn { + height: 80px; + justify-content: center; + align-items: center; +} + +.alert-inner-txt { + height: 120px; + flex-direction: column; + align-items: center; + justify-content: space-around; +} + +.alert-inner-btn { + height: 80px; + justify-content: space-around; + align-items: center; +} + +.alert-dialog { + width: 80%; + margin-bottom: 40%; +} diff --git a/DialogDemo/entry/src/main/js/default/pages/index/index.hml b/DialogDemo/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f07476dbb07a08dc7797dedb68317c19d4362872 --- /dev/null +++ b/DialogDemo/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,88 @@ + + +
+
+ + + + + +
+ + +
+
+ AlertDialog +
+
+ +
+
+
+ + +
+
+ ConfirmDialog +
+
+ + +
+
+
+ + +
+ + loading... +
+
+ + +
+
+ PromptDialog +
+ + +
+ + +
+
+
+ + +
+ Downloading... +
+ +
+ Image {{ percent / 10 }} of 10 +
+
+ +
\ No newline at end of file diff --git a/DialogDemo/entry/src/main/js/default/pages/index/index.js b/DialogDemo/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..07c361cd3e933ac0e5fc0deba71c76f4deda29a7 --- /dev/null +++ b/DialogDemo/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2021 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 prompt from '@system.prompt'; + +export default { + data: { + percent: 0, + interval: '' + }, + showAlert() { + this.$element('alertDialog').show(); + }, + showConfirm() { + this.$element('confirmDialog').show(); + }, + showLoading() { + const options = { + duration: 800, + easing: 'linear', + iterations: 'Infinity' + }; + const frames = [ + { + transform: { + rotate: '0deg' + } + }, + { + transform: { + rotate: '360deg' + } + } + ]; + this.animation = this.$element('loading-img').animate(frames, options); + this.$element('loadingDialog').show(); + this.animation.play(); + }, + showPrompt() { + this.$element('promptDialog').show(); + }, + showProgress() { + const that = this; + that.percent = 0; + this.$element('progressDialog').show(); + this.interval = setInterval(function() { + that.percent += 10; + if (that.percent >= 100) { + clearInterval(that.interval); + } + }, 500); + }, + confirmClick(id) { + this.$element(id).close(); + prompt.showToast({ + message: 'confirm clicked' + }); + }, + cancelClick(id) { + this.$element(id).close(); + prompt.showToast({ + message: 'cancel clicked' + }); + }, + onCancel(){ + clearInterval(this.interval); + } +}; diff --git a/DialogDemo/entry/src/main/resources/base/element/string.json b/DialogDemo/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/DialogDemo/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/DialogDemo/entry/src/main/resources/base/media/icon.png b/DialogDemo/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/DialogDemo/entry/src/main/resources/base/media/icon.png differ diff --git a/DialogDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java b/DialogDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..526e3ebd3b369b4607dc1cd5b10a32170a95d4df --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/java/com/huawei/codelab/ExampleOhosTest.java @@ -0,0 +1,14 @@ +package com.huawei.codelab; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.huawei.cook", actualBundleName); + } +} \ No newline at end of file diff --git a/DialogDemo/entry/src/ohosTest/js/default/app.js b/DialogDemo/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/DialogDemo/entry/src/ohosTest/js/default/i18n/en-US.json b/DialogDemo/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/DialogDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json b/DialogDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.css b/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.hml b/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.js b/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8be2df2479a8da755ed800ad70d2b6247e21b8a2 --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/DialogDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/DialogDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/DialogDemo/entry/src/ohosTest/js/test/List.test.js b/DialogDemo/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/DialogDemo/entry/src/ohosTest/resources/base/element/string.json b/DialogDemo/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a684103ee4a87317cc17dd96b98fc3f6f644249f --- /dev/null +++ b/DialogDemo/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "DialogDemo" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/DialogDemo/entry/src/ohosTest/resources/base/media/icon.png b/DialogDemo/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/DialogDemo/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/DialogDemo/gradle/wrapper/gradle-wrapper.jar b/DialogDemo/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/DialogDemo/gradle/wrapper/gradle-wrapper.jar differ diff --git a/DialogDemo/gradle/wrapper/gradle-wrapper.properties b/DialogDemo/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/DialogDemo/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/DialogDemo/settings.gradle b/DialogDemo/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/DialogDemo/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/InputApplication/LICENSE b/InputApplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c357dc828cf7d8c783f10ed6bb1bac8a1e903c1 --- /dev/null +++ b/InputApplication/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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. + +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/InputApplication/README.md b/InputApplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fe65630d1bcd0def9dbc94b07ea98302c4b6237c --- /dev/null +++ b/InputApplication/README.md @@ -0,0 +1,46 @@ +# InputApplication +简介 +• 此Demo使用JS UI中的input组件,实现输入框和表单提交。您可以在input输入框输入内容,长按input输入框对输入内容进行翻译、分享、查找等操作,点击提交按钮时对必填项进行校验。 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? +This demo uses the input text box to submit forms. You can enter content in the input text box, touch and hold the input text box to translate, share, and search the content, and verify mandatory fields when you click Submit. + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/InputApplication/RELEASE-NOTES.MD b/InputApplication/RELEASE-NOTES.MD new file mode 100644 index 0000000000000000000000000000000000000000..9087a1482627f316280b762b6c5adc73c0d438d1 --- /dev/null +++ b/InputApplication/RELEASE-NOTES.MD @@ -0,0 +1 @@ +1.0.0.1 Initial version \ No newline at end of file diff --git a/InputApplication/build.gradle b/InputApplication/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..ffb7d0b2406a4957aad77fd38996e79c00dccab6 --- /dev/null +++ b/InputApplication/build.gradle @@ -0,0 +1,36 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/InputApplication/entry/.gitignore b/InputApplication/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9 --- /dev/null +++ b/InputApplication/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/InputApplication/entry/build.gradle b/InputApplication/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..2f6bd135a45bd58668f8972730ed502860d69113 --- /dev/null +++ b/InputApplication/entry/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' +} +decc { + supportType = ['html','xml'] +} diff --git a/InputApplication/entry/package.json b/InputApplication/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/InputApplication/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/InputApplication/entry/proguard-rules.pro b/InputApplication/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/InputApplication/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/InputApplication/entry/src/main/config.json b/InputApplication/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..251d271536fa4d876b012355a68b2d0d4ba9ba13 --- /dev/null +++ b/InputApplication/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.cookbook", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.cookbook", + "name": ".MyApplication", + "mainAbility": "com.huawei.cookbook.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.cookbook.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/InputApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java b/InputApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..b6b069e2d058d44a4e69c0fc994d18f79b16d0b1 --- /dev/null +++ b/InputApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; + +/** + * mainAbility + * + * @since 2021-08-01 + * + */ +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/InputApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java b/InputApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..6cedbab02ce50255c20556435d2e2360659ff817 --- /dev/null +++ b/InputApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.aafwk.ability.AbilityPackage; + +/** + * myApplication + * + * @since 2021-08-01 + * + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/InputApplication/entry/src/main/js/default/app.js b/InputApplication/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/InputApplication/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/InputApplication/entry/src/main/js/default/common/images/Wallpaper.png b/InputApplication/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/InputApplication/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/InputApplication/entry/src/main/js/default/common/images/bg-tv.jpg b/InputApplication/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/InputApplication/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/InputApplication/entry/src/main/js/default/common/images/require.png b/InputApplication/entry/src/main/js/default/common/images/require.png new file mode 100644 index 0000000000000000000000000000000000000000..d0860084482180c79e480fcfa151202bf26fdafa Binary files /dev/null and b/InputApplication/entry/src/main/js/default/common/images/require.png differ diff --git a/InputApplication/entry/src/main/js/default/i18n/en-US.json b/InputApplication/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/InputApplication/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/InputApplication/entry/src/main/js/default/i18n/zh-CN.json b/InputApplication/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/InputApplication/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/InputApplication/entry/src/main/js/default/pages/index/index.css b/InputApplication/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..1d520a325772bb26cbaa955ced46a85b0ecb313a --- /dev/null +++ b/InputApplication/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,45 @@ +.container { + flex-direction: column; + align-items: center; +} +.input-form { + width: 100%; + justify-content: center; + margin-top: 10px; + margin-bottom: 10px; +} +.form-text { + font-size: 20px; +} +.row { + width: 98%; + margin-top: 5px; + flex-direction: row; +} +.label { + font-size: 13px; + width: 120px; + text-align: right; +} +.input-block { + width: 100%; +} +.input { + width: 90%; + font-size: 12px; +} +.password-tip { + font-size: 10px; +} +.sex { + font-size: 10px; + margin-right: 10px; +} +.favorite { + font-size: 10px; +} +.button { + margin-top: 70px; + width: 150px; + background-color: #17A98E; +} diff --git a/InputApplication/entry/src/main/js/default/pages/index/index.hml b/InputApplication/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..e5f93d40025a2065d7416dd1ab8faf36c55f028d --- /dev/null +++ b/InputApplication/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,66 @@ +
+
+ input 表单 +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + 女 + +
+
+
+ +
+ + 游泳 + + 健身 + + 足球 + + 篮球 +
+
+ + + +
diff --git a/InputApplication/entry/src/main/js/default/pages/index/index.js b/InputApplication/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ac2cc80a022dbc13046eacf4f233d7b38ef9823c --- /dev/null +++ b/InputApplication/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,81 @@ +import prompt from '@system.prompt'; + +export default { + data: { + require: '/common/images/require.png', + username: '', + password: '', + password2: '', + email: '', + date: '', + height: '', + favorite: [], + list: [{icon: '/common/images/require.png', content: '选项0'}, + {icon: '/common/images/require.png', content: '选项1'}] + }, + // 文本框内容发生变化 + change(e) { + const idName = e.target.id; + if (idName === 'username') { + this.username = e.value; + } else if (idName === 'password') { + this.password = e.value; + } else if (idName === 'password2') { + this.password2 = e.value; + } else if (idName === 'email') { + this.email = e.value; + } else if (idName === 'date') { + this.date = e.value; + } else if (idName === 'height') { + this.height = e.value; + } + }, + // 复选框修改 + checkboxOnChange(e) { + const value = e.target.attr.value; + if (e.checked) { + this.favorite.push(value); + } else { + this.favorite.splice(this.favorite.findIndex(e => e === value), 1); + } + }, + // 提交 + buttonClick() { + if (this.username === '') { + this.showPrompt('用户名不能为空'); + } else if (this.password === '') { + this.showPrompt('密码不能为空'); + } else if (this.password !== '' && this.password !== this.password2) { + this.showPrompt('两次密码输入不一致'); + } else if (this.email === '') { + this.showPrompt('邮箱不能为空'); + } else if (this.favorite.length === 0) { + this.showPrompt('请至少选择一个爱好'); + } else { + this.showPrompt('提交成功'); + } + }, + // 弹框 + showPrompt(msg) { + prompt.showToast({ + message: msg, + duration: 3000 + }); + }, + // 进行文本选择操作后文本选择弹窗会出现翻译按钮 + translate(e) { + this.showPrompt(e.value); + }, + // 进行文本选择操作后文本选择弹窗会出现分享按钮 + share(e) { + this.showPrompt(e.value); + }, + // 进行文本选择操作后文本选择弹窗会出现查找按钮 + search(e) { + this.showPrompt(e.value); + }, + // 用户在文本选择操作后,点击菜单项后触发该回调 + optionselect(e) { + this.showPrompt('选项' + e.index + ': ' + e.value); + } +}; diff --git a/InputApplication/entry/src/main/resources/base/element/string.json b/InputApplication/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..68809f0676300522d28cb2200701ac02ecec1ce3 --- /dev/null +++ b/InputApplication/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "input" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/InputApplication/entry/src/main/resources/base/media/icon.png b/InputApplication/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/InputApplication/entry/src/main/resources/base/media/icon.png differ diff --git a/InputApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java b/InputApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bf27899ae844b18c931cc6c9841267cbdb2c717c --- /dev/null +++ b/InputApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java @@ -0,0 +1,14 @@ +package com.huawei.cookbook; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.huawei.cookbook", actualBundleName); + } +} \ No newline at end of file diff --git a/InputApplication/entry/src/ohosTest/js/default/app.js b/InputApplication/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/InputApplication/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/InputApplication/entry/src/ohosTest/js/default/i18n/en-US.json b/InputApplication/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/InputApplication/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/InputApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json b/InputApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/InputApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/InputApplication/entry/src/ohosTest/js/default/pages/index/index.css b/InputApplication/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/InputApplication/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/InputApplication/entry/src/ohosTest/js/default/pages/index/index.hml b/InputApplication/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/InputApplication/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/InputApplication/entry/src/ohosTest/js/default/pages/index/index.js b/InputApplication/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8be2df2479a8da755ed800ad70d2b6247e21b8a2 --- /dev/null +++ b/InputApplication/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/InputApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/InputApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/InputApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/InputApplication/entry/src/ohosTest/js/test/List.test.js b/InputApplication/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/InputApplication/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/InputApplication/entry/src/ohosTest/resources/base/element/string.json b/InputApplication/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c1891e5a373ef700608709ec454185ecfd769efc --- /dev/null +++ b/InputApplication/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "InputApplication" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/InputApplication/entry/src/ohosTest/resources/base/media/icon.png b/InputApplication/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/InputApplication/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/InputApplication/gradle/wrapper/gradle-wrapper.jar b/InputApplication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/InputApplication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/InputApplication/gradle/wrapper/gradle-wrapper.properties b/InputApplication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/InputApplication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/InputApplication/settings.gradle b/InputApplication/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/InputApplication/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/RatingApplication/LICENSE b/RatingApplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c357dc828cf7d8c783f10ed6bb1bac8a1e903c1 --- /dev/null +++ b/RatingApplication/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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. + +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/RatingApplication/README.md b/RatingApplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4dbd91371d442d287d326bda9ba7d6cbb0d21af4 --- /dev/null +++ b/RatingApplication/README.md @@ -0,0 +1,46 @@ +# RatingApplication +简介 +• 此Demo使用JS UI中的rating组件,我们将会通过一个简单的样例,实现一个星级打分的效果 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? +This demo uses the rating component of the JS UI. We will use a simple example to achieve a star rating effect. + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/RatingApplication/RELEASE-NOTES.MD b/RatingApplication/RELEASE-NOTES.MD new file mode 100644 index 0000000000000000000000000000000000000000..9087a1482627f316280b762b6c5adc73c0d438d1 --- /dev/null +++ b/RatingApplication/RELEASE-NOTES.MD @@ -0,0 +1 @@ +1.0.0.1 Initial version \ No newline at end of file diff --git a/RatingApplication/build.gradle b/RatingApplication/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..446fc5b42cf8013148be318ba66aae0480fdbc1b --- /dev/null +++ b/RatingApplication/build.gradle @@ -0,0 +1,33 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 +} + +buildscript { + repositories { + maven { + url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/' + } + maven { + url 'http://mirrors.tools.huawei.com/maven/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.3' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/' + } + maven { + url 'http://mirrors.tools.huawei.com/maven/' + } + } +} diff --git a/RatingApplication/entry/.gitignore b/RatingApplication/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..7d5b7a94f4dcf381f03ff21f28f8a2494b58023f --- /dev/null +++ b/RatingApplication/entry/.gitignore @@ -0,0 +1,2 @@ +/build +/node_modules diff --git a/RatingApplication/entry/build.gradle b/RatingApplication/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4ff8bc645e758cc5dacdcfe1bfb22a1d5348e736 --- /dev/null +++ b/RatingApplication/entry/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 4 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' +} +decc { + supportType = ['html','xml'] +} diff --git a/RatingApplication/entry/package.json b/RatingApplication/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/RatingApplication/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/RatingApplication/entry/proguard-rules.pro b/RatingApplication/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/RatingApplication/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/RatingApplication/entry/src/main/config.json b/RatingApplication/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..251d271536fa4d876b012355a68b2d0d4ba9ba13 --- /dev/null +++ b/RatingApplication/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.cookbook", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.cookbook", + "name": ".MyApplication", + "mainAbility": "com.huawei.cookbook.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.cookbook.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/RatingApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java b/RatingApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..3234f850f728adc5dd5c36c2b154c589c6169181 --- /dev/null +++ b/RatingApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.ace.ability.AceAbility; +import ohos.aafwk.content.Intent; + +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/RatingApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java b/RatingApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..895a036f1ce5aa807c5fbe71fd9fcb37243b26cb --- /dev/null +++ b/RatingApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/RatingApplication/entry/src/main/js/default/app.js b/RatingApplication/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/RatingApplication/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/RatingApplication/entry/src/main/js/default/common/asserts/zdy1.png b/RatingApplication/entry/src/main/js/default/common/asserts/zdy1.png new file mode 100644 index 0000000000000000000000000000000000000000..1ad916aa5118544bc956de58e13881bf38662948 Binary files /dev/null and b/RatingApplication/entry/src/main/js/default/common/asserts/zdy1.png differ diff --git a/RatingApplication/entry/src/main/js/default/common/asserts/zdy2.png b/RatingApplication/entry/src/main/js/default/common/asserts/zdy2.png new file mode 100644 index 0000000000000000000000000000000000000000..e307c68c4eb48835d71b7021d4b2d08c4191a407 Binary files /dev/null and b/RatingApplication/entry/src/main/js/default/common/asserts/zdy2.png differ diff --git a/RatingApplication/entry/src/main/js/default/common/asserts/zdy3.png b/RatingApplication/entry/src/main/js/default/common/asserts/zdy3.png new file mode 100644 index 0000000000000000000000000000000000000000..d9e099b3fdaf654b54e8e88aadabfe97321f851c Binary files /dev/null and b/RatingApplication/entry/src/main/js/default/common/asserts/zdy3.png differ diff --git a/RatingApplication/entry/src/main/js/default/common/images/Wallpaper.png b/RatingApplication/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/RatingApplication/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/RatingApplication/entry/src/main/js/default/common/images/bg-tv.jpg b/RatingApplication/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/RatingApplication/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/RatingApplication/entry/src/main/js/default/i18n/en-US.json b/RatingApplication/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/RatingApplication/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/RatingApplication/entry/src/main/js/default/i18n/zh-CN.json b/RatingApplication/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/RatingApplication/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/RatingApplication/entry/src/main/js/default/pages/index/index.css b/RatingApplication/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b07361cb184b2c47eff6d69b130330df6da7a268 --- /dev/null +++ b/RatingApplication/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,53 @@ +/* 页面整体纵向布局 */ +.container { + flex-direction: column;/* justify-content: center;*/ + align-items: center; + padding-top: 30px; + +} + +/* 平均分等级样式 */ + +.rate { + width: 200px; + height: 45px; + margin-top: 20px; +} + +/* 字体样式 */ + +.avgText { + text-align: center; + font-size: 20px; + width: 200px; + color: #5A554D; + margin-top: 80px; + font-weight: 900 +} + +/*自定义星级布局 */ + +.rateRed { + star-background: url("/common/asserts/zdy1.png"); + star-foreground: url("/common/asserts/zdy2.png"); + star-secondary: url("/common/asserts/zdy3.png"); + width: 200px; + height: 45px; +} + +.rateBlue { + star-background: url("/common/asserts/zdy1.png"); + star-foreground: url("/common/asserts/zdy2.png"); + star-secondary: url("/common/asserts/zdy3.png"); + width: 200px; + height: 45px; + margin-top: 10px; +} + +.rateGreen { + star-background: url("/common/asserts/zdy1.png"); + star-foreground: url("/common/asserts/zdy2.png"); + star-secondary: url("/common/asserts/zdy3.png"); + width: 200px; + height: 45px; +} diff --git a/RatingApplication/entry/src/main/js/default/pages/index/index.hml b/RatingApplication/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..9595b11d6facc371befed705c31e5043e341be72 --- /dev/null +++ b/RatingApplication/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,8 @@ +
+ 自定义星级打分 + + + + 平均分等级 + +
diff --git a/RatingApplication/entry/src/main/js/default/pages/index/index.js b/RatingApplication/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bfd21718c625b4f9b7e679c416a3ea0820dad01e --- /dev/null +++ b/RatingApplication/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,37 @@ +import prompt from '@system.prompt'; + +export default { + data: { + red: 2.5, + blue: 3, + green: 1.5, + avg: 2.3 + }, + rateRed(e) { + this.red = e.rating + var value = (this.red + this.blue + this.green) / 3 + this.avg = value.toFixed(1) + prompt.showToast({ + message: '平均分 ' + this.avg + '分', + duration: 3000, + }); + }, + rateBlue(e) { + this.blue = e.rating + var value = (this.red + this.blue + this.green) / 3 + this.avg = value.toFixed(1) + prompt.showToast({ + message: '平均分 ' + this.avg + '分', + duration: 3000, + }); + }, + rateGreen(e) { + this.green = e.rating + var value = (this.red + this.blue + this.green) / 3 + this.avg = value.toFixed(1) + prompt.showToast({ + message: '平均分 ' + this.avg + '分', + duration: 3000, + }); + } +} diff --git a/RatingApplication/entry/src/main/resources/base/element/string.json b/RatingApplication/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/RatingApplication/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/RatingApplication/entry/src/main/resources/base/media/icon.png b/RatingApplication/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/RatingApplication/entry/src/main/resources/base/media/icon.png differ diff --git a/RatingApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java b/RatingApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bf27899ae844b18c931cc6c9841267cbdb2c717c --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java @@ -0,0 +1,14 @@ +package com.huawei.cookbook; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.huawei.cookbook", actualBundleName); + } +} \ No newline at end of file diff --git a/RatingApplication/entry/src/ohosTest/js/default/app.js b/RatingApplication/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/RatingApplication/entry/src/ohosTest/js/default/i18n/en-US.json b/RatingApplication/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/RatingApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json b/RatingApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.css b/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.hml b/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.js b/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8be2df2479a8da755ed800ad70d2b6247e21b8a2 --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/RatingApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/RatingApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/RatingApplication/entry/src/ohosTest/js/test/List.test.js b/RatingApplication/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/RatingApplication/entry/src/ohosTest/resources/base/element/string.json b/RatingApplication/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d70e2483a05f914084cebcf1c4c2775b19d1e6b9 --- /dev/null +++ b/RatingApplication/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "RatingApplication" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/RatingApplication/entry/src/ohosTest/resources/base/media/icon.png b/RatingApplication/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/RatingApplication/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/RatingApplication/gradle/wrapper/gradle-wrapper.jar b/RatingApplication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/RatingApplication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/RatingApplication/gradle/wrapper/gradle-wrapper.properties b/RatingApplication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/RatingApplication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/RatingApplication/settings.gradle b/RatingApplication/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/RatingApplication/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/SliderApplication/LICENSE b/SliderApplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c357dc828cf7d8c783f10ed6bb1bac8a1e903c1 --- /dev/null +++ b/SliderApplication/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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. + +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/SliderApplication/README.md b/SliderApplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..aca5f47060dd67404676b8181f58fbba00f88a65 --- /dev/null +++ b/SliderApplication/README.md @@ -0,0 +1,46 @@ +# SliderApplication +简介 +• 此Demo使用JS UI中的slider、image组件和动画样式,实现拖拽slider控制风车图片的转速和大小。您可以通过设置slider的值改变image的转速和图片大小。 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? +This demo uses the slider, image component, and animation style in the JS UI to drag the slider to control the rotation speed and size of the windmill image. You can change the image rotation speed and image size by setting the slider value. + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/SliderApplication/RELEASE-NOTES.MD b/SliderApplication/RELEASE-NOTES.MD new file mode 100644 index 0000000000000000000000000000000000000000..9087a1482627f316280b762b6c5adc73c0d438d1 --- /dev/null +++ b/SliderApplication/RELEASE-NOTES.MD @@ -0,0 +1 @@ +1.0.0.1 Initial version \ No newline at end of file diff --git a/SliderApplication/build.gradle b/SliderApplication/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..446fc5b42cf8013148be318ba66aae0480fdbc1b --- /dev/null +++ b/SliderApplication/build.gradle @@ -0,0 +1,33 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 +} + +buildscript { + repositories { + maven { + url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/' + } + maven { + url 'http://mirrors.tools.huawei.com/maven/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.3' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/' + } + maven { + url 'http://mirrors.tools.huawei.com/maven/' + } + } +} diff --git a/SliderApplication/entry/.gitignore b/SliderApplication/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..7d5b7a94f4dcf381f03ff21f28f8a2494b58023f --- /dev/null +++ b/SliderApplication/entry/.gitignore @@ -0,0 +1,2 @@ +/build +/node_modules diff --git a/SliderApplication/entry/build.gradle b/SliderApplication/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..8b7ec8312514680f078c1c7e1c74263431effc4b --- /dev/null +++ b/SliderApplication/entry/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' +} +decc { + supportType = ['html','xml'] +} diff --git a/SliderApplication/entry/package.json b/SliderApplication/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/SliderApplication/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/SliderApplication/entry/proguard-rules.pro b/SliderApplication/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/SliderApplication/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/SliderApplication/entry/src/main/config.json b/SliderApplication/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..251d271536fa4d876b012355a68b2d0d4ba9ba13 --- /dev/null +++ b/SliderApplication/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.cookbook", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.cookbook", + "name": ".MyApplication", + "mainAbility": "com.huawei.cookbook.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.cookbook.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/SliderApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java b/SliderApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..33ec9a5dcc65ff303d78dab6a2115d27cb7d236b --- /dev/null +++ b/SliderApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java @@ -0,0 +1,16 @@ +package com.huawei.cookbook; + +import ohos.ace.ability.AceAbility; +import ohos.aafwk.content.Intent; + +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/SliderApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java b/SliderApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..f9b367afc90bd5ecb98c01dbf9bf2935ef6800b5 --- /dev/null +++ b/SliderApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java @@ -0,0 +1,10 @@ +package com.huawei.cookbook; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/SliderApplication/entry/src/main/js/default/app.js b/SliderApplication/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/SliderApplication/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/SliderApplication/entry/src/main/js/default/common/images/Wallpaper.png b/SliderApplication/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/SliderApplication/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/SliderApplication/entry/src/main/js/default/common/images/bg-tv.jpg b/SliderApplication/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/SliderApplication/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/SliderApplication/entry/src/main/js/default/common/images/windmill.png b/SliderApplication/entry/src/main/js/default/common/images/windmill.png new file mode 100644 index 0000000000000000000000000000000000000000..e15bda0300116d97dcdc730cee92b86457666777 Binary files /dev/null and b/SliderApplication/entry/src/main/js/default/common/images/windmill.png differ diff --git a/SliderApplication/entry/src/main/js/default/i18n/en-US.json b/SliderApplication/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/SliderApplication/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/SliderApplication/entry/src/main/js/default/i18n/zh-CN.json b/SliderApplication/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/SliderApplication/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/SliderApplication/entry/src/main/js/default/pages/index/index.css b/SliderApplication/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..29c0dd95d61bb8644fd61a2e5fa10640332bf8a0 --- /dev/null +++ b/SliderApplication/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,44 @@ +/* 页面整体纵向布局 */ +.container { + flex-direction: column; +} +/* 图片区域布局 */ +.image-block { + height: 50%; + justify-content: center; + align-items: center; +} +/* 图片布局 */ +image { + width: 100px; + height: 100px; + animation-name: Go; + animation-iteration-count: infinite; + animation-timing-function: linear; +} +/* 图片旋转角度:0到360° */ +@keyframes Go +{ + from { + transform:rotate(0deg); + } + to { + transform:rotate(360deg); + } +} +/* 进度条区域布局 */ +.slider-block { + height: 50%; + justify-content: center; + align-items: center; + flex-direction: column; +} +/* 进度条布局 */ +slider { + margin-bottom: 20px; +} +/* 文字布局 */ +text { + margin-bottom: 10px; + font-size: 20px; +} diff --git a/SliderApplication/entry/src/main/js/default/pages/index/index.hml b/SliderApplication/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..439b7602de6c3fea01e12967d9d1e27099a7e9ad --- /dev/null +++ b/SliderApplication/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,15 @@ +
+
+ +
+
+ + 速度:{{speed}} + + + + 缩放比例:{{imageSize}} + + +
+
diff --git a/SliderApplication/entry/src/main/js/default/pages/index/index.js b/SliderApplication/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..84e13d6ba9e6771871bd6fd34d927bd64a4d473f --- /dev/null +++ b/SliderApplication/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,29 @@ +export default { + data: { + imgUrl: '/common/images/windmill.png', + animationDuration: '5000ms', + animationDurationNum: 5000, + speed: 50, + minSpeed: 0, + maxSpeed: 100, + imageSize: 1, + size: 50, + minSize: 0, + maxSize: 100 + }, + // 改变转速 + changeValue(e) { + if (e.mode === 'end' || e.mode === 'click') { + this.speed = e.value; + this.animationDurationNum = 10000 - e.value * 95; + this.animationDuration = this.animationDurationNum + 'ms'; + } + }, + // 改变大小 + changeSize(e) { + if (e.mode === 'end' || e.mode === 'click') { + this.size = e.value; + this.imageSize = this.size / 50 < 0.1 ? 0.1 : this.size / 50; + } + } +}; diff --git a/SliderApplication/entry/src/main/resources/base/element/string.json b/SliderApplication/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..76f37f5873b0dc734a93a4b8ec33a5f8a799c9f1 --- /dev/null +++ b/SliderApplication/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "slider_image_style" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/SliderApplication/entry/src/main/resources/base/media/icon.png b/SliderApplication/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/SliderApplication/entry/src/main/resources/base/media/icon.png differ diff --git a/SliderApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java b/SliderApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bf27899ae844b18c931cc6c9841267cbdb2c717c --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java @@ -0,0 +1,14 @@ +package com.huawei.cookbook; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.huawei.cookbook", actualBundleName); + } +} \ No newline at end of file diff --git a/SliderApplication/entry/src/ohosTest/js/default/app.js b/SliderApplication/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/SliderApplication/entry/src/ohosTest/js/default/i18n/en-US.json b/SliderApplication/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/SliderApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json b/SliderApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.css b/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.hml b/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.js b/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8be2df2479a8da755ed800ad70d2b6247e21b8a2 --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/SliderApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/SliderApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/SliderApplication/entry/src/ohosTest/js/test/List.test.js b/SliderApplication/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/SliderApplication/entry/src/ohosTest/resources/base/element/string.json b/SliderApplication/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..aa025f61be2b5b49ea59ddb996b5a9c6eb94d84a --- /dev/null +++ b/SliderApplication/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "SliderApplication" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/SliderApplication/entry/src/ohosTest/resources/base/media/icon.png b/SliderApplication/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/SliderApplication/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/SliderApplication/gradle/wrapper/gradle-wrapper.jar b/SliderApplication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/SliderApplication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/SliderApplication/gradle/wrapper/gradle-wrapper.properties b/SliderApplication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/SliderApplication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/SliderApplication/settings.gradle b/SliderApplication/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/SliderApplication/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/SwitchApplication/LICENSE b/SwitchApplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c357dc828cf7d8c783f10ed6bb1bac8a1e903c1 --- /dev/null +++ b/SwitchApplication/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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. + +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/SwitchApplication/README.md b/SwitchApplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1c83d50b49f4c933f1e07b043d572a73d68826a3 --- /dev/null +++ b/SwitchApplication/README.md @@ -0,0 +1,46 @@ +# SwitchApplication +简介 +• 此Demo使用了JS UI中的switch、chart组件。 您可以通过切换switch开关设置chart图表数据静态或动态显示。 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? +This demo uses the switch and chart components of the JS UI. You can set the static or dynamic display of chart data by switching the switch. + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/SwitchApplication/RELEASE-NOTES.MD b/SwitchApplication/RELEASE-NOTES.MD new file mode 100644 index 0000000000000000000000000000000000000000..9087a1482627f316280b762b6c5adc73c0d438d1 --- /dev/null +++ b/SwitchApplication/RELEASE-NOTES.MD @@ -0,0 +1 @@ +1.0.0.1 Initial version \ No newline at end of file diff --git a/SwitchApplication/build.gradle b/SwitchApplication/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..2ac7b7a5b5ab94280b3b09df2a8326d0c65ac8d3 --- /dev/null +++ b/SwitchApplication/build.gradle @@ -0,0 +1,37 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } +} diff --git a/SwitchApplication/entry/.gitignore b/SwitchApplication/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9 --- /dev/null +++ b/SwitchApplication/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/SwitchApplication/entry/build.gradle b/SwitchApplication/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..1a3d6e2c2f8b9b19915a8cac2589093936210086 --- /dev/null +++ b/SwitchApplication/entry/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + compileOptions { annotationEnabled true } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + implementation 'android.arch.persistence.room:runtime:1.1.1' + testCompile 'junit:junit:4.12' + + +} +decc { + supportType = ['html', 'xml'] +} diff --git a/SwitchApplication/entry/package.json b/SwitchApplication/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/SwitchApplication/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/SwitchApplication/entry/proguard-rules.pro b/SwitchApplication/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/SwitchApplication/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/SwitchApplication/entry/src/main/config.json b/SwitchApplication/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..251d271536fa4d876b012355a68b2d0d4ba9ba13 --- /dev/null +++ b/SwitchApplication/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.cookbook", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.cookbook", + "name": ".MyApplication", + "mainAbility": "com.huawei.cookbook.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.cookbook.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/SwitchApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java b/SwitchApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..b6b069e2d058d44a4e69c0fc994d18f79b16d0b1 --- /dev/null +++ b/SwitchApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; + +/** + * mainAbility + * + * @since 2021-08-01 + * + */ +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/SwitchApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java b/SwitchApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..6cedbab02ce50255c20556435d2e2360659ff817 --- /dev/null +++ b/SwitchApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.aafwk.ability.AbilityPackage; + +/** + * myApplication + * + * @since 2021-08-01 + * + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/SwitchApplication/entry/src/main/js/default/app.js b/SwitchApplication/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/SwitchApplication/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/SwitchApplication/entry/src/main/js/default/common/images/Wallpaper.png b/SwitchApplication/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/SwitchApplication/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/SwitchApplication/entry/src/main/js/default/common/images/bg-tv.jpg b/SwitchApplication/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/SwitchApplication/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/SwitchApplication/entry/src/main/js/default/i18n/en-US.json b/SwitchApplication/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/SwitchApplication/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/SwitchApplication/entry/src/main/js/default/i18n/zh-CN.json b/SwitchApplication/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/SwitchApplication/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/SwitchApplication/entry/src/main/js/default/pages/index/index.css b/SwitchApplication/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..c7293bf849f207afac7b97f31a03fe358768fb8d --- /dev/null +++ b/SwitchApplication/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,90 @@ +.container { + flex-direction: column; + align-items: center; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("../../common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +.switch-block { + width: 98%; + height: 50px; +} +.switch { + text-padding: 10px; /* texton/textoff中最长文本两侧距离滑块边界的距离 */ + font-size: 12px; + texton-color: #5F5F5F; /* 选中字体颜色 */ + textoff-color: #707070; /* 未选中字体颜色 */ +} +.chart-block, .gauge-block, .bar-block { + position: relative; + width: 98%; + border-radius: 5px; + background-color: #E3F8F9; +} +.text-speed{ + position: absolute; + top: 10px; + left: 20px; + width: 10px; + font-size: 10px; +} +.chart-data { + margin: 10px 5px 10px; + width: 100%; + height: 100px; +} +.text-time { + position: absolute; + font-size: 10px; + bottom: 2px; + right: 10px; +} +.gauge-block, .bar-block { + margin-top: 10px; +} +.data-gauge{ + width: 200%; + height: 200px; + margin: 10px 0 10px; /* 刻度条的宽度 */ + start-angle: 0; /* 起始角度 */ + total-angle: 360; /* 最大角度 */ + stroke-width: 20px; + colors: #CF0A2C, #8477DF, #17A98E; /* 颜色 */ + weights: 3, 2, 1; /* 颜色占比权重 */ +} +.data-bar { + width: 100%; + height: 200px; + margin: 10px 5px 10px; +} diff --git a/SwitchApplication/entry/src/main/js/default/pages/index/index.hml b/SwitchApplication/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..ebfc11a58b20dca2d063a8efbf35bce2ae9cdd57 --- /dev/null +++ b/SwitchApplication/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,23 @@ +
+
+ +
+
+ 利润 + + 年份 +
+
+ +
+
+ 销量 + + 年份 +
+
diff --git a/SwitchApplication/entry/src/main/js/default/pages/index/index.js b/SwitchApplication/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2f5d8d0b57f156d018e4844315f25fb802cd1e31 --- /dev/null +++ b/SwitchApplication/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,128 @@ +export default { + data: { + interval: null, // 定时器对象 + showText: true, // 是否显示文本 + textOn: '动态', + textOff: '静态', + allowScale: true, // 文本尺寸跟随系统设置字体缩放 + dataLength: 5, // 数据长度 + barGroup: 3, // 柱状图组数 + + lineData: null, // 线形图数据 + lineOps: { // 线形图样式 + xAxis: { + min: 0, + max: 5, + display: true + }, + yAxis: { + min: 0, + max: 100, + display: true + }, + series: { + lineStyle: { + width: '1px', + smooth: true + }, + headPoint: { + shape: 'circle', + size: 10, + strokeWidth: 2, + fillColor: '#ffffff', + strokeColor: '#8477DF', + display: true + }, + loop: { + margin: 2 + } + } + }, + + percent: 100, // 量规图进度 + + barData: [ // 柱状图数据 + { + fillColor: '#CF0A2C', + data: [2, 20, 99, 56, 23] + }, + { + fillColor: '#8477DF', + data: [99, 88, 2, 67, 12] + }, + { + fillColor: '#17A98E', + data: [56, 2, 77, 99, 78] + } + ], + barOps: { // 柱状图样式 + xAxis: { + min: 0, + max: 20, + display: true, + axisTick: 5 + }, + yAxis: { + min: 0, + max: 100, + display: true + } + } + }, + // 初始化 + onInit() { + this.changeLine(); + }, + change(e) { + if (e.checked) { + this.interval = setInterval(() => { + this.changeLine(); // 更新线形图数据 + this.changeGauge(); // 更新量规图数据 + this.changeBar(); // 更新柱状图数据 + }, 1000); + } else { + clearInterval(this.interval); + } + }, + // 更新线形图数据 + changeLine() { + const dataArray = []; + for (let i = 0; i < this.dataLength; i++) { + const nowValue = Math.floor(Math.random() * 99 + 1); + const obj = { + 'value': nowValue, // Y坐标 + 'description': nowValue + '', // 当前点的注释内容 + 'textLocation': 'top', // 注释内容位置 + 'textColor': '#CDCACA', // 注释内容颜色 + 'pointStyle': { // 节点形状 + 'shape': 'circle', // 形状 + 'size': 5, // 形状大小 + 'fillColor': '#CF0A2C', // 填充颜色 + 'strokeColor': '#CF0A2C' // 边框颜色 + } + }; + dataArray.push(obj); + } + this.lineData = [ + { + strokeColor: '#17A98E', // 线的颜色 + data: dataArray, + gradient: false + } + ]; + }, + // 更新量规图数据 + changeGauge() { + this.percent = parseInt(this.percent) >= 99 ? 0 : parseInt(this.percent) + 1; + }, + // 更新柱状图数据 + changeBar() { + for (let i = 0; i < this.barGroup; i++) { + const dataArray = this.barData[i].data; + for (let j = 0; j < this.dataLength; j++) { + dataArray[j] = Math.floor(Math.random() * 99 + 1); + } + } + this.barData = this.barData.splice(0, this.barGroup + 1); + } +}; diff --git a/SwitchApplication/entry/src/main/resources/base/element/string.json b/SwitchApplication/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..406aa4f927f77e4a0cc5527d74ac1f649604c723 --- /dev/null +++ b/SwitchApplication/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "switch_chart" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/SwitchApplication/entry/src/main/resources/base/media/icon.png b/SwitchApplication/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/SwitchApplication/entry/src/main/resources/base/media/icon.png differ diff --git a/SwitchApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java b/SwitchApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bf27899ae844b18c931cc6c9841267cbdb2c717c --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java @@ -0,0 +1,14 @@ +package com.huawei.cookbook; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.huawei.cookbook", actualBundleName); + } +} \ No newline at end of file diff --git a/SwitchApplication/entry/src/ohosTest/js/default/app.js b/SwitchApplication/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/SwitchApplication/entry/src/ohosTest/js/default/i18n/en-US.json b/SwitchApplication/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/SwitchApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json b/SwitchApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.css b/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.hml b/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.js b/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8be2df2479a8da755ed800ad70d2b6247e21b8a2 --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/SwitchApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/SwitchApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/SwitchApplication/entry/src/ohosTest/js/test/List.test.js b/SwitchApplication/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/SwitchApplication/entry/src/ohosTest/resources/base/element/string.json b/SwitchApplication/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c6ec5946072aa9bd22153c957e88f8bd9d1f824d --- /dev/null +++ b/SwitchApplication/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "SwitchApplication" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/SwitchApplication/entry/src/ohosTest/resources/base/media/icon.png b/SwitchApplication/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/SwitchApplication/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/SwitchApplication/gradle/wrapper/gradle-wrapper.jar b/SwitchApplication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/SwitchApplication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/SwitchApplication/gradle/wrapper/gradle-wrapper.properties b/SwitchApplication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/SwitchApplication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/SwitchApplication/settings.gradle b/SwitchApplication/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/SwitchApplication/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/ToolbarApplication/LICENSE b/ToolbarApplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c357dc828cf7d8c783f10ed6bb1bac8a1e903c1 --- /dev/null +++ b/ToolbarApplication/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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. + +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/ToolbarApplication/README.md b/ToolbarApplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0952b16168d032b5df74142f50001fbf647fe713 --- /dev/null +++ b/ToolbarApplication/README.md @@ -0,0 +1,46 @@ +# ToolbarApplication +简介 +• 此Demo使用JS UI中的toolbar组件以及toolbar-item组件,实现一个面板切换的效果,用户可以利用toolbar 组件切换不同的页面。 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? +This demo uses the toolbar and toolbar-item components in the JS UI to implement a panel switchover effect. Users can use the toolbar component to switch between different pages. + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/ToolbarApplication/RELEASE-NOTES.MD b/ToolbarApplication/RELEASE-NOTES.MD new file mode 100644 index 0000000000000000000000000000000000000000..9087a1482627f316280b762b6c5adc73c0d438d1 --- /dev/null +++ b/ToolbarApplication/RELEASE-NOTES.MD @@ -0,0 +1 @@ +1.0.0.1 Initial version \ No newline at end of file diff --git a/ToolbarApplication/build.gradle b/ToolbarApplication/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..446fc5b42cf8013148be318ba66aae0480fdbc1b --- /dev/null +++ b/ToolbarApplication/build.gradle @@ -0,0 +1,33 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 +} + +buildscript { + repositories { + maven { + url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/' + } + maven { + url 'http://mirrors.tools.huawei.com/maven/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.3' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/' + } + maven { + url 'http://mirrors.tools.huawei.com/maven/' + } + } +} diff --git a/ToolbarApplication/entry/.gitignore b/ToolbarApplication/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..7d5b7a94f4dcf381f03ff21f28f8a2494b58023f --- /dev/null +++ b/ToolbarApplication/entry/.gitignore @@ -0,0 +1,2 @@ +/build +/node_modules diff --git a/ToolbarApplication/entry/build.gradle b/ToolbarApplication/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4ff8bc645e758cc5dacdcfe1bfb22a1d5348e736 --- /dev/null +++ b/ToolbarApplication/entry/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 4 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' +} +decc { + supportType = ['html','xml'] +} diff --git a/ToolbarApplication/entry/package.json b/ToolbarApplication/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/ToolbarApplication/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/ToolbarApplication/entry/proguard-rules.pro b/ToolbarApplication/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/ToolbarApplication/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/ToolbarApplication/entry/src/main/config.json b/ToolbarApplication/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..251d271536fa4d876b012355a68b2d0d4ba9ba13 --- /dev/null +++ b/ToolbarApplication/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.cookbook", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.cookbook", + "name": ".MyApplication", + "mainAbility": "com.huawei.cookbook.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.cookbook.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/ToolbarApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java b/ToolbarApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..3234f850f728adc5dd5c36c2b154c589c6169181 --- /dev/null +++ b/ToolbarApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.ace.ability.AceAbility; +import ohos.aafwk.content.Intent; + +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/ToolbarApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java b/ToolbarApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..895a036f1ce5aa807c5fbe71fd9fcb37243b26cb --- /dev/null +++ b/ToolbarApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/ToolbarApplication/entry/src/main/js/default/app.js b/ToolbarApplication/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/ToolbarApplication/entry/src/main/js/default/common/Icon/1.png b/ToolbarApplication/entry/src/main/js/default/common/Icon/1.png new file mode 100644 index 0000000000000000000000000000000000000000..af131260fce2a790f4d4f255927ab17968d39bd9 Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/Icon/1.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/Icon/2.png b/ToolbarApplication/entry/src/main/js/default/common/Icon/2.png new file mode 100644 index 0000000000000000000000000000000000000000..95bb6c80baf02f32036632ea4538b94be4abc75c Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/Icon/2.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/Icon/3.png b/ToolbarApplication/entry/src/main/js/default/common/Icon/3.png new file mode 100644 index 0000000000000000000000000000000000000000..0455e3c3326288bd79c70b69849ad615bd33a40a Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/Icon/3.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/Icon/4.png b/ToolbarApplication/entry/src/main/js/default/common/Icon/4.png new file mode 100644 index 0000000000000000000000000000000000000000..23dfcd370d7492b1c1094edce418dcf04a0987c9 Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/Icon/4.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/Icon/5.png b/ToolbarApplication/entry/src/main/js/default/common/Icon/5.png new file mode 100644 index 0000000000000000000000000000000000000000..9b4724a87460d5655d6dfe4579664906b5be301a Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/Icon/5.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/fifth/second.css b/ToolbarApplication/entry/src/main/js/default/common/fifth/second.css new file mode 100644 index 0000000000000000000000000000000000000000..ce4a2184b50f8339f6b31ae524ad77e22a1cd531 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/fifth/second.css @@ -0,0 +1,10 @@ +.container { + display: flex; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + diff --git a/ToolbarApplication/entry/src/main/js/default/common/fifth/second.hml b/ToolbarApplication/entry/src/main/js/default/common/fifth/second.hml new file mode 100644 index 0000000000000000000000000000000000000000..3819903ee503d30fa34f969e5dd400a6f484f880 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/fifth/second.hml @@ -0,0 +1,3 @@ +
+ +
diff --git a/ToolbarApplication/entry/src/main/js/default/common/first/second.css b/ToolbarApplication/entry/src/main/js/default/common/first/second.css new file mode 100644 index 0000000000000000000000000000000000000000..ce4a2184b50f8339f6b31ae524ad77e22a1cd531 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/first/second.css @@ -0,0 +1,10 @@ +.container { + display: flex; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + diff --git a/ToolbarApplication/entry/src/main/js/default/common/first/second.hml b/ToolbarApplication/entry/src/main/js/default/common/first/second.hml new file mode 100644 index 0000000000000000000000000000000000000000..035844a221f086dc5ba66a6d5f221038929912bb --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/first/second.hml @@ -0,0 +1,3 @@ +
+ +
diff --git a/ToolbarApplication/entry/src/main/js/default/common/fourth/second.css b/ToolbarApplication/entry/src/main/js/default/common/fourth/second.css new file mode 100644 index 0000000000000000000000000000000000000000..f85382f907c76c849c10d29168468c6a6165ecb0 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/fourth/second.css @@ -0,0 +1,9 @@ +.container { + display: flex; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} diff --git a/ToolbarApplication/entry/src/main/js/default/common/fourth/second.hml b/ToolbarApplication/entry/src/main/js/default/common/fourth/second.hml new file mode 100644 index 0000000000000000000000000000000000000000..813d121f847d2cc37f20dc4cadcb28cbfba553f3 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/fourth/second.hml @@ -0,0 +1,3 @@ +
+ +
diff --git a/ToolbarApplication/entry/src/main/js/default/common/images/Wallpaper.png b/ToolbarApplication/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/images/bg-tv.jpg b/ToolbarApplication/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/images/fc-1.png b/ToolbarApplication/entry/src/main/js/default/common/images/fc-1.png new file mode 100644 index 0000000000000000000000000000000000000000..1e0f64b29be14c709973346ab29614b3f593e787 Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/images/fc-1.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/images/fc-2.png b/ToolbarApplication/entry/src/main/js/default/common/images/fc-2.png new file mode 100644 index 0000000000000000000000000000000000000000..d0027a28c7cefcee11dc58a5f30849983e4ccec9 Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/images/fc-2.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/images/fc-3.png b/ToolbarApplication/entry/src/main/js/default/common/images/fc-3.png new file mode 100644 index 0000000000000000000000000000000000000000..7a169f54a2a7007cee68810a176773ec1aee40e5 Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/images/fc-3.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/images/fc-4.png b/ToolbarApplication/entry/src/main/js/default/common/images/fc-4.png new file mode 100644 index 0000000000000000000000000000000000000000..aedabe2df4293176914f378075f41194edab24cc Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/images/fc-4.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/images/fc-5.png b/ToolbarApplication/entry/src/main/js/default/common/images/fc-5.png new file mode 100644 index 0000000000000000000000000000000000000000..55bc94f213c2da8c203cff05176bc0ff25d73b82 Binary files /dev/null and b/ToolbarApplication/entry/src/main/js/default/common/images/fc-5.png differ diff --git a/ToolbarApplication/entry/src/main/js/default/common/second/second.css b/ToolbarApplication/entry/src/main/js/default/common/second/second.css new file mode 100644 index 0000000000000000000000000000000000000000..ce4a2184b50f8339f6b31ae524ad77e22a1cd531 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/second/second.css @@ -0,0 +1,10 @@ +.container { + display: flex; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + diff --git a/ToolbarApplication/entry/src/main/js/default/common/second/second.hml b/ToolbarApplication/entry/src/main/js/default/common/second/second.hml new file mode 100644 index 0000000000000000000000000000000000000000..6a3251c413c728aea861491b73b99245d024b763 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/second/second.hml @@ -0,0 +1,3 @@ +
+ +
diff --git a/ToolbarApplication/entry/src/main/js/default/common/third/second.css b/ToolbarApplication/entry/src/main/js/default/common/third/second.css new file mode 100644 index 0000000000000000000000000000000000000000..ce4a2184b50f8339f6b31ae524ad77e22a1cd531 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/third/second.css @@ -0,0 +1,10 @@ +.container { + display: flex; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + diff --git a/ToolbarApplication/entry/src/main/js/default/common/third/second.hml b/ToolbarApplication/entry/src/main/js/default/common/third/second.hml new file mode 100644 index 0000000000000000000000000000000000000000..4cebe8f79d96609423791557424dbed7ca61277b --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/common/third/second.hml @@ -0,0 +1,3 @@ +
+ +
diff --git a/ToolbarApplication/entry/src/main/js/default/i18n/en-US.json b/ToolbarApplication/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/ToolbarApplication/entry/src/main/js/default/i18n/zh-CN.json b/ToolbarApplication/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/ToolbarApplication/entry/src/main/js/default/pages/index/index.css b/ToolbarApplication/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a5d4f67341b67500f41229650ba71968f614cef9 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,5 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} diff --git a/ToolbarApplication/entry/src/main/js/default/pages/index/index.hml b/ToolbarApplication/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f7cd4c6d2e1e019a3d5c2743e1d839d617fe43c0 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,25 @@ + + + + + + +
+ + + + + + + + + + + + + + + + + +
diff --git a/ToolbarApplication/entry/src/main/js/default/pages/index/index.js b/ToolbarApplication/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..49ed2497f9debd3edebc3d3d8007a35e14ff3e53 --- /dev/null +++ b/ToolbarApplication/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,101 @@ +export default { + data: { + fontWeight0: 'bolder', + fontWeight1: null, + fontWeight2: null, + fontWeight3: null, + fontWeight4: null, + display1: 'flex', + display2: 'none', + display3: 'none', + display4: 'none', + display5: 'none', + display6: 'none', + imgGr: 'common/Icon/1.png', + imgDu: 'common/Icon/2.png', + imgGu: 'common/Icon/3.png', + imgWz: 'common/Icon/4.png', + imgXx: 'common/Icon/5.png' + }, + change(e) { + if (e.currentTarget.attr.value === 'Option 1') { + this.function1(); + } else if (e.currentTarget.attr.value === 'Option 2') { + this.function2(); + } else if (e.currentTarget.attr.value === 'Option 3') { + this.function3(); + } else if (e.currentTarget.attr.value === 'Option 4') { + this.function4(); + } else if (e.currentTarget.attr.value === 'Option 5') { + this.function5(); + } + }, + function1() { + this.fontWeight0 = 'bolder'; + this.fontWeight1 = 'normal'; + this.fontWeight2 = 'normal'; + this.fontWeight3 = 'normal'; + this.fontWeight4 = 'normal'; + this.display1 = 'flex'; + this.display2 = 'none'; + this.display3 = 'none'; + this.display4 = 'none'; + this.display5 = 'none'; + this.display6 = 'none'; + }, + function2() { + this.fontWeight0 = 'normal'; + this.fontWeight1 = 'bolder'; + this.fontWeight2 = 'normal'; + this.fontWeight3 = 'normal'; + this.fontWeight4 = 'normal'; + this.display1 = 'none'; + this.display2 = 'flex'; + this.display3 = 'none'; + this.display4 = 'none'; + this.display5 = 'none'; + this.display6 = 'none'; + + }, + function3() { + this.fontWeight0 = 'normal'; + this.fontWeight1 = 'normal'; + this.fontWeight2 = 'bolder'; + this.fontWeight3 = 'normal'; + this.fontWeight4 = 'normal'; + this.display1 = 'none'; + this.display2 = 'none'; + this.display3 = 'flex'; + this.display4 = 'none'; + this.display5 = 'none'; + this.display6 = 'none'; + + }, + function4() { + this.fontWeight0 = 'normal'; + this.fontWeight1 = 'normal'; + this.fontWeight2 = 'normal'; + this.fontWeight3 = 'bolder'; + this.fontWeight4 = 'normal'; + this.display1 = 'none'; + this.display2 = 'none'; + this.display3 = 'none'; + this.display4 = 'flex'; + this.display5 = 'none'; + this.display6 = 'none'; + + }, + function5() { + this.fontWeight0 = 'normal'; + this.fontWeight1 = 'normal'; + this.fontWeight2 = 'normal'; + this.fontWeight3 = 'normal'; + this.fontWeight4 = 'bolder'; + this.display1 = 'none'; + this.display2 = 'none'; + this.display3 = 'none'; + this.display4 = 'none'; + this.display5 = 'flex'; + this.display6 = 'none'; + } +}; diff --git a/ToolbarApplication/entry/src/main/resources/base/element/string.json b/ToolbarApplication/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/ToolbarApplication/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/ToolbarApplication/entry/src/main/resources/base/media/icon.png b/ToolbarApplication/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ToolbarApplication/entry/src/main/resources/base/media/icon.png differ diff --git a/ToolbarApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java b/ToolbarApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bf27899ae844b18c931cc6c9841267cbdb2c717c --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/java/com/huawei/cookbook/ExampleOhosTest.java @@ -0,0 +1,14 @@ +package com.huawei.cookbook; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.huawei.cookbook", actualBundleName); + } +} \ No newline at end of file diff --git a/ToolbarApplication/entry/src/ohosTest/js/default/app.js b/ToolbarApplication/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/ToolbarApplication/entry/src/ohosTest/js/default/i18n/en-US.json b/ToolbarApplication/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ToolbarApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json b/ToolbarApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.css b/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.hml b/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.js b/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8be2df2479a8da755ed800ad70d2b6247e21b8a2 --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report', + 'version': '1.0.3' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/ToolbarApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/ToolbarApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/ToolbarApplication/entry/src/ohosTest/js/test/List.test.js b/ToolbarApplication/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/ToolbarApplication/entry/src/ohosTest/resources/base/element/string.json b/ToolbarApplication/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2daf0c5f30d2d462b8b82adcad6478688864e68b --- /dev/null +++ b/ToolbarApplication/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ToolbarApplication" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/ToolbarApplication/entry/src/ohosTest/resources/base/media/icon.png b/ToolbarApplication/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ToolbarApplication/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/ToolbarApplication/gradle/wrapper/gradle-wrapper.jar b/ToolbarApplication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/ToolbarApplication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/ToolbarApplication/gradle/wrapper/gradle-wrapper.properties b/ToolbarApplication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/ToolbarApplication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/ToolbarApplication/settings.gradle b/ToolbarApplication/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/ToolbarApplication/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/VideoApplication/LICENSE b/VideoApplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c357dc828cf7d8c783f10ed6bb1bac8a1e903c1 --- /dev/null +++ b/VideoApplication/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2021 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. + +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/VideoApplication/README.md b/VideoApplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..32ede2abaf1a267ef80586612cbc44ea0b85834c --- /dev/null +++ b/VideoApplication/README.md @@ -0,0 +1,46 @@ +# VideoApplication +简介 +• 此Demo使用JS UI中的video组件,实现视频播放。您可以通过video自带的控制栏进行暂停、播放、全屏、退出全屏操作。 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此ComponentCodelab +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 + +What is it? +This demo uses the video component of the JS UI to play videos. You can use the video control bar to pause, play, full screen, or exit full screen. + +Installation requirements +• Install DevEco Studio +• Set up the DevEco Studio development environment.The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool.The development environment can be configured according to the following two situations + 1.If you can directly access the Internet, just download the HarmonyOS SDK + 2.If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this Project +• Open HUAWEI DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/VideoApplication/RELEASE-NOTES.MD b/VideoApplication/RELEASE-NOTES.MD new file mode 100644 index 0000000000000000000000000000000000000000..9087a1482627f316280b762b6c5adc73c0d438d1 --- /dev/null +++ b/VideoApplication/RELEASE-NOTES.MD @@ -0,0 +1 @@ +1.0.0.1 Initial version \ No newline at end of file diff --git a/VideoApplication/build.gradle b/VideoApplication/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..bf3ca7268bbf5e0ff118207bf08b5fbfdad7011a --- /dev/null +++ b/VideoApplication/build.gradle @@ -0,0 +1,38 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } +} diff --git a/VideoApplication/entry/.gitignore b/VideoApplication/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9 --- /dev/null +++ b/VideoApplication/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/VideoApplication/entry/build.gradle b/VideoApplication/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..438b0a24d493cdae21758ec071799f2a8888240a --- /dev/null +++ b/VideoApplication/entry/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#ZH-CN_TOPIC_0000001154985555__section1112183053510 +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' +} +decc { + supportType = ['html','xml'] +} diff --git a/VideoApplication/entry/package.json b/VideoApplication/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/VideoApplication/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/VideoApplication/entry/proguard-rules.pro b/VideoApplication/entry/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f7666e47561d514b2a76d5a7dfbb43ede86da92a --- /dev/null +++ b/VideoApplication/entry/proguard-rules.pro @@ -0,0 +1 @@ +# config module specific ProGuard rules here. \ No newline at end of file diff --git a/VideoApplication/entry/src/main/config.json b/VideoApplication/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..251d271536fa4d876b012355a68b2d0d4ba9ba13 --- /dev/null +++ b/VideoApplication/entry/src/main/config.json @@ -0,0 +1,57 @@ +{ + "app": { + "bundleName": "com.huawei.cookbook", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.cookbook", + "name": ".MyApplication", + "mainAbility": "com.huawei.cookbook.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.huawei.cookbook.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/VideoApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java b/VideoApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..b6b069e2d058d44a4e69c0fc994d18f79b16d0b1 --- /dev/null +++ b/VideoApplication/entry/src/main/java/com/huawei/cookbook/MainAbility.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; + +/** + * mainAbility + * + * @since 2021-08-01 + * + */ +public class MainAbility extends AceAbility { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + } + + @Override + public void onStop() { + super.onStop(); + } +} diff --git a/VideoApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java b/VideoApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..6cedbab02ce50255c20556435d2e2360659ff817 --- /dev/null +++ b/VideoApplication/entry/src/main/java/com/huawei/cookbook/MyApplication.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 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. + */ + +package com.huawei.cookbook; + +import ohos.aafwk.ability.AbilityPackage; + +/** + * myApplication + * + * @since 2021-08-01 + * + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/VideoApplication/entry/src/main/js/default/app.js b/VideoApplication/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/VideoApplication/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/VideoApplication/entry/src/main/js/default/common/images/Wallpaper.png b/VideoApplication/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/VideoApplication/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/VideoApplication/entry/src/main/js/default/common/images/back.png b/VideoApplication/entry/src/main/js/default/common/images/back.png new file mode 100644 index 0000000000000000000000000000000000000000..7db2c3d84b2f3427534051b16bfa2e63f501e006 Binary files /dev/null and b/VideoApplication/entry/src/main/js/default/common/images/back.png differ diff --git a/VideoApplication/entry/src/main/js/default/common/images/bg-tv.jpg b/VideoApplication/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/VideoApplication/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/VideoApplication/entry/src/main/js/default/common/images/next.png b/VideoApplication/entry/src/main/js/default/common/images/next.png new file mode 100644 index 0000000000000000000000000000000000000000..0a87bdb015cb61d3b886f896281a8cdf02b4199d Binary files /dev/null and b/VideoApplication/entry/src/main/js/default/common/images/next.png differ diff --git a/VideoApplication/entry/src/main/js/default/common/images/pause.png b/VideoApplication/entry/src/main/js/default/common/images/pause.png new file mode 100644 index 0000000000000000000000000000000000000000..e0c8960767affcfad53f0dba39dd1e8e18c93827 Binary files /dev/null and b/VideoApplication/entry/src/main/js/default/common/images/pause.png differ diff --git a/VideoApplication/entry/src/main/js/default/common/images/screenPause.png b/VideoApplication/entry/src/main/js/default/common/images/screenPause.png new file mode 100644 index 0000000000000000000000000000000000000000..913f71d16c74a5601bad6fd9241104fbd1e1870b Binary files /dev/null and b/VideoApplication/entry/src/main/js/default/common/images/screenPause.png differ diff --git a/VideoApplication/entry/src/main/js/default/common/video/1.mp4 b/VideoApplication/entry/src/main/js/default/common/video/1.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..592abe4f4551198d5c4c25e346f66e523b21cd18 Binary files /dev/null and b/VideoApplication/entry/src/main/js/default/common/video/1.mp4 differ diff --git a/VideoApplication/entry/src/main/js/default/common/video/2.mp4 b/VideoApplication/entry/src/main/js/default/common/video/2.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..8ad9ba799eba39018fb8a9c015e35b92d396092c Binary files /dev/null and b/VideoApplication/entry/src/main/js/default/common/video/2.mp4 differ diff --git a/VideoApplication/entry/src/main/js/default/i18n/en-US.json b/VideoApplication/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/VideoApplication/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/VideoApplication/entry/src/main/js/default/i18n/zh-CN.json b/VideoApplication/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/VideoApplication/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/VideoApplication/entry/src/main/js/default/pages/index/index.css b/VideoApplication/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b3571dd8a9688d36d92ea15b8c27841dd0fe3800 --- /dev/null +++ b/VideoApplication/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,43 @@ +.container { + flex-direction: column; + background-color: lightgray; +} +.video-block { + width: 100%; + aspect-ratio: 1.78; + justify-content: center; + align-items: center; +} +video { + width: 100%; + height: 100%; +} +.dialog-main { + width: 98%; +} +.dialog-div { + flex-direction: column; + align-items: center; +} +.inner-txt { + width: 98%; + margin-top: 20px; + flex-direction: column; + align-items: center; + justify-content: space-around; +} +.txt { + font-size: 20px; +} +.inner-btn { + width: 98%; + justify-content: space-around; + align-items: center; + margin-top: 20px; + margin-bottom: 20px; +} + +#timeDialog .dialog-div .inner-txt { + margin-top: 20px; + margin-bottom: 20px; +} \ No newline at end of file diff --git a/VideoApplication/entry/src/main/js/default/pages/index/index.hml b/VideoApplication/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..b13ead85e98f7390b0bf262e2a45faa1326a6fdd --- /dev/null +++ b/VideoApplication/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,36 @@ +
+
+ +
+ + + +
+
+ 视频播放完成,是否重新播放? +
+
+ + +
+
+
+
diff --git a/VideoApplication/entry/src/main/js/default/pages/index/index.js b/VideoApplication/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f024ba08b1e64b93d9f2b4a0731f59a01239d7fb --- /dev/null +++ b/VideoApplication/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,79 @@ +import prompt from '@system.prompt'; + +export default { + data: { + autoplay: false, // 是否自动播放 + videoId: 'video', // 播放器id + url: '/common/video/1.mp4', // 视频地址 + posterUrl: '/common/images/bg-tv.jpg', // 视频预览的海报路径 + controlShow: true, // 是否显示控制栏 + loop: true, // 是否循环播放 + startTime: 10, // 播放开始时间 + speed: 0.2, // 播放速度 + isfullscreenchange: false // 是否全屏 + }, + // 视频准备完成时触发该事件 + prepared(e) { + this.showPrompt('视频时长:' + e.duration + '秒'); + }, + // 视频开始播放 + start() { + this.showPrompt('视频开始播放'); + }, + // 视频暂停播放 + pause() { + this.showPrompt('视频暂停播放'); + }, + // 视频播放完成 + finish() { + this.$element('confirmDialog').show(); + }, + // 拖动进度条调用 + seeked(e) { + this.showPrompt('设置播放进度:' + e.currenttime + '秒'); + }, + // 播放进度变化调用 + timeupdate(e) { + + }, + // 自带组件进入全屏和退出全屏 + fullscreenchange(e) { + if (e.fullscreen === 1) { + this.isfullscreenchange = true; + } else { + this.isfullscreenchange = false; + } + }, + // 长按屏幕视频进入和退出全屏调用 + longPressFullscreenchange() { + if (this.isfullscreenchange) { // 全屏 + this.$element('video').exitFullscreen(); + this.isfullscreenchange = false; + } else { // 非全屏 + this.$element('video').requestFullscreen({ screenOrientation: 'default' }); + this.isfullscreenchange = true; + } + }, + + // dialog确定 + confirm() { + this.$element('video').start(); + this.$element('confirmDialog').close(); + }, + // dialog取消 + cancel() { + this.$element('confirmDialog').close(); + }, + // 弹框 + showPrompt(msg) { + prompt.showToast({ + message: msg, + duration: 1000 + }); + }, + // 点击视频 + hideControls() { + this.controlShow = !this.controlShow; + } + +}; diff --git a/VideoApplication/entry/src/main/resources/base/element/string.json b/VideoApplication/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/VideoApplication/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/VideoApplication/entry/src/main/resources/base/media/icon.png b/VideoApplication/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/VideoApplication/entry/src/main/resources/base/media/icon.png differ diff --git a/VideoApplication/entry/src/ohosTest/js/default/app.js b/VideoApplication/entry/src/ohosTest/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..55b67e96deb821033f71d30b6fff05efdeb0d901 --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/VideoApplication/entry/src/ohosTest/js/default/i18n/en-US.json b/VideoApplication/entry/src/ohosTest/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/VideoApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json b/VideoApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/js/default/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.css b/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.hml b/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.js b/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6b01273d356c91ea7126d96f5ecf438dada94f8c --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + const instrumentLog = new InstrumentLog({ + 'id': 'report' + }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.addService('report', instrumentLog) + core.init() + core.subscribeEvent('spec', instrumentLog) + core.subscribeEvent('suite', instrumentLog) + core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/VideoApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js b/VideoApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b6d74caed96ddede98edd1bc9292f6568cd1cfd1 --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/js/test/ExampleJsunit.test.js @@ -0,0 +1,10 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('appInfoTest', function () { + it('app_info_test_001', 0, function () { + var info = app.getInfo() + expect(info.versionName).assertEqual('1.0') + expect(info.versionCode).assertEqual('3') + }) +}) \ No newline at end of file diff --git a/VideoApplication/entry/src/ohosTest/js/test/List.test.js b/VideoApplication/entry/src/ohosTest/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/VideoApplication/entry/src/ohosTest/resources/base/element/string.json b/VideoApplication/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c2d93fd94907e1b6f4dd01671f6b87d0f99f8330 --- /dev/null +++ b/VideoApplication/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "VideoApplication" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/VideoApplication/entry/src/ohosTest/resources/base/media/icon.png b/VideoApplication/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/VideoApplication/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/VideoApplication/gradle/wrapper/gradle-wrapper.jar b/VideoApplication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..490fda8577df6c95960ba7077c43220e5bb2c0d9 Binary files /dev/null and b/VideoApplication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/VideoApplication/gradle/wrapper/gradle-wrapper.properties b/VideoApplication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f59159e865d4b59feb1b8c44b001f62fc5d58df4 --- /dev/null +++ b/VideoApplication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/VideoApplication/settings.gradle b/VideoApplication/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/VideoApplication/settings.gradle @@ -0,0 +1 @@ +include ':entry'