diff --git a/UI/Slider/README_zh.md b/UI/Slider/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..68910b87137f91e56e7c65004066e4b577545214 --- /dev/null +++ b/UI/Slider/README_zh.md @@ -0,0 +1,13 @@ +# 滑动条 + +### 简介 + +组件常用来作为声音、亮度、字体等的设置。本示例展示了使用组件来调整界面字体大小。 + +### 使用方法 + + 此应用中滑动条共分五级,分别对应字体的五个大小。通过滑动滑动条,可以调整界面字体大小。 + +### 约束与限制 + +本示例仅支持标准系统运行 \ No newline at end of file diff --git a/UI/Slider/build.gradle b/UI/Slider/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..d45348af3401adb65bea584cb8e04da996b29edd --- /dev/null +++ b/UI/Slider/build.gradle @@ -0,0 +1,36 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 6 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.4.3-RC' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } +} diff --git a/UI/Slider/entry/build.gradle b/UI/Slider/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..6b6a606b1b3e2af76d27a6fa8ad069e92ddbed68 --- /dev/null +++ b/UI/Slider/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/Slider/entry/src/main/config.json b/UI/Slider/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ebecf76f85e9c09b43d39910b22f1e21f8d8f6d0 --- /dev/null +++ b/UI/Slider/entry/src/main/config.json @@ -0,0 +1,56 @@ +{ + "app": { + "bundleName": "ohos.samples.slider", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.slider", + "name": ".MyApplication", + "mainAbility": "ohos.samples.slider.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "ohos.samples.slider.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/UI/Slider/entry/src/main/js/default/app.js b/UI/Slider/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8e47afff13e928a74fdcc01a108e4422404b9ac9 --- /dev/null +++ b/UI/Slider/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/UI/Slider/entry/src/main/js/default/i18n/en-US.json b/UI/Slider/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..02f40b60eb1297920478eff0453bd160682d3e3c --- /dev/null +++ b/UI/Slider/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "title": "How do I adjust the font size?", + "texts": "Adjust the lower control bar to change the size of the preview font, so try it." + } +} \ No newline at end of file diff --git a/UI/Slider/entry/src/main/js/default/i18n/zh-CN.json b/UI/Slider/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..7192b4bd3f610d4a59fec3d7c413c0826b6895da --- /dev/null +++ b/UI/Slider/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "title": "怎么调节字体大小呢?", + "texts": "调节下方控制条可以改变预览字体的大小,快来试试吧。" + } +} \ No newline at end of file diff --git a/UI/Slider/entry/src/main/js/default/pages/index/index.css b/UI/Slider/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..3e0c52bedc24ef43c8db6f9f14a562f30c0925f5 --- /dev/null +++ b/UI/Slider/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,67 @@ +/* + * 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; + margin-top: 20%; +} + +.title { + color: #FFFFFF; + padding: 10px; + max-width: 300px; + background-color: blue; + border-radius: 10px; +} + +.text-c { + color: #000000; + padding: 10px; + max-width: 300px; + border-radius: 10px; + background-color: lightgray; +} + +.text-title { + margin-right: 20px; + flex-direction: column; + align-items: flex-end; + +} + +.div-text { + margin-top: 20px; + margin-left: 20px; + flex-direction: column; + align-items: flex-start; +} + +.slider { + width: 80%; + border-radius: 20px; + background-color: lightgray; + +} + +.slider-div { + padding: 10px; + margin-top: 100px; + flex-direction: row; + justify-content: space-around; +} + +.text-l { + font-size: 16px; +} \ No newline at end of file diff --git a/UI/Slider/entry/src/main/js/default/pages/index/index.hml b/UI/Slider/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..db8862dfe7da3ddbc3393bd3c1627686e2777699 --- /dev/null +++ b/UI/Slider/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,28 @@ + + +
+
+ {{ $t('strings.title') }} +
+
+ {{ $t('strings.texts') }} +
+
+ A + + A +
+
diff --git a/UI/Slider/entry/src/main/js/default/pages/index/index.js b/UI/Slider/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fed31c4b8ce994a185ee7d16fe3df1ae4388f463 --- /dev/null +++ b/UI/Slider/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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: { + fontSize: "16px" + }, + font(e) { + switch (e.value) { + case 0: + this.fontSize = "16px" + break + case 20: + this.fontSize = "20px" + break + case 40: + this.fontSize = "24px" + break + case 60: + this.fontSize = "28px" + break + case 80: + this.fontSize = "32px" + break + case 100: + this.fontSize = "36px" + break + default: + break + } + } +} diff --git a/UI/Slider/entry/src/main/resources/base/element/string.json b/UI/Slider/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..01f64fd793519aa3f71a24c351a6200a9a2ceab2 --- /dev/null +++ b/UI/Slider/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Slider" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/UI/Slider/entry/src/main/resources/base/media/icon.png b/UI/Slider/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/UI/Slider/entry/src/main/resources/base/media/icon.png differ diff --git a/UI/Slider/entry/src/main/resources/en/element/string.json b/UI/Slider/entry/src/main/resources/en/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..01f64fd793519aa3f71a24c351a6200a9a2ceab2 --- /dev/null +++ b/UI/Slider/entry/src/main/resources/en/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Slider" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/UI/Slider/entry/src/main/resources/zh/element/string.json b/UI/Slider/entry/src/main/resources/zh/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..544819f1cdb83dd1d3d87715e02c416d81a916ea --- /dev/null +++ b/UI/Slider/entry/src/main/resources/zh/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "滑动条" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/UI/Slider/screenshots/device/screen.png b/UI/Slider/screenshots/device/screen.png new file mode 100644 index 0000000000000000000000000000000000000000..912df7cf793ae150e6e1d4533962850e1fb72be6 Binary files /dev/null and b/UI/Slider/screenshots/device/screen.png differ diff --git a/UI/Slider/screenshots/device/screen1.png b/UI/Slider/screenshots/device/screen1.png new file mode 100644 index 0000000000000000000000000000000000000000..40695e21d8f3df9fa6be6eea056bba8316dff873 Binary files /dev/null and b/UI/Slider/screenshots/device/screen1.png differ diff --git a/UI/Slider/screenshots/device/screen2.png b/UI/Slider/screenshots/device/screen2.png new file mode 100644 index 0000000000000000000000000000000000000000..cf4a025e2cd1b1ce85d6d17745be383ce767ee71 Binary files /dev/null and b/UI/Slider/screenshots/device/screen2.png differ diff --git a/UI/Slider/settings.gradle b/UI/Slider/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/UI/Slider/settings.gradle @@ -0,0 +1 @@ +include ':entry'