diff --git a/README.md b/README.md index a67add36ffc4070b7b2eedb2ac95a405b8656f07..df3610d1ad16f6c593385e45c1886c14154821f8 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ We provide a series of app samples to help you quickly get familiar with the API ## Limitations 1. Before installing and running the sample, check the **deviceType** field in the **config.json** file to obtain the device types supported by the sample. You can modify this field to enable the sample to run on your target device. \(The **config.json** file is generally stored in the **entry/src/main** directory, which may be different depending on the samples.\) -2. If you want to run the app sample on HarmonyOS, configure the development environment by referring to [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/tools_overview-0000001053582387). If you want to run the app sample on OpenHarmony, configure the development environment by referring to [DevEco Studio \(OpenHarmony\) User Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/quick-start/deveco-studio-(openharmony)-user-guide.md). +2. If you want to run the app sample on HarmonyOS, configure the development environment by referring to [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/tools_overview-0000001053582387). If you want to run the app sample on OpenHarmony, configure the development environment by referring to [DevEco Studio \(OpenHarmony\) User Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/quick-start/Readme-EN.md). 3. The following app samples can run on OpenHarmony, and other app samples can run only on HarmonyOS: - common/Clock - common/JsHelloWorld diff --git a/README_zh.md b/README_zh.md index 3c3c9f56e91d8a65b6b296cebd1eefe2e690f739..911416c346a5cfdd0bf07bffe13e83323239d2fc 100755 --- a/README_zh.md +++ b/README_zh.md @@ -18,7 +18,7 @@ ## 约束与限制 1. 安装运行应用示例之前,请先通过config.json文件中的"deviceType"字段来确认该应用示例支持的设备类型,可尝试通过修改该字段使其可以在相应类型的设备上运行(config.json文件一般在代码的entry/src/main路径下,不同的Sample可能会有不同)。 -2. 配置开发环境时,如果您想让应用示例运行到HarmonyOS上,请参考[DevEco Studio使用说明](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387)。如果您想让应用示例运行到OpenHarmony上,请参考[DevEco Studio(OpenHarmony)使用指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/DevEco-Studio%EF%BC%88OpenHarmony%EF%BC%89%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97.md)。 +2. 配置开发环境时,如果您想让应用示例运行到HarmonyOS上,请参考[DevEco Studio使用说明](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387)。如果您想让应用示例运行到OpenHarmony上,请参考[DevEco Studio(OpenHarmony)使用指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/Readme-CN.md)。 3. Readme中标注为“支持标准系统”或“支持小型系统”的应用示例支持在OpenHarmony上运行,标注为“支持大型系统”的应用示例仅支持在HarmonyOS上运行。 4. 所有HarmonyOS相关示例已被全部迁移至[Harmony组织](https://gitee.com/harmonyos)之下的[harmonyos\_app\_samples](https://gitee.com/harmonyos/harmonyos_app_samples)仓中,本仓中这部分示例不再更新,并将在未来被移除。 diff --git a/UI/JsSvg/README_zh.md b/UI/JsSvg/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..8a089f812b33d42faf790b997efbd5937a78de80 --- /dev/null +++ b/UI/JsSvg/README_zh.md @@ -0,0 +1,17 @@ +# JsSvg + + + +### 简介 + +本示例展示了JS中组件及其子组件的使用,包括 + +### 使用说明 + +1、首页中的子组件很多,本示例中,在首页显示一个列表,将svg的子组件分为四个列表项展示,点击进入对应的界面可以查看各个子组件的显示效果。 + + + +### 约束与限制 + +本示例支持标准系统上运行。 diff --git a/UI/JsSvg/build.gradle b/UI/JsSvg/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..ecbb99c45d4bdfa94b95e0b3f021f66b1984e55c --- /dev/null +++ b/UI/JsSvg/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 7 + supportSystem "standard" +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:3.0.3.4' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/build.gradle b/UI/JsSvg/entry/build.gradle similarity index 96% rename from UI/eTSDefiningPageLayoutAndConnection/entry/build.gradle rename to UI/JsSvg/entry/build.gradle index 03845c6a75bec127e697017da230aaee95e95c5f..8243c3b322a99d4203fb603bab0cafd024091fb7 100644 --- a/UI/eTSDefiningPageLayoutAndConnection/entry/build.gradle +++ b/UI/JsSvg/entry/build.gradle @@ -1,16 +1,16 @@ -apply plugin: 'com.huawei.ohos.hap' -//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 -ohos { - compileSdkVersion 7 - defaultConfig { - compatibleSdkVersion 7 - } - buildTypes { - release { - proguardOpt { - proguardEnabled false - rulesFiles 'proguard-rules.pro' - } - } - } -} +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} diff --git a/UI/JsSvg/entry/src/main/config.json b/UI/JsSvg/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..f24c6226e04dfbbab99d5e4a7983c289c62fb7d6 --- /dev/null +++ b/UI/JsSvg/entry/src/main/config.json @@ -0,0 +1,66 @@ +{ + "app": { + "bundleName": "ohos.samples.jssvg", + "vendor": "samples", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.jssvg", + "name": ".MyApplication", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "js", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index", + "pages/svg1/svg1", + "pages/svg2/svg2", + "pages/svg3/svg3", + "pages/svg4/svg4" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/app.js b/UI/JsSvg/entry/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..50449ecbed6d3b8099f6f9a1fb66e29bbe2177f0 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/app.js @@ -0,0 +1,22 @@ +/* + * 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("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/common/images/arrow.png b/UI/JsSvg/entry/src/main/js/MainAbility/common/images/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..54ce61a1cd1a15118a8260618ac9494ae6103b18 Binary files /dev/null and b/UI/JsSvg/entry/src/main/js/MainAbility/common/images/arrow.png differ diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/i18n/en-US.json b/UI/JsSvg/entry/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..f7c18efa2fc977f2ad1513ecef194c6744342c67 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,9 @@ +{ + "strings": { + "title": "Svg", + "svg1": "circle\nellipse\npath\nline", + "svg2": "polyline\npolygon", + "svg3": "text\ntspan\ntextPath", + "svg4": "animate\nanimateMotion\nnanimateTransform" + } +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/i18n/zh-CN.json b/UI/JsSvg/entry/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..9e520910199bb533ab191d0c00063c4b4ce97fe9 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,4 @@ +{ + "strings": { + } +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.css b/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..ab5e08fc796072f3c20224fefafabffef511f7c1 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,72 @@ +/* + * 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 { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 42px; + color: #FFFFFF; + opacity: 0.9; + width: 100%; + padding: 10px; + background-color: dodgerblue; + height: 90px; +} + +.list { + flex-direction: column; + width: 100%; + height: 100%; +} + +.list-item { + flex-direction: column; +} + + +.stack { + flex-direction: column; + align-items: center; + justify-content: center; + padding: 10px; +} + +.text { + width: 100%; + font-size: 45px; + color: #000000; + opacity: 0.9; + padding-left: 10px; +} + +.arrow { + width: 80px; + object-fit: contain; +} + +.go { + width: 100%; + flex-direction: row; + align-items:center; + margin-left: 100px; + justify-content: flex-end; +} + diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.hml b/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..9c0da613f3ba0f9f53669dc2e7f334f83709e7ec --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,54 @@ + +
+ {{ $t('strings.title') }} + + + + {{ $t('strings.svg1') }} +
+ +
+
+
+
+ + + {{ $t('strings.svg2') }} +
+ +
+
+
+
+ + + {{ $t('strings.svg3') }} +
+ +
+
+
+
+ + + {{ $t('strings.svg4') }} +
+ +
+
+
+
+
diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.js b/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e369817e2bf69893adb1ad88d00d8cbc920e5b69 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/index/index.js @@ -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. + */ +import router from '@system.router'; + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + svgOnClick1() { + router.push({uri:'pages/svg1/svg1'}) + }, + svgOnClick2() { + router.push({uri:'pages/svg2/svg2'}) + }, + svgOnClick3() { + router.push({uri:'pages/svg3/svg3'}) + }, + svgOnClick4() { + router.push({uri:'pages/svg4/svg4'}) + } +} diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.css b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.css new file mode 100644 index 0000000000000000000000000000000000000000..adef2432c7de984393aaba17bdb05998e392be4c --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.css @@ -0,0 +1,50 @@ +/* + * 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 { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 42px; + color: #FFFFFF; + opacity: 0.9; + width: 100%; + padding: 10px; + background-color: dodgerblue; + height: 90px; +} + +.list { + flex-direction: column; + width: 100%; + height: 100%; +} + +.list-item { + flex-direction: column; + justify-content: center; + padding-left: 15px; +} + +.text { + font-size: 45px; + color: #000000; + opacity: 0.9; +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.hml b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.hml new file mode 100644 index 0000000000000000000000000000000000000000..705ce5bc62ce0e3304408e60d699b6518a7e59f4 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.hml @@ -0,0 +1,65 @@ + +
+ {{ $t('strings.title') }} + + + {{ 'rect:' }} + + + + + + + + + {{ 'circle,ellipse:' }} + + + + + + + + + + + + + {{ 'path:' }} + + + + + + + {{ 'line:' }} + + + + + + + + + + +
diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.js b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.js new file mode 100644 index 0000000000000000000000000000000000000000..32afaa907e7aad67662ec12e1e334429e44e25d2 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg1/svg1.js @@ -0,0 +1,19 @@ +/* + * 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 { + data: { + title: 'World' + } +} diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.css b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.css new file mode 100644 index 0000000000000000000000000000000000000000..adef2432c7de984393aaba17bdb05998e392be4c --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.css @@ -0,0 +1,50 @@ +/* + * 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 { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 42px; + color: #FFFFFF; + opacity: 0.9; + width: 100%; + padding: 10px; + background-color: dodgerblue; + height: 90px; +} + +.list { + flex-direction: column; + width: 100%; + height: 100%; +} + +.list-item { + flex-direction: column; + justify-content: center; + padding-left: 15px; +} + +.text { + font-size: 45px; + color: #000000; + opacity: 0.9; +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.hml b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.hml new file mode 100644 index 0000000000000000000000000000000000000000..0a900192875df1b832655ae9069eaaefbfb97566 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.hml @@ -0,0 +1,35 @@ + +
+ {{ $t('strings.title') }} + + + {{ 'polyline:' }} + + + + + + + + {{ 'polygon :' }} + + + + + + + +
diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.js b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.js new file mode 100644 index 0000000000000000000000000000000000000000..32afaa907e7aad67662ec12e1e334429e44e25d2 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg2/svg2.js @@ -0,0 +1,19 @@ +/* + * 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 { + data: { + title: 'World' + } +} diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.css b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.css new file mode 100644 index 0000000000000000000000000000000000000000..adef2432c7de984393aaba17bdb05998e392be4c --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.css @@ -0,0 +1,50 @@ +/* + * 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 { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 42px; + color: #FFFFFF; + opacity: 0.9; + width: 100%; + padding: 10px; + background-color: dodgerblue; + height: 90px; +} + +.list { + flex-direction: column; + width: 100%; + height: 100%; +} + +.list-item { + flex-direction: column; + justify-content: center; + padding-left: 15px; +} + +.text { + font-size: 45px; + color: #000000; + opacity: 0.9; +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.hml b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.hml new file mode 100644 index 0000000000000000000000000000000000000000..d59f194f25a73fd08adc33aa7a14743204d92d1c --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.hml @@ -0,0 +1,123 @@ + +
+ {{ $t('strings.title') }} + + + {{ 'text:' }} + + + test svg text string + + + + + + test svg text string + + + + text attribute stroke + + + + text attribute stroke-width-opacity + + + + + + + + {{ 'tspan:' }} + + + first. + second. + third. + forth. + + + + tspan attribute x|opacity|rotate + + + + + + + + tspan attribute dx + + + + + + tspan attribute fill|fill-opacity + + + + + + + tspan attribute font-size + + + + + + tspan attribute stroke + + + + + + tspan attribute stroke-width-opacity + + + + + + + + {{ 'textPath:' }} + + + + + This is TextPath. + + fill|fill-opacity + + + + + + font-size + + + Single tspan + + stroke-width-opacity + + + + + + + + +
\ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.js b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.js new file mode 100644 index 0000000000000000000000000000000000000000..32afaa907e7aad67662ec12e1e334429e44e25d2 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.js @@ -0,0 +1,19 @@ +/* + * 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 { + data: { + title: 'World' + } +} diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.css b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.css new file mode 100644 index 0000000000000000000000000000000000000000..adef2432c7de984393aaba17bdb05998e392be4c --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.css @@ -0,0 +1,50 @@ +/* + * 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 { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 42px; + color: #FFFFFF; + opacity: 0.9; + width: 100%; + padding: 10px; + background-color: dodgerblue; + height: 90px; +} + +.list { + flex-direction: column; + width: 100%; + height: 100%; +} + +.list-item { + flex-direction: column; + justify-content: center; + padding-left: 15px; +} + +.text { + font-size: 45px; + color: #000000; + opacity: 0.9; +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.hml b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.hml new file mode 100644 index 0000000000000000000000000000000000000000..690bef5a9f3cfd57888458d1c2daa2731430ec45 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.hml @@ -0,0 +1,108 @@ + +
+ {{ $t('strings.title') }} + + + {{ 'animate:' }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ 'animateMotion:' }} + + + + + + + + + {{ 'animateTransform:' }} + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.js b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.js new file mode 100644 index 0000000000000000000000000000000000000000..32afaa907e7aad67662ec12e1e334429e44e25d2 --- /dev/null +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg4/svg4.js @@ -0,0 +1,19 @@ +/* + * 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 { + data: { + title: 'World' + } +} diff --git a/UI/JsSvg/entry/src/main/resources/base/element/string.json b/UI/JsSvg/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..92224b70b9c7306425088a6418fe58b432445693 --- /dev/null +++ b/UI/JsSvg/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "JsSvg" + }, + { + "name": "description_mainability", + "value": "JsSvg Ability" + } + ] +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/resources/base/media/icon.png b/UI/JsSvg/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/UI/JsSvg/entry/src/main/resources/base/media/icon.png differ diff --git a/UI/JsSvg/entry/src/main/resources/en/element/string.json b/UI/JsSvg/entry/src/main/resources/en/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..92224b70b9c7306425088a6418fe58b432445693 --- /dev/null +++ b/UI/JsSvg/entry/src/main/resources/en/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "JsSvg" + }, + { + "name": "description_mainability", + "value": "JsSvg Ability" + } + ] +} \ No newline at end of file diff --git a/UI/JsSvg/entry/src/main/resources/zh/element/string.json b/UI/JsSvg/entry/src/main/resources/zh/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..89168bee3a464f0eefa526fe853f45d7abf84799 --- /dev/null +++ b/UI/JsSvg/entry/src/main/resources/zh/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "JsSvg组件" + }, + { + "name": "description_mainability", + "value": "JsSvg Ability" + } + ] +} \ No newline at end of file diff --git a/UI/JsSvg/screenshots/devices/main.png b/UI/JsSvg/screenshots/devices/main.png new file mode 100644 index 0000000000000000000000000000000000000000..67146d146d09b3a56790cb8b09f0777289aaa331 Binary files /dev/null and b/UI/JsSvg/screenshots/devices/main.png differ diff --git a/UI/JsSvg/screenshots/devices/svg1.png b/UI/JsSvg/screenshots/devices/svg1.png new file mode 100644 index 0000000000000000000000000000000000000000..d87094401220dac6b232d398c65f78f8d3a105dd Binary files /dev/null and b/UI/JsSvg/screenshots/devices/svg1.png differ diff --git a/UI/JsSvg/screenshots/devices/svg2.png b/UI/JsSvg/screenshots/devices/svg2.png new file mode 100644 index 0000000000000000000000000000000000000000..ebb2d010d127259d589490c3fa42027a31ed315f Binary files /dev/null and b/UI/JsSvg/screenshots/devices/svg2.png differ diff --git a/UI/JsSvg/screenshots/devices/svg3.png b/UI/JsSvg/screenshots/devices/svg3.png new file mode 100644 index 0000000000000000000000000000000000000000..f4a28d0150d6d3c02ab6a5242dc47dba1eb391c5 Binary files /dev/null and b/UI/JsSvg/screenshots/devices/svg3.png differ diff --git a/UI/JsSvg/screenshots/devices/svg4.png b/UI/JsSvg/screenshots/devices/svg4.png new file mode 100644 index 0000000000000000000000000000000000000000..55562c79db56d503ac2e8037793013dcbf06c4aa Binary files /dev/null and b/UI/JsSvg/screenshots/devices/svg4.png differ diff --git a/UI/eTSDefiningPageLayoutAndConnection/settings.gradle b/UI/JsSvg/settings.gradle similarity index 94% rename from UI/eTSDefiningPageLayoutAndConnection/settings.gradle rename to UI/JsSvg/settings.gradle index 28d595f2fba0d06b2025da200383d15f87c4e9f0..4773db73233a570c2d0c01a22e75321acfbf7a07 100644 --- a/UI/eTSDefiningPageLayoutAndConnection/settings.gradle +++ b/UI/JsSvg/settings.gradle @@ -1 +1 @@ -include ':entry' +include ':entry' diff --git a/UI/eTSBuildCommonView/README_zh.md b/eTSUI/eTSBuildCommonView/README_zh.md similarity index 100% rename from UI/eTSBuildCommonView/README_zh.md rename to eTSUI/eTSBuildCommonView/README_zh.md diff --git a/UI/eTSBuildCommonView/build.gradle b/eTSUI/eTSBuildCommonView/build.gradle similarity index 96% rename from UI/eTSBuildCommonView/build.gradle rename to eTSUI/eTSBuildCommonView/build.gradle index 987446063cadb70eb44d8a85774bc3f109423f8d..d79190c37ffeb7dbfd62e82f424bd0c401e95c72 100644 --- a/UI/eTSBuildCommonView/build.gradle +++ b/eTSUI/eTSBuildCommonView/build.gradle @@ -1,34 +1,34 @@ -// 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 7 - supportSystem "standard" -} - -buildscript { - repositories { - maven { - url 'https://repo.huaweicloud.com/repository/maven/' - } - maven { - url 'https://developer.huawei.com/repo/' - } - } - dependencies { - classpath 'com.huawei.ohos:hap:3.0.3.2' - classpath 'com.huawei.ohos:decctest:1.2.6.0' - } -} - -allprojects { - repositories { - maven { - url 'https://repo.huaweicloud.com/repository/maven/' - } - maven { - url 'https://developer.huawei.com/repo/' - } - } -} +// 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 7 + supportSystem "standard" +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:3.0.3.2' + classpath 'com.huawei.ohos:decctest:1.2.6.0' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/UI/eTSBuildCommonView/entry/build.gradle b/eTSUI/eTSBuildCommonView/entry/build.gradle similarity index 96% rename from UI/eTSBuildCommonView/entry/build.gradle rename to eTSUI/eTSBuildCommonView/entry/build.gradle index 1395dd59512c1a3b2b9e7845a06fccd2f94fa1c4..cb1b043b0ac22c936d09041dc7bfecd617931472 100644 --- a/UI/eTSBuildCommonView/entry/build.gradle +++ b/eTSUI/eTSBuildCommonView/entry/build.gradle @@ -1,16 +1,16 @@ -apply plugin: 'com.huawei.ohos.hap' -//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 -ohos { - compileSdkVersion 7 - defaultConfig { - compatibleSdkVersion 7 - } - buildTypes { - release { - proguardOpt { - proguardEnabled false - rulesFiles 'proguard-rules.pro' - } - } - } +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } } \ No newline at end of file diff --git a/UI/eTSBuildCommonView/entry/src/main/config.json b/eTSUI/eTSBuildCommonView/entry/src/main/config.json similarity index 100% rename from UI/eTSBuildCommonView/entry/src/main/config.json rename to eTSUI/eTSBuildCommonView/entry/src/main/config.json diff --git a/UI/eTSBuildCommonView/entry/src/main/ets/MainAbility/app.ets b/eTSUI/eTSBuildCommonView/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from UI/eTSBuildCommonView/entry/src/main/ets/MainAbility/app.ets rename to eTSUI/eTSBuildCommonView/entry/src/main/ets/MainAbility/app.ets diff --git a/UI/eTSBuildCommonView/entry/src/main/ets/MainAbility/pages/FoodDetail.ets b/eTSUI/eTSBuildCommonView/entry/src/main/ets/MainAbility/pages/FoodDetail.ets similarity index 100% rename from UI/eTSBuildCommonView/entry/src/main/ets/MainAbility/pages/FoodDetail.ets rename to eTSUI/eTSBuildCommonView/entry/src/main/ets/MainAbility/pages/FoodDetail.ets diff --git a/UI/eTSBuildCommonView/entry/src/main/resources/base/element/string.json b/eTSUI/eTSBuildCommonView/entry/src/main/resources/base/element/string.json similarity index 94% rename from UI/eTSBuildCommonView/entry/src/main/resources/base/element/string.json rename to eTSUI/eTSBuildCommonView/entry/src/main/resources/base/element/string.json index a369e7b5d7acba406c1e7808e88980d71725898d..3440475e7cbd0420317843d6131c278bd48a8ece 100644 --- a/UI/eTSBuildCommonView/entry/src/main/resources/base/element/string.json +++ b/eTSUI/eTSBuildCommonView/entry/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "Healthy Diet" - }, - { - "name": "mainability_description", - "value": "ETS_Empty Ability" - } - ] +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "Healthy Diet" + }, + { + "name": "mainability_description", + "value": "ETS_Empty Ability" + } + ] } \ No newline at end of file diff --git a/UI/eTSBuildCommonView/entry/src/main/resources/base/media/Logo.png b/eTSUI/eTSBuildCommonView/entry/src/main/resources/base/media/Logo.png similarity index 100% rename from UI/eTSBuildCommonView/entry/src/main/resources/base/media/Logo.png rename to eTSUI/eTSBuildCommonView/entry/src/main/resources/base/media/Logo.png diff --git a/UI/eTSBuildCommonView/entry/src/main/resources/phone/media/Tomato.png b/eTSUI/eTSBuildCommonView/entry/src/main/resources/phone/media/Tomato.png similarity index 100% rename from UI/eTSBuildCommonView/entry/src/main/resources/phone/media/Tomato.png rename to eTSUI/eTSBuildCommonView/entry/src/main/resources/phone/media/Tomato.png diff --git a/UI/eTSBuildCommonView/entry/src/main/resources/rawfile/Tomato.png b/eTSUI/eTSBuildCommonView/entry/src/main/resources/rawfile/Tomato.png similarity index 100% rename from UI/eTSBuildCommonView/entry/src/main/resources/rawfile/Tomato.png rename to eTSUI/eTSBuildCommonView/entry/src/main/resources/rawfile/Tomato.png diff --git a/UI/eTSBuildCommonView/screenshots/device/FoodDetail.png b/eTSUI/eTSBuildCommonView/screenshots/device/FoodDetail.png similarity index 100% rename from UI/eTSBuildCommonView/screenshots/device/FoodDetail.png rename to eTSUI/eTSBuildCommonView/screenshots/device/FoodDetail.png diff --git a/UI/eTSBuildCommonView/settings.gradle b/eTSUI/eTSBuildCommonView/settings.gradle similarity index 94% rename from UI/eTSBuildCommonView/settings.gradle rename to eTSUI/eTSBuildCommonView/settings.gradle index 28d595f2fba0d06b2025da200383d15f87c4e9f0..4773db73233a570c2d0c01a22e75321acfbf7a07 100644 --- a/UI/eTSBuildCommonView/settings.gradle +++ b/eTSUI/eTSBuildCommonView/settings.gradle @@ -1 +1 @@ -include ':entry' +include ':entry' diff --git a/UI/eTSDefiningPageLayoutAndConnection/README_zh.md b/eTSUI/eTSDefiningPageLayoutAndConnection/README_zh.md similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/README_zh.md rename to eTSUI/eTSDefiningPageLayoutAndConnection/README_zh.md diff --git a/UI/eTSDefiningPageLayoutAndConnection/build.gradle b/eTSUI/eTSDefiningPageLayoutAndConnection/build.gradle similarity index 96% rename from UI/eTSDefiningPageLayoutAndConnection/build.gradle rename to eTSUI/eTSDefiningPageLayoutAndConnection/build.gradle index 987446063cadb70eb44d8a85774bc3f109423f8d..d79190c37ffeb7dbfd62e82f424bd0c401e95c72 100644 --- a/UI/eTSDefiningPageLayoutAndConnection/build.gradle +++ b/eTSUI/eTSDefiningPageLayoutAndConnection/build.gradle @@ -1,34 +1,34 @@ -// 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 7 - supportSystem "standard" -} - -buildscript { - repositories { - maven { - url 'https://repo.huaweicloud.com/repository/maven/' - } - maven { - url 'https://developer.huawei.com/repo/' - } - } - dependencies { - classpath 'com.huawei.ohos:hap:3.0.3.2' - classpath 'com.huawei.ohos:decctest:1.2.6.0' - } -} - -allprojects { - repositories { - maven { - url 'https://repo.huaweicloud.com/repository/maven/' - } - maven { - url 'https://developer.huawei.com/repo/' - } - } -} +// 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 7 + supportSystem "standard" +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:3.0.3.2' + classpath 'com.huawei.ohos:decctest:1.2.6.0' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/eTSUI/eTSDefiningPageLayoutAndConnection/entry/build.gradle b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..8243c3b322a99d4203fb603bab0cafd024091fb7 --- /dev/null +++ b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/build.gradle @@ -0,0 +1,16 @@ +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/config.json b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/config.json similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/config.json rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/config.json diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/app.ets b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/app.ets rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/app.ets diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodData.ets b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodData.ets similarity index 96% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodData.ets rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodData.ets index 458b87ab5d868d06bf8c4e4749beaf137f12ea03..3507f35acc12ccf9db1cde864dcfbf8eb4fc15c2 100644 --- a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodData.ets +++ b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodData.ets @@ -1,47 +1,47 @@ -/* - * 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 enum Category { - Fruit, - Vegetable, - Nut, - Seafood, - Dessert -} - -let NextId = 0; -export class FoodData { - id: string; - name: string; - image: Resource - category: Category; - calories: number; - protein: number; - fat: number; - carbohydrates: number; - vitaminC: number; - - constructor(name: string, image: Resource, category: Category, calories: number, protein: number, fat: number, carbohydrates: number, vitaminC: number) { - this.id = `${ NextId++ }`; - this.name = name; - this.image = image; - this.category = category; - this.calories = calories; - this.protein = protein; - this.fat = fat; - this.carbohydrates = carbohydrates; - this.vitaminC = vitaminC; - } +/* + * 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 enum Category { + Fruit, + Vegetable, + Nut, + Seafood, + Dessert +} + +let NextId = 0; +export class FoodData { + id: string; + name: string; + image: Resource + category: Category; + calories: number; + protein: number; + fat: number; + carbohydrates: number; + vitaminC: number; + + constructor(name: string, image: Resource, category: Category, calories: number, protein: number, fat: number, carbohydrates: number, vitaminC: number) { + this.id = `${ NextId++ }`; + this.name = name; + this.image = image; + this.category = category; + this.calories = calories; + this.protein = protein; + this.fat = fat; + this.carbohydrates = carbohydrates; + this.vitaminC = vitaminC; + } } \ No newline at end of file diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodDataModels.ets b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodDataModels.ets similarity index 98% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodDataModels.ets rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodDataModels.ets index 71a700f7082a5c3b6f5e8d6ecd9487966698acba..fd6fa8304ea7b7d9ed7c26fb95d0101b801b4338 100644 --- a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodDataModels.ets +++ b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/model/FoodDataModels.ets @@ -1,39 +1,39 @@ -/* - * 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 { FoodData, Category } from './FoodData' - -const FoodComposition: any[] = [ - { 'name': 'Tomato', 'image': $r('app.media.Tomato'), 'category': Category.Vegetable, 'calories': 17, 'protein': 0.9, 'fat': 0.2, 'carbohydrates': 3.9, 'vitaminC': 17.8 }, - { 'name': 'Walnut', 'image': $r('app.media.Walnut'), 'category': Category.Nut, 'calories': 654 , 'protein': 15, 'fat': 65, 'carbohydrates': 14, 'vitaminC': 1.3 }, - { 'name': 'Cucumber', 'image': $r('app.media.Cucumber'), 'category': Category.Vegetable, 'calories': 30, 'protein': 3, 'fat': 0, 'carbohydrates': 1.9, 'vitaminC': 2.1 }, - { 'name': 'Blueberry', 'image': $r('app.media.Blueberry'), 'category': Category.Fruit, 'calories': 57, 'protein': 0.7, 'fat': 0.3, 'carbohydrates': 14, 'vitaminC': 9.7 }, - { 'name': 'Crab', 'image': $r('app.media.Crab'), 'category': Category.Seafood, 'calories': 97, 'protein': 19, 'fat': 1.5, 'carbohydrates': 0, 'vitaminC': 7.6 }, - { 'name': 'IceCream', 'image': $r('app.media.IceCream'), 'category': Category.Dessert, 'calories': 207, 'protein': 3.5, 'fat': 11, 'carbohydrates': 24, 'vitaminC': 0.6 }, - { 'name': 'Onion', 'image': $r('app.media.Onion'), 'category': Category.Vegetable, 'calories': 39, 'protein': 1.1, 'fat': 0.1, 'carbohydrates': 9, 'vitaminC': 7.4 }, - { 'name': 'Mushroom', 'image': $r('app.media.Mushroom'), 'category': Category.Vegetable, 'calories': 22, 'protein': 3.1, 'fat': 0.3, 'carbohydrates': 3.3, 'vitaminC': 2.1 }, - { 'name': 'Kiwi', 'image': $r('app.media.Kiwi'), 'category': Category.Fruit, 'calories': 60 , 'protein': 1.1, 'fat': 0.5, 'carbohydrates': 15, 'vitaminC': 20.5 }, - { 'name': 'Pitaya', 'image': $r('app.media.Pitaya'), 'category': Category.Fruit, 'calories': 60, 'protein': 1.2, 'fat': 0, 'carbohydrates': 10, 'vitaminC': 60.9 }, - { 'name': 'Avocado', 'image': $r('app.media.Avocado'), 'category': Category.Fruit, 'calories': 160, 'protein': 2, 'fat': 15, 'carbohydrates': 9, 'vitaminC': 10 }, - { 'name': 'Strawberry', 'image': $r('app.media.Strawberry'), 'category': Category.Fruit, 'calories': 32, 'protein': 0.7, 'fat': 0.3, 'carbohydrates': 8, 'vitaminC': 58.8 } -] - -export function initializeOnStartup(): Array { - let FoodDataArray: Array = [] - FoodComposition.forEach(item => { - FoodDataArray.push(new FoodData(item.name, item.image, item.category, item.calories, item.protein, item.fat, item.carbohydrates, item.vitaminC)); - }) - return FoodDataArray; -} +/* + * 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 { FoodData, Category } from './FoodData' + +const FoodComposition: any[] = [ + { 'name': 'Tomato', 'image': $r('app.media.Tomato'), 'category': Category.Vegetable, 'calories': 17, 'protein': 0.9, 'fat': 0.2, 'carbohydrates': 3.9, 'vitaminC': 17.8 }, + { 'name': 'Walnut', 'image': $r('app.media.Walnut'), 'category': Category.Nut, 'calories': 654 , 'protein': 15, 'fat': 65, 'carbohydrates': 14, 'vitaminC': 1.3 }, + { 'name': 'Cucumber', 'image': $r('app.media.Cucumber'), 'category': Category.Vegetable, 'calories': 30, 'protein': 3, 'fat': 0, 'carbohydrates': 1.9, 'vitaminC': 2.1 }, + { 'name': 'Blueberry', 'image': $r('app.media.Blueberry'), 'category': Category.Fruit, 'calories': 57, 'protein': 0.7, 'fat': 0.3, 'carbohydrates': 14, 'vitaminC': 9.7 }, + { 'name': 'Crab', 'image': $r('app.media.Crab'), 'category': Category.Seafood, 'calories': 97, 'protein': 19, 'fat': 1.5, 'carbohydrates': 0, 'vitaminC': 7.6 }, + { 'name': 'IceCream', 'image': $r('app.media.IceCream'), 'category': Category.Dessert, 'calories': 207, 'protein': 3.5, 'fat': 11, 'carbohydrates': 24, 'vitaminC': 0.6 }, + { 'name': 'Onion', 'image': $r('app.media.Onion'), 'category': Category.Vegetable, 'calories': 39, 'protein': 1.1, 'fat': 0.1, 'carbohydrates': 9, 'vitaminC': 7.4 }, + { 'name': 'Mushroom', 'image': $r('app.media.Mushroom'), 'category': Category.Vegetable, 'calories': 22, 'protein': 3.1, 'fat': 0.3, 'carbohydrates': 3.3, 'vitaminC': 2.1 }, + { 'name': 'Kiwi', 'image': $r('app.media.Kiwi'), 'category': Category.Fruit, 'calories': 60 , 'protein': 1.1, 'fat': 0.5, 'carbohydrates': 15, 'vitaminC': 20.5 }, + { 'name': 'Pitaya', 'image': $r('app.media.Pitaya'), 'category': Category.Fruit, 'calories': 60, 'protein': 1.2, 'fat': 0, 'carbohydrates': 10, 'vitaminC': 60.9 }, + { 'name': 'Avocado', 'image': $r('app.media.Avocado'), 'category': Category.Fruit, 'calories': 160, 'protein': 2, 'fat': 15, 'carbohydrates': 9, 'vitaminC': 10 }, + { 'name': 'Strawberry', 'image': $r('app.media.Strawberry'), 'category': Category.Fruit, 'calories': 32, 'protein': 0.7, 'fat': 0.3, 'carbohydrates': 8, 'vitaminC': 58.8 } +] + +export function initializeOnStartup(): Array { + let FoodDataArray: Array = [] + FoodComposition.forEach(item => { + FoodDataArray.push(new FoodData(item.name, item.image, item.category, item.calories, item.protein, item.fat, item.carbohydrates, item.vitaminC)); + }) + return FoodDataArray; +} diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodCategoryList.ets b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodCategoryList.ets similarity index 96% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodCategoryList.ets rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodCategoryList.ets index 1d60743c950f9e6de40bab883fd1eebc1a4f0f4c..d22841b46c804757e62e92ac5d10a900b6986079 100644 --- a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodCategoryList.ets +++ b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodCategoryList.ets @@ -1,196 +1,196 @@ -/* - * 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 router from '@system.router' -import { Category, FoodData } from '../model/FoodData' -import { initializeOnStartup } from '../model/FoodDataModels' - -@Component -struct FoodListItem { - private foodItem: FoodData - build() { - Navigator({ target: 'pages/FoodDetail' }) { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .autoResize(false) - .height(40) - .width(40) - } - .backgroundColor('#FFf1f3f5') - .margin({ right: 16 }) - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - Text(this.foodItem.calories + ' kcal') - .fontSize(14) - } - .height(64) - } - .params({ foodId: this.foodItem }) - .margin({ right: 24, left: 32 }) - } -} - - -@Component -struct FoodList { - private foodItems: FoodData[] - build() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text('Food List') - .fontSize(20) - .margin({ left: 20 }) - } - .height('7%') - .backgroundColor('#FFf1f3f5') - List() { - ForEach(this.foodItems, item => { - ListItem() { - FoodListItem({ foodItem: item }) - } - }, item => item.id.toString()) - }.height('93%') - } - } -} - -@Component -struct FoodGridItem { - private foodItem: FoodData - build() { - Column() { - Row() { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .height(152) - .width('100%') - }.backgroundColor('#FFf1f3f5') - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - .padding({ left: 8 }) - Text(this.foodItem.calories + 'kcal') - .fontSize(14) - .margin({ right: 6 }) - } - .height(32) - .width('100%') - .backgroundColor('#FFe5e5e5') - } - .height(184) - .width('100%') - .onClick(() => { - router.push({ uri: 'pages/FoodDetail', params: { foodId: this.foodItem } }) - }) - } -} - -@Component -struct FoodGrid { - private foodItems: FoodData[] - private gridRowTemplate: string = '' - private heightValue: number - - aboutToAppear() { - var rows = Math.round(this.foodItems.length / 2); - this.gridRowTemplate = '1fr '.repeat(rows); - this.heightValue = rows * 192 - 8; - } - - build() { - Scroll() { - Grid() { - ForEach(this.foodItems, (item: FoodData) => { - GridItem() { - FoodGridItem({ foodItem: item }) - } - }, (item: FoodData) => item.id.toString()) - } - .rowsTemplate(this.gridRowTemplate) - .columnsTemplate('1fr 1fr') - .columnsGap(8) - .rowsGap(8) - .height(this.heightValue) - } - .scrollBar(BarState.Off) - .padding({ left: 16, right: 16 }) - } -} - -@Component -struct FoodCategory { - private foodItems: FoodData[] - build() { - Stack() { - Tabs() { - TabContent() { - FoodGrid({ foodItems: this.foodItems }) - }.tabBar('All') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Vegetable)) }) - }.tabBar('Vegetable') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Fruit)) }) - }.tabBar('Fruit') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Nut)) }) - }.tabBar('Nut') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Seafood)) }) - }.tabBar('Seafood') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Dessert)) }) - }.tabBar('Dessert') - } - .barWidth(280) - .barMode(BarMode.Scrollable) - } - } -} - -@Entry -@Component -struct FoodCategoryList { - private foodItems: FoodData[] = initializeOnStartup() - @State private showList: boolean = false - - build() { - Column() { - Stack({ alignContent: Alignment.TopEnd }) { - if (this.showList) { - FoodList({ foodItems: this.foodItems }) - } else { - FoodCategory({ foodItems: this.foodItems }) - } - Image($r('app.media.Switch')) - .height(24) - .width(24) - .margin({ top: 15, right: 10 }) - .onClick(() => { - this.showList = !this.showList - }) - } - }.height('100%') - } -} +/* + * 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 router from '@system.router' +import { Category, FoodData } from '../model/FoodData' +import { initializeOnStartup } from '../model/FoodDataModels' + +@Component +struct FoodListItem { + private foodItem: FoodData + build() { + Navigator({ target: 'pages/FoodDetail' }) { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Image(this.foodItem.image) + .objectFit(ImageFit.Contain) + .autoResize(false) + .height(40) + .width(40) + } + .backgroundColor('#FFf1f3f5') + .margin({ right: 16 }) + Text(this.foodItem.name) + .fontSize(14) + .flexGrow(1) + Text(this.foodItem.calories + ' kcal') + .fontSize(14) + } + .height(64) + } + .params({ foodId: this.foodItem }) + .margin({ right: 24, left: 32 }) + } +} + + +@Component +struct FoodList { + private foodItems: FoodData[] + build() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text('Food List') + .fontSize(20) + .margin({ left: 20 }) + } + .height('7%') + .backgroundColor('#FFf1f3f5') + List() { + ForEach(this.foodItems, item => { + ListItem() { + FoodListItem({ foodItem: item }) + } + }, item => item.id.toString()) + }.height('93%') + } + } +} + +@Component +struct FoodGridItem { + private foodItem: FoodData + build() { + Column() { + Row() { + Image(this.foodItem.image) + .objectFit(ImageFit.Contain) + .height(152) + .width('100%') + }.backgroundColor('#FFf1f3f5') + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text(this.foodItem.name) + .fontSize(14) + .flexGrow(1) + .padding({ left: 8 }) + Text(this.foodItem.calories + 'kcal') + .fontSize(14) + .margin({ right: 6 }) + } + .height(32) + .width('100%') + .backgroundColor('#FFe5e5e5') + } + .height(184) + .width('100%') + .onClick(() => { + router.push({ uri: 'pages/FoodDetail', params: { foodId: this.foodItem } }) + }) + } +} + +@Component +struct FoodGrid { + private foodItems: FoodData[] + private gridRowTemplate: string = '' + private heightValue: number + + aboutToAppear() { + var rows = Math.round(this.foodItems.length / 2); + this.gridRowTemplate = '1fr '.repeat(rows); + this.heightValue = rows * 192 - 8; + } + + build() { + Scroll() { + Grid() { + ForEach(this.foodItems, (item: FoodData) => { + GridItem() { + FoodGridItem({ foodItem: item }) + } + }, (item: FoodData) => item.id.toString()) + } + .rowsTemplate(this.gridRowTemplate) + .columnsTemplate('1fr 1fr') + .columnsGap(8) + .rowsGap(8) + .height(this.heightValue) + } + .scrollBar(BarState.Off) + .padding({ left: 16, right: 16 }) + } +} + +@Component +struct FoodCategory { + private foodItems: FoodData[] + build() { + Stack() { + Tabs() { + TabContent() { + FoodGrid({ foodItems: this.foodItems }) + }.tabBar('All') + + TabContent() { + FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Vegetable)) }) + }.tabBar('Vegetable') + + TabContent() { + FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Fruit)) }) + }.tabBar('Fruit') + + TabContent() { + FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Nut)) }) + }.tabBar('Nut') + + TabContent() { + FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Seafood)) }) + }.tabBar('Seafood') + + TabContent() { + FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Dessert)) }) + }.tabBar('Dessert') + } + .barWidth(280) + .barMode(BarMode.Scrollable) + } + } +} + +@Entry +@Component +struct FoodCategoryList { + private foodItems: FoodData[] = initializeOnStartup() + @State private showList: boolean = false + + build() { + Column() { + Stack({ alignContent: Alignment.TopEnd }) { + if (this.showList) { + FoodList({ foodItems: this.foodItems }) + } else { + FoodCategory({ foodItems: this.foodItems }) + } + Image($r('app.media.Switch')) + .height(24) + .width(24) + .margin({ top: 15, right: 10 }) + .onClick(() => { + this.showList = !this.showList + }) + } + }.height('100%') + } +} diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodDetail.ets b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodDetail.ets similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodDetail.ets rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/MainAbility/pages/FoodDetail.ets diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/element/string.json b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/element/string.json similarity index 94% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/element/string.json rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/element/string.json index a369e7b5d7acba406c1e7808e88980d71725898d..3440475e7cbd0420317843d6131c278bd48a8ece 100644 --- a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/element/string.json +++ b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "Healthy Diet" - }, - { - "name": "mainability_description", - "value": "ETS_Empty Ability" - } - ] +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "Healthy Diet" + }, + { + "name": "mainability_description", + "value": "ETS_Empty Ability" + } + ] } \ No newline at end of file diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/media/Logo.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/media/Logo.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/media/Logo.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/base/media/Logo.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Avocado.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Avocado.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Avocado.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Avocado.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Back.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Back.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Back.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Back.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Blueberry.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Blueberry.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Blueberry.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Blueberry.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Crab.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Crab.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Crab.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Crab.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Cucumber.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Cucumber.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Cucumber.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Cucumber.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/IceCream.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/IceCream.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/IceCream.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/IceCream.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Kiwi.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Kiwi.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Kiwi.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Kiwi.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Mushroom.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Mushroom.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Mushroom.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Mushroom.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Onion.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Onion.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Onion.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Onion.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Pitaya.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Pitaya.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Pitaya.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Pitaya.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Strawberry.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Strawberry.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Strawberry.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Strawberry.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Switch.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Switch.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Switch.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Switch.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Tomato.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Tomato.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Tomato.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Tomato.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Walnut.png b/eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Walnut.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Walnut.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/resources/phone/media/Walnut.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodCategory.png b/eTSUI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodCategory.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodCategory.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodCategory.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodDetail.png b/eTSUI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodDetail.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodDetail.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodDetail.png diff --git a/UI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodList.png b/eTSUI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodList.png similarity index 100% rename from UI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodList.png rename to eTSUI/eTSDefiningPageLayoutAndConnection/screenshots/device/FoodList.png diff --git a/eTSUI/eTSDefiningPageLayoutAndConnection/settings.gradle b/eTSUI/eTSDefiningPageLayoutAndConnection/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/eTSUI/eTSDefiningPageLayoutAndConnection/settings.gradle @@ -0,0 +1 @@ +include ':entry' diff --git a/eTSUI/eTSProcess/README_zh.md b/eTSUI/eTSProcess/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..621ad8f0825b5f34cb706ee48bd371799dbb3f34 --- /dev/null +++ b/eTSUI/eTSProcess/README_zh.md @@ -0,0 +1,17 @@ +# EtsProcess + + + +### 简介 + +本示例展示了eTS中如何使用**process**获取进程相关的信息和更改当前工作目录,以及展示如何启动一个子进程来运行一段shell,如何关闭子进程等操作。 + +### 使用说明 + +1、首页中展示**process**的各个功能按钮,点击**获取当前系统运行时间**、**获取进程当前工作目录**、更改进程当前工作目录、**发送signal到指定的进程**、**启动一个子进程**、**关闭子进程**、**退出当前系统**按钮执行相应的功能,并在底部文本区显示运行结果。 + + + +### 约束与限制 + +本示例支持标准系统上运行。 diff --git a/eTSUI/eTSProcess/build.gradle b/eTSUI/eTSProcess/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..ecbb99c45d4bdfa94b95e0b3f021f66b1984e55c --- /dev/null +++ b/eTSUI/eTSProcess/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 7 + supportSystem "standard" +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:3.0.3.4' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/eTSUI/eTSProcess/entry/build.gradle b/eTSUI/eTSProcess/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..8243c3b322a99d4203fb603bab0cafd024091fb7 --- /dev/null +++ b/eTSUI/eTSProcess/entry/build.gradle @@ -0,0 +1,16 @@ +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} diff --git a/eTSUI/eTSProcess/entry/src/main/config.json b/eTSUI/eTSProcess/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..f3b30ea19d8fcc449d88d808214d2e200d8d756a --- /dev/null +++ b/eTSUI/eTSProcess/entry/src/main/config.json @@ -0,0 +1,66 @@ +{ + "app": { + "bundleName": "ohos.samples.etsprocess", + "vendor": "samples", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.etsprocess", + "name": ".MyApplication", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/eTSUI/eTSProcess/entry/src/main/ets/MainAbility/app.ets b/eTSUI/eTSProcess/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfb9635413551f8ad3434468b138550cbad174d6 --- /dev/null +++ b/eTSUI/eTSProcess/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,22 @@ +/* + * 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('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/eTSUI/eTSProcess/entry/src/main/ets/MainAbility/pages/index.ets b/eTSUI/eTSProcess/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a6149064e25cb0c08c864da4e5f175c8bdeff41 --- /dev/null +++ b/eTSUI/eTSProcess/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,155 @@ +/* + * 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 process from '@ohos.process' + +let child = null + +@Entry +@Component +struct Index { + @State result: string = '' + + build() { + Column() { + Text($r("app.string.entry_MainAbility")) + .width('100%') + .height(50) + .backgroundColor('#0D9FFB') + .fontColor(Color.White) + .fontSize(20) + .padding({ left: 15 }) + Scroll() { + Column() { + Button() { + Text($r('app.string.uptime')) + .fontSize(19) + .fontWeight(FontWeight.Bold) + .padding({ left: 10, right: 10 }) + .width('100%') + .textAlign(TextAlign.Center) + }.type(ButtonType.Capsule) + .backgroundColor('#0D9FFB') + .onClick(() => { + this.result = process.uptime().toString() + 's' + console.info('guojin uptime=' + this.result) + }) + Button() { + Text($r('app.string.cwd')) + .fontSize(19) + .fontWeight(FontWeight.Bold) + .padding({ left: 10, right: 10 }) + .width('100%') + .textAlign(TextAlign.Center) + }.type(ButtonType.Capsule) + .backgroundColor('#0D9FFB') + .margin({ top: 15 }) + .onClick(() => { + this.result = process.cwd().toString() + }) + Button() { + Text($r('app.string.change_work_directory')) + .fontSize(19) + .fontWeight(FontWeight.Bold) + .padding({ left: 10, right: 10 }) + .width('100%') + .textAlign(TextAlign.Center) + }.type(ButtonType.Capsule) + .backgroundColor('#0D9FFB') + .margin({ top: 15 }) + .onClick(() => { + process.chdir('/system') + this.result = process.cwd().toString() + }) + Button() { + Text($r('app.string.kill')) + .fontSize(19) + .fontWeight(FontWeight.Bold) + .padding({ left: 10, right: 10 }) + .width('100%') + .textAlign(TextAlign.Center) + }.type(ButtonType.Capsule) + .backgroundColor('#0D9FFB') + .margin({ top: 15 }) + .onClick(() => { + var pres = process.getPid + var result = process.kill(pres, 28) + if (result === true) { + this.result = 'succeed' + } else { + this.result = 'failed' + } + }) + Button() { + Text($r('app.string.runCmd')) + .fontSize(19) + .fontWeight(FontWeight.Bold) + .padding({ left: 10, right: 10 }) + .width('100%') + .textAlign(TextAlign.Center) + }.type(ButtonType.Capsule) + .margin({ top: 15 }) + .backgroundColor('#0D9FFB') + .onClick(() => { + child = process.runCmd('sleep 3;ls') + this.result = child == null ? 'failed' : 'succeed' + console.info('guojin runCmd=' + this.result) + var result = child.wait(); + result.then(val => { + this.result = 'child process run finish' + JSON.stringify(val) + console.info('runCmd result =' + val) + }) + }) + Button() { + Text($r('app.string.close_child')) + .fontSize(19) + .fontWeight(FontWeight.Bold) + .padding({ left: 10, right: 10 }) + .width('100%') + .textAlign(TextAlign.Center) + }.type(ButtonType.Capsule) + .margin({ top: 15 }) + .backgroundColor('#0D9FFB') + .onClick(() => { + child.close() + this.result = 'close succeed' + }) + Button() { + Text($r('app.string.exit')) + .fontSize(19) + .fontWeight(FontWeight.Bold) + .padding({ left: 10, right: 10 }) + .width('100%') + .textAlign(TextAlign.Center) + }.type(ButtonType.Capsule) + .backgroundColor('#0D9FFB') + .margin({ top: 15 }) + .onClick(() => { + process.exit(0) + }) + Text(this.result) + .width('100%') + .height(100) + .backgroundColor('#DFDFDF') + .fontSize(20) + .margin({ top: 20 }) + .textAlign(TextAlign.Start) + .padding(10) + }.constraintSize({ minHeight: '100%' }) + } + .width('100%').height('100%') + .padding(15) + } + } +} \ No newline at end of file diff --git a/eTSUI/eTSProcess/entry/src/main/resources/base/element/string.json b/eTSUI/eTSProcess/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a4832f8c13f09a3f59992f0a94fd083e064560fc --- /dev/null +++ b/eTSUI/eTSProcess/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "EtsProcess" + }, + { + "name": "description_mainability", + "value": "EtsProcess Ability" + }, + { + "name": "uptime", + "value": "Get current process rum time" + }, + { + "name": "runCmd", + "value": "Start a child process" + }, + { + "name": "close_child", + "value": "Close the child process" + }, + { + "name": "cwd", + "value": "Get process work directory" + }, + { + "name": "change_work_directory", + "value": "Change work directory" + }, + { + "name": "exit", + "value": "Exit the process" + }, + { + "name": "kill", + "value": "send signal to process" + } + ] +} \ No newline at end of file diff --git a/eTSUI/eTSProcess/entry/src/main/resources/base/media/icon.png b/eTSUI/eTSProcess/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/eTSUI/eTSProcess/entry/src/main/resources/base/media/icon.png differ diff --git a/eTSUI/eTSProcess/entry/src/main/resources/en/element/string.json b/eTSUI/eTSProcess/entry/src/main/resources/en/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a4832f8c13f09a3f59992f0a94fd083e064560fc --- /dev/null +++ b/eTSUI/eTSProcess/entry/src/main/resources/en/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "EtsProcess" + }, + { + "name": "description_mainability", + "value": "EtsProcess Ability" + }, + { + "name": "uptime", + "value": "Get current process rum time" + }, + { + "name": "runCmd", + "value": "Start a child process" + }, + { + "name": "close_child", + "value": "Close the child process" + }, + { + "name": "cwd", + "value": "Get process work directory" + }, + { + "name": "change_work_directory", + "value": "Change work directory" + }, + { + "name": "exit", + "value": "Exit the process" + }, + { + "name": "kill", + "value": "send signal to process" + } + ] +} \ No newline at end of file diff --git a/eTSUI/eTSProcess/entry/src/main/resources/zh/element/string.json b/eTSUI/eTSProcess/entry/src/main/resources/zh/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2f7710879a9546c2770396adb24d9394a6e132d6 --- /dev/null +++ b/eTSUI/eTSProcess/entry/src/main/resources/zh/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "Ets进程信息" + }, + { + "name": "description_mainability", + "value": "EtsProcess Ability" + }, + { + "name": "uptime", + "value": "获取当前系统运行时间" + }, + { + "name": "runCmd", + "value": "启动一个子进程" + }, + { + "name": "close_child", + "value": "关闭子进程" + }, + { + "name": "cwd", + "value": "获取进程当前工作目录" + }, + { + "name": "change_work_directory", + "value": "更改进程当前工作目录" + }, + { + "name": "exit", + "value": "退出当前系统" + }, + { + "name": "kill", + "value": "发送signal到指定的进程" + } + ] +} \ No newline at end of file diff --git a/eTSUI/eTSProcess/screenshots/devices/main.png b/eTSUI/eTSProcess/screenshots/devices/main.png new file mode 100644 index 0000000000000000000000000000000000000000..ccaad196c6ee636f41674f838ba36567d8149a49 Binary files /dev/null and b/eTSUI/eTSProcess/screenshots/devices/main.png differ diff --git a/eTSUI/eTSProcess/settings.gradle b/eTSUI/eTSProcess/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/eTSUI/eTSProcess/settings.gradle @@ -0,0 +1 @@ +include ':entry'