diff --git a/common/AirQuality/README_zh.md b/common/AirQuality/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..f91adb7c1759b9bed79f4d63477815859a0ef528 --- /dev/null +++ b/common/AirQuality/README_zh.md @@ -0,0 +1,16 @@ +# 空气质量 + +### 简介 + +本示例使用JS实现了一个简单空气质量应用,使用折行显示能力显示空气质量信息,使用柱形图展示历史记录。 + +### 使用说明 + +- 点击桌面应用图标,启动应用; +- 在首页展示空气质量信息,左右滑动可以切换城市; +- 点击历史记录可以跳转到历史记录页面,此界面用柱形图展示历史记录; + +### 约束与限制 + +- 本示例支持在标准系统上运行。 + diff --git a/common/AirQuality/build.gradle b/common/AirQuality/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..46b60f671636e773ed178e73685210c630acf439 --- /dev/null +++ b/common/AirQuality/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.2' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/common/AirQuality/entry/build.gradle b/common/AirQuality/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4186492febe943de4f349ab0adfbb168d763274a --- /dev/null +++ b/common/AirQuality/entry/build.gradle @@ -0,0 +1,17 @@ +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 6 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + diff --git a/common/AirQuality/entry/src/main/config.json b/common/AirQuality/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..946975608fee4bc9af6fdfb8a84698c58c5edad0 --- /dev/null +++ b/common/AirQuality/entry/src/main/config.json @@ -0,0 +1,62 @@ +{ + "app": { + "bundleName": "ohos.samples.airquality", + "vendor": "samples", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.airquality", + "name": ".MyApplication", + "mainAbility": ".default", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "name": ".default", + "srcPath": "default", + "srcLanguage": "js", + "icon": "$media:icon", + "description": "$string:mainability_description", + "formsEnabled": false, + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index", + "pages/second/second" + ], + "name": ".default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/common/AirQuality/entry/src/main/js/default/app.js b/common/AirQuality/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..50449ecbed6d3b8099f6f9a1fb66e29bbe2177f0 --- /dev/null +++ b/common/AirQuality/entry/src/main/js/default/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/common/AirQuality/entry/src/main/js/default/common/ic_back.png b/common/AirQuality/entry/src/main/js/default/common/ic_back.png new file mode 100644 index 0000000000000000000000000000000000000000..4a269a11a6eca005d2eabb957992297446c858db Binary files /dev/null and b/common/AirQuality/entry/src/main/js/default/common/ic_back.png differ diff --git a/common/AirQuality/entry/src/main/js/default/i18n/en-US.json b/common/AirQuality/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..9eb7314a8f13aa1a24e7422ca82c736a9f259f32 --- /dev/null +++ b/common/AirQuality/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,10 @@ +{ + "strings": { + "title": "AirQuality", + "history": "History record", + "update_time": "Update time: 10: 38", + "source_info": "Information source: tianqi.com" + }, + "Files": { + } +} \ No newline at end of file diff --git a/common/AirQuality/entry/src/main/js/default/i18n/zh-CN.json b/common/AirQuality/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..c7321ad12ddf019fa26037565302e8314f179609 --- /dev/null +++ b/common/AirQuality/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,10 @@ +{ + "strings": { + "title": "空气质量", + "history": "历史记录", + "update_time": "更新时间: 10: 38", + "source_info": "信息来源: tianqi.com" + }, + "Files": { + } +} \ No newline at end of file diff --git a/common/AirQuality/entry/src/main/js/default/pages/index/index.css b/common/AirQuality/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..c385c66236178f1ea8ea5799247e64e543cd6af3 --- /dev/null +++ b/common/AirQuality/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,188 @@ +/* + * 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. + */ +.aqi-value { + text-align: center; + font-size: 40px; + color: #000000; + width: 100%; + height: 25%; +} + +.list { + width: 100%; + height: 100%; +} + +.list-item { + flex-direction: column; + align-items: center; + justify-content: center; +} + +.aqi { + text-align: center; + color: #a2c4a2; + margin-top: 10%; + font-size: 30px; + width: 100%; + height: 30%; +} + +.airquality { + text-align: center; + width: 100%; + height: 25%; + font-size: 30px; +} + +.image { + top: 285px; + left: 274px; + width: 32px; + height: 32px; +} + +.location-text { + text-align: center; + color: #000000; + width: 100%; + height: 50px; + font-size: 35px; +} +.progress-div { + width: 320px; + height: 220px; + flex-direction: column; +} +.progress { + width: 100%; + height: 100%; +} + +.container { + flex-direction: column; + height: 100%; + width: 100%; +} + +.circle-progress { + start-angle: 198deg; + total-angle: 320deg; + stroke-width: 20px; + width: 100%; + height: 100%; + top:5px; +} + +.mask-layer { + width: 100%; + height: 100%; + top:10px; + flex-direction: column; +} + +.detail { + width: 350px; + height: 280px; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.text-wrapper { + width: 100%; + height: 16%; +} + +.gas-name { + width: 50%; + text-align: left; + margin-left: 30%; +} + +.gas-value { + width: 50%; + text-align: right; + margin-right: 30%; +} + +.btn { + width: 50%; + height: 50px; + border-radius: 55px; + background-color: #1a1a1a; + color: #1085CE; +} + +.footer { + width: 100%; + height: 120px; + flex-direction: column; + align-items: center; + margin-top: 10px; +} + +.header { + width: 100%; + height: 80px; +} + +.back { + width: 36px; + height: 36px; + margin-top: 20px; + margin-left: 21px; + color: #e6e6e6; +} + +.title { + width: 296px; + height: 40px; + margin-top: 20px; + margin-left: 21px; + color: #e6e6e6; +} + +.swiper { + height: 700px; + width: 100%; +} + +.page { + width: 100%; + height: 100%; + flex-direction: row; + flex-wrap:wrap; + align-items: center; + justify-content: center; +} + +.update-time { + width: 100%; + color: #A9A9A9; + text-align: center; +} + +.info-source { + width: 100%; + color: #A9A9A9; + text-align: center; +} + +.circle-div { + width: 12px; + height: 12px; + border-radius: 6px; +} \ No newline at end of file diff --git a/common/AirQuality/entry/src/main/js/default/pages/index/index.hml b/common/AirQuality/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..02620f661ce31eeafdcaf573f079a7f1913eafc5 --- /dev/null +++ b/common/AirQuality/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,120 @@ + +