diff --git a/UI/Tabs/Tabs_README.md b/UI/Tabs/Tabs_README.md new file mode 100644 index 0000000000000000000000000000000000000000..047eaba87050bc723eedda67514d66fe1d26715d --- /dev/null +++ b/UI/Tabs/Tabs_README.md @@ -0,0 +1,14 @@ +# Tabs + +### Introduction + +This sample shows how to use the **** component. You can use **** to set tags and **tab-content** to set the content to be displayed on each tab page. If the number of tags is the same as the number of tab pages, the tags are bound to the tab pages in sequence. + +### Usage + +On the home screen of the sample app, touch the tabs at the bottom or swipe left or right on the tab bar to switch between the tab pages. + +### Constraints + +This sample can only be run on standard-system devices. + diff --git a/UI/Tabs/Tabs_README_zh.md b/UI/Tabs/Tabs_README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..c0ca6ed0180975eccb6f1f50b943e094a1fd5c16 --- /dev/null +++ b/UI/Tabs/Tabs_README_zh.md @@ -0,0 +1,14 @@ +# Tabs容器 + +### 简介 + +本示例展示了tabs页签容器的使用,可通过子标签tab-bar来设置标签,子标签tab-content来设置内容。标签数目与内容页面数目相同就会依照顺序绑定。 + +### 使用说明 + +进入应用主界面后可通过点击应用底部的页签进行页面切换,也可左右滑动切换页面。 + +### 约束与限制 + +该示例仅在标准系统上运行。 + diff --git a/UI/Tabs/build.gradle b/UI/Tabs/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..ad33f7c014a76f9b635c1e497c19e278f2aef9da --- /dev/null +++ b/UI/Tabs/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() + } +} \ No newline at end of file diff --git a/UI/Tabs/entry/build.gradle b/UI/Tabs/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..6b6a606b1b3e2af76d27a6fa8ad069e92ddbed68 --- /dev/null +++ b/UI/Tabs/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/Tabs/entry/src/main/config.json b/UI/Tabs/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0f1751fe325b707eb34bd9d2a192b42adae07bcf --- /dev/null +++ b/UI/Tabs/entry/src/main/config.json @@ -0,0 +1,56 @@ +{ + "app": { + "bundleName": "ohos.samples.tabs", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.tabs", + "name": ".MainAbility", + "mainAbility": "ohos.samples.tabs.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": ".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/Tabs/entry/src/main/js/default/app.js b/UI/Tabs/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8e47afff13e928a74fdcc01a108e4422404b9ac9 --- /dev/null +++ b/UI/Tabs/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/Tabs/entry/src/main/js/default/common/images/Image1.jpg b/UI/Tabs/entry/src/main/js/default/common/images/Image1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3af559f74358e9f54aebbb6f765bf9f5f493760e Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/Image1.jpg differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/Image2.jpg b/UI/Tabs/entry/src/main/js/default/common/images/Image2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d26a30caccb7c77a7b37f21b0d819cf7b969bf9c Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/Image2.jpg differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/Image3.jpg b/UI/Tabs/entry/src/main/js/default/common/images/Image3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d13ed7e5c8391eef6dd9614743e0eee1b0463986 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/Image3.jpg differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_discover_10.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_discover_10.png new file mode 100644 index 0000000000000000000000000000000000000000..be82243e941264bcc0763f9381644b5a4fdbd767 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_discover_10.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_gallery_discover.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_gallery_discover.png new file mode 100644 index 0000000000000000000000000000000000000000..980159d4a41ebbeb5ff2336cd6d9f38cc512d953 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_gallery_discover.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_game.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_game.png new file mode 100644 index 0000000000000000000000000000000000000000..0b6966a63c2d1aeaa839de82377f9a3822f48670 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_game.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_hot.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_hot.png new file mode 100644 index 0000000000000000000000000000000000000000..30378aa5d1dfa729e417319d4b601edff890aa22 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_hot.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_public_community_messages.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_public_community_messages.png new file mode 100644 index 0000000000000000000000000000000000000000..a86864968b38fc45c3f25b7116b4e354a6a751d4 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_public_community_messages.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_public_community_messages_filled.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_public_community_messages_filled.png new file mode 100644 index 0000000000000000000000000000000000000000..fc2b28030b7206e966ade496b94b04f6f71457b4 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_public_community_messages_filled.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_public_contacts.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_public_contacts.png new file mode 100644 index 0000000000000000000000000000000000000000..6ed3742bb156acb775df11a9a5f889c1bdc44000 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_public_contacts.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_public_contacts_filled.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_public_contacts_filled.png new file mode 100644 index 0000000000000000000000000000000000000000..5908b247785bb4841b21452a11d2dab2f1137c37 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_public_contacts_filled.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_scan.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_scan.png new file mode 100644 index 0000000000000000000000000000000000000000..946b57fa40af5978da1e1203f2ebfb16637329c3 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_scan.png differ diff --git a/UI/Tabs/entry/src/main/js/default/common/images/ic_shortcut_discover.png b/UI/Tabs/entry/src/main/js/default/common/images/ic_shortcut_discover.png new file mode 100644 index 0000000000000000000000000000000000000000..a30c880eed0c234c2edef846bc342a8eb6a8bbf7 Binary files /dev/null and b/UI/Tabs/entry/src/main/js/default/common/images/ic_shortcut_discover.png differ diff --git a/UI/Tabs/entry/src/main/js/default/i18n/en-US.json b/UI/Tabs/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..81c693c629dc18066f0760cd69944b6c783e8e72 --- /dev/null +++ b/UI/Tabs/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,14 @@ +{ + "strings": { + "chat": "Chat", + "contacts": "Contacts", + "dynamic": "Dynamic", + "message": "Message content", + "signature": "Individuality signature", + "search": "Search", + "found": "Found", + "event": "Hot Event", + "scan": "Scan", + "game": "Game" + } +} \ No newline at end of file diff --git a/UI/Tabs/entry/src/main/js/default/i18n/zh-CN.json b/UI/Tabs/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..1a7500736b0b7469a69731af14a9ac4d3e768c81 --- /dev/null +++ b/UI/Tabs/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,14 @@ +{ + "strings": { + "chat": "聊天", + "contacts": "联系人", + "dynamic": "动态", + "message": "消息内容", + "signature": "个性签名", + "search": "搜索...", + "found": "发现", + "event": "热点", + "scan": "扫一扫", + "game": "游戏" + } +} \ No newline at end of file diff --git a/UI/Tabs/entry/src/main/js/default/pages/index/index.css b/UI/Tabs/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..ad06691cc1e60c0259bc073e66a8f0b630fa6be4 --- /dev/null +++ b/UI/Tabs/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,141 @@ +/* + * 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: flex-end; + align-items: center; +} + +.tabs { + width: 100%; + background-color: #F2F3F5; +} + +.tab-content{ + width: 100%; + height: 90%; +} + +.item-content { + height: 100%; + flex-direction: column; +} + +.chat-item { + height: 72px; + width: 100%; + display: flex; + align-items:center; + margin-right: 12px; + margin-left: 12px; + margin-bottom: 2px; + background-color: white; +} + +.search { + height: 72px; + width: 100%; + align-items:center; + margin-right: 12px; + margin-left: 12px; + margin-bottom: 2px; +} + +.img { + height: 40px; + width: 40px; + margin-left: 12px; + margin-right: 12px; + border-radius: 20px; +} + +.chat-content { + display: flex; + flex-direction: column; + flex-shrink: 3; + justify-content: space-between; + align-content: flex-start; +} + +.chat-title { + font-size: 16px; + color: #e6000000; + opacity: 0.9; + margin-top: 8px; + margin-bottom: 1px; +} + +.chat-text { + font-size: 14px; + color: #99000000; + opacity: 0.6; + margin-top: 1px; + margin-bottom: 8px; +} + +.dynamic-item { + height: 56px; + margin-right: 12px; + margin-left: 12px; + margin-bottom: 8px; + align-items: center; + background-color: white; +} + +.dynamic-icons { + height: 24px; + width: 24px; + margin-left: 12px; + margin-right: 12px; +} + +.dynamic-text { + margin-top: 18px; + margin-bottom: 18px; + font-size: 16px; +} + +.tab-bar { + width: 100%; + height: 56px; + flex-direction: row; + background-color: white; +} + +.menu { + display: flex; + width: 100%; + text-align: center; + flex-direction: column; +} + +.tab-text { + font-size: 14px; + margin-bottom: 8px; + text-align: center; +} + +.icon { + height: 24px; + width: 24px; +} + +.icons { + width: 100%; + margin-top: 8px; + margin-bottom: 2px; + justify-content: center; +} diff --git a/UI/Tabs/entry/src/main/js/default/pages/index/index.hml b/UI/Tabs/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..7dd6a41b310b68ab2eacab8ae6a3316a1b5bdb77 --- /dev/null +++ b/UI/Tabs/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,109 @@ + + +
+ + +
+
+ +
+ {{$t('strings.contacts')}} + {{ $t('strings.message') }} +
+
+
+ +
+ {{$t('strings.contacts')}} + {{ $t('strings.message') }} +
+
+
+ +
+ {{$t('strings.contacts')}} + {{ $t('strings.message') }} +
+
+
+
+ +
+ +
+ {{$t('strings.contacts')}} + {{ $t('strings.signature') }} +
+
+
+ +
+ {{$t('strings.contacts')}} + {{ $t('strings.signature') }} +
+
+
+ +
+ {{$t('strings.contacts')}} + {{ $t('strings.signature') }} +
+
+
+
+
+ + {{$t('strings.found')}} +
+
+ + {{$t('strings.event')}} +
+
+ + {{$t('strings.scan')}} + +
+
+ + {{$t('strings.game')}} +
+
+
+ + + + + +
+
diff --git a/UI/Tabs/entry/src/main/js/default/pages/index/index.js b/UI/Tabs/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d1c0510b06db051e03a93177a54b81a6e5ba09f7 --- /dev/null +++ b/UI/Tabs/entry/src/main/js/default/pages/index/index.js @@ -0,0 +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. + */ + +export default { + data: { + chat: ["/common/images/ic_public_community_messages_filled.png"], + contacts: ["/common/images/ic_public_contacts.png"], + dynamic: ["/common/images/ic_gallery_discover.png"] + }, + change: function(e) { + if (e.index == 0) { + this.chat = "/common/images/ic_public_community_messages_filled.png" + this.contacts = "/common/images/ic_public_contacts.png" + this.dynamic = "/common/images/ic_gallery_discover.png" + } + if (e.index == 1) { + this.chat = "/common/images/ic_public_community_messages.png" + this.contacts = "/common/images/ic_public_contacts_filled.png" + this.dynamic = "/common/images/ic_gallery_discover.png" + } + if (e.index == 2) { + this.chat = "/common/images/ic_public_community_messages.png" + this.contacts = "/common/images/ic_public_contacts.png" + this.dynamic = "/common/images/ic_discover_10.png" + } + } +} \ No newline at end of file diff --git a/UI/Tabs/entry/src/main/resources/base/element/string.json b/UI/Tabs/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/UI/Tabs/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/UI/Tabs/entry/src/main/resources/base/media/icon.png b/UI/Tabs/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/UI/Tabs/entry/src/main/resources/base/media/icon.png differ diff --git a/UI/Tabs/entry/src/main/resources/en/element/string.json b/UI/Tabs/entry/src/main/resources/en/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4fa62a207c93ef42c121f247344ecbf6d59021df --- /dev/null +++ b/UI/Tabs/entry/src/main/resources/en/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Tabs Container" + }, + { + "name": "mainability_description", + "value": "Java_Empty Ability" + } + ] +} diff --git a/UI/Tabs/entry/src/main/resources/zh/element/string.json b/UI/Tabs/entry/src/main/resources/zh/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1d2bd82cc56063c2e60fdb780a8f0a503d040fb4 --- /dev/null +++ b/UI/Tabs/entry/src/main/resources/zh/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "页签容器" + }, + { + "name": "mainability_description", + "value": "Java_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/UI/Tabs/screenshot/devices/chat.png b/UI/Tabs/screenshot/devices/chat.png new file mode 100644 index 0000000000000000000000000000000000000000..6d83804b0a9fd79100ed364151c4ee0fbc945d44 Binary files /dev/null and b/UI/Tabs/screenshot/devices/chat.png differ diff --git a/UI/Tabs/screenshot/devices/contacts.png b/UI/Tabs/screenshot/devices/contacts.png new file mode 100644 index 0000000000000000000000000000000000000000..ce3a511de219d30f6cc4ef04e9e06f9d6a828cec Binary files /dev/null and b/UI/Tabs/screenshot/devices/contacts.png differ diff --git a/UI/Tabs/screenshot/devices/dynamic.png b/UI/Tabs/screenshot/devices/dynamic.png new file mode 100644 index 0000000000000000000000000000000000000000..4950445183577f7b5f1f595309cfc0e282fc72f8 Binary files /dev/null and b/UI/Tabs/screenshot/devices/dynamic.png differ diff --git a/UI/Tabs/settings.gradle b/UI/Tabs/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/UI/Tabs/settings.gradle @@ -0,0 +1 @@ +include ':entry'