diff --git a/UI/JsBrightness/README_zh.md b/UI/JsBrightness/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..086a1ecdf6510598b414e680b3b5201948630228 --- /dev/null +++ b/UI/JsBrightness/README_zh.md @@ -0,0 +1,14 @@ +# 设置屏幕亮度 + +### 简介 + +本示例通过滑动条来调整屏幕亮度。 + +### 使用说明 + +滑动页面上的滑动条来设置不同的屏幕亮度。 + +### 约束与限制 + +本示例仅支持在标准系统上运行。 + diff --git a/UI/JsBrightness/build.gradle b/UI/JsBrightness/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..708d0f3df6dab533b167c46366653f960c48cac0 --- /dev/null +++ b/UI/JsBrightness/build.gradle @@ -0,0 +1,34 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 6 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/UI/JsBrightness/entry/build.gradle b/UI/JsBrightness/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..6b6a606b1b3e2af76d27a6fa8ad069e92ddbed68 --- /dev/null +++ b/UI/JsBrightness/entry/build.gradle @@ -0,0 +1,17 @@ +apply plugin: 'com.huawei.ohos.hap' + +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 6 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + supportSystem "standard" +} diff --git a/UI/JsBrightness/entry/src/main/config.json b/UI/JsBrightness/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..57ea335800736e724b97b2267f32b8884748b731 --- /dev/null +++ b/UI/JsBrightness/entry/src/main/config.json @@ -0,0 +1,58 @@ +{ + "app": { + "bundleName": "ohos.samples.jsbrightness", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.jsbrightness", + "name": ".MyApplication", + "mainAbility": "ohos.samples.jsbrightness.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "name": "ohos.samples.jsbrightness.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/UI/JsBrightness/entry/src/main/js/default/app.js b/UI/JsBrightness/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..58d12b7b501fbf46db906a86187aaf18dfb1f677 --- /dev/null +++ b/UI/JsBrightness/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate() { + console.info("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/UI/JsBrightness/entry/src/main/js/default/i18n/en-US.json b/UI/JsBrightness/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..7d8e05566a83765411612d04c8c7411456b563b5 --- /dev/null +++ b/UI/JsBrightness/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,9 @@ +{ + "strings": { + "tip": "Tip:Slide the slide bar below to adjust the screen brightness", + "bright": "Bright", + "dark": "Dark" + }, + "Files": { + } +} \ No newline at end of file diff --git a/UI/JsBrightness/entry/src/main/js/default/i18n/zh-CN.json b/UI/JsBrightness/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..445dd6f7d0cffa91976d7e74290bd2350de887e5 --- /dev/null +++ b/UI/JsBrightness/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,9 @@ +{ + "strings": { + "tip": "提示:滑动下面的滑动条来调节屏幕亮度", + "bright": "亮", + "dark": "暗" + }, + "Files": { + } +} \ No newline at end of file diff --git a/UI/JsBrightness/entry/src/main/js/default/pages/index/index.css b/UI/JsBrightness/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b8fd01f77f7fcd877ba2a3f0ad2dc7f72e7e1fac --- /dev/null +++ b/UI/JsBrightness/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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; + margin: 40px; +} + +.tip { + margin-bottom: 50px; + width: 100%; +} + +.slider-div { + flex-direction: row; +} + +.slider { + width: 100%; + border-radius: 30px; + background-color: lightgray; + margin: 10px; + padding: 0px; +} \ No newline at end of file diff --git a/UI/JsBrightness/entry/src/main/js/default/pages/index/index.hml b/UI/JsBrightness/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..a0fe7d2dd27363e852e86ab94be48d7a08789254 --- /dev/null +++ b/UI/JsBrightness/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,23 @@ + + +
+ {{ $t('strings.tip') }} +
+ {{ $t('strings.dark') }} + + {{ $t('strings.bright') }} +
+
\ No newline at end of file diff --git a/UI/JsBrightness/entry/src/main/js/default/pages/index/index.js b/UI/JsBrightness/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..04eec813a6dcdf8407d05b91dff8f51e7a56897a --- /dev/null +++ b/UI/JsBrightness/entry/src/main/js/default/pages/index/index.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. + */ + +import brightness from '@ohos.brightness'; + +export default { + brightness(e) { + brightness.setValue(e.value); + } +} \ No newline at end of file diff --git a/UI/JsBrightness/entry/src/main/resources/base/element/string.json b/UI/JsBrightness/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3f6490dbe92f5d327f58eb1763c5f5408d6139a6 --- /dev/null +++ b/UI/JsBrightness/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "JsBrightness" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/UI/JsBrightness/entry/src/main/resources/base/media/icon.png b/UI/JsBrightness/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/UI/JsBrightness/entry/src/main/resources/base/media/icon.png differ diff --git a/UI/JsBrightness/screenshots/device/page.png b/UI/JsBrightness/screenshots/device/page.png new file mode 100644 index 0000000000000000000000000000000000000000..69a90c5045be8f76ff67c5b0ba8a15f54fbe7a48 Binary files /dev/null and b/UI/JsBrightness/screenshots/device/page.png differ diff --git a/UI/JsBrightness/settings.gradle b/UI/JsBrightness/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/UI/JsBrightness/settings.gradle @@ -0,0 +1 @@ +include ':entry'