diff --git a/UI/JsFACard/README.md b/UI/JsFACard/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b9a6d82989cf6ac7a873b5237d7745ba99ef7ef2 --- /dev/null +++ b/UI/JsFACard/README.md @@ -0,0 +1,14 @@ +# JS Service Widget Development + +### Introduction + +This sample demonstrates service widgets. Service widgets are used to present important information about apps, allowing users to access desired services instantly via shortcut gestures. + +### Usage + +Swipe up the icon of the sample app, select a service widget size, and touch **ADD TO HOME SCREEN** to add the service widget to the home screen. Alternatively, touch and hold the sample app icon until **Service Widgets** is displayed, touch **Service Widgets**, select a service widget size, and touch **ADD TO HOME SCREEN** to add the service widget to the home screen. You can touch a service widget on the home screen to go to the home page of the sample app. + +### Constraints + +This sample can only be run on large-system devices. A maximum of 16 service widgets can be configured for a single app. + diff --git a/UI/JsFACard/READNE_zh.md b/UI/JsFACard/READNE_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..d7d41afc11654362203bfdb8460918b0bdd479e8 --- /dev/null +++ b/UI/JsFACard/READNE_zh.md @@ -0,0 +1,14 @@ +# JS 卡片开发 + +### 简介 + +本示例展示了服务卡片功能,通过服务卡片将用户应用程序的重要信息展示在桌面,用户可通过快捷手势使用卡片,以达到服务直达、减少层级跳转的目的。 + +### 使用说明 + +上滑本示例应用图标,选择需要的卡片尺寸添加到屏幕,也可以长按示例应用,等待出现服务卡片字样,点击后选择卡片尺寸,添加到桌面。可以点击在桌面上的卡片进入示例应用的主页面。 + +### 约束与限制 + +本示例仅支持在大型系统上运行,对于同一个应用,最多支持配置16张卡片。 + diff --git a/UI/JsFACard/build.gradle b/UI/JsFACard/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..91af1ca64995ab365fbf9f4d6b6c9a5f816d163f --- /dev/null +++ b/UI/JsFACard/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 5 + defaultConfig { + compatibleSdkVersion 4 + } +} + +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.2' + } +} + +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/JsFACard/entry/build.gradle b/UI/JsFACard/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..83f59debbd68242b503a22270f4378d7843ca204 --- /dev/null +++ b/UI/JsFACard/entry/build.gradle @@ -0,0 +1,19 @@ +apply plugin: 'com.huawei.ohos.hap' +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 4 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/config.json b/UI/JsFACard/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d4649ebc8cb4e20a97f14f2d64c4b356079c2873 --- /dev/null +++ b/UI/JsFACard/entry/src/main/config.json @@ -0,0 +1,140 @@ +{ + "app": { + "bundleName": "ohos.samples.jsfacard", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.jsfacard", + "name": ".MyApplication", + "mainAbility": "ohos.samples.jsfacard.MainAbility", + "deviceType": [ + "default" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "ohos.samples.jsfacard.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "formsEnabled": true, + "label": "$string:entry_MainAbility", + "type": "page", + "forms": [ + { + "jsComponentName": "jsmusictemplate", + "isDefault": true, + "formConfigAbility": "ability://ohos.samples.jsfacard.MainAbility", + "scheduledUpdateTime": "10:30", + "defaultDimension": "2*4", + "name": "jsmusictemplate", + "description": "This is a service widget", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "2*4" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "jsComponentName": "card", + "isDefault": false, + "formConfigAbility": "ability://ohos.samples.jsfacard.MainAbility", + "scheduledUpdateTime": "10:30", + "defaultDimension": "2*4", + "name": "card", + "description": "This is a service widget", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "2*4" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "jsComponentName": "jscardtemplate", + "isDefault": false, + "formConfigAbility": "ability://ohos.samples.jsfacard.MainAbility", + "scheduledUpdateTime": "10:30", + "defaultDimension": "4*4", + "name": "jscardtemplate", + "description": "This is a service widget", + "colorMode": "auto", + "type": "JS", + "supportDimensions": [ + "4*4" + ], + "updateEnabled": true, + "updateDuration": 1 + } + ], + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "card", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + }, + { + "pages": [ + "pages/index/index" + ], + "name": "jscardtemplate", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + }, + { + "pages": [ + "pages/index/index" + ], + "name": "jsmusictemplate", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "type": "form" + } + ] + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/java/ohos/samples/jsfacard/MainAbility.java b/UI/JsFACard/entry/src/main/java/ohos/samples/jsfacard/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..a8e10f50492567523db1dc80a1b6c31a4061ad22 --- /dev/null +++ b/UI/JsFACard/entry/src/main/java/ohos/samples/jsfacard/MainAbility.java @@ -0,0 +1,85 @@ +/* + * 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. + */ + +package ohos.samples.jsfacard; + +import ohos.aafwk.ability.FormBindingData; +import ohos.aafwk.ability.FormException; +import ohos.aafwk.ability.ProviderFormInfo; +import ohos.aafwk.content.Intent; +import ohos.ace.ability.AceAbility; +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; +import ohos.utils.zson.ZSONObject; + +/** + * Main ability + * + * @since 2021-07-05 + */ +public class MainAbility extends AceAbility { + private static final HiLogLabel TAG = new HiLogLabel(HiLog.DEBUG, 0x0, MainAbility.class.getName()); + + private static final String STATUS = "status"; + + private static final String PLAY = "play"; + + private static final String PAUSE = "pause"; + + private static boolean isStatus = true; + + @Override + public void onStart(Intent intent) { + HiLog.info(TAG, "onStart"); + super.onStart(intent); + } + + @Override + protected ProviderFormInfo onCreateForm(Intent intent) { + HiLog.info(TAG, "onCreateForm"); + return super.onCreateForm(intent); + } + + @Override + protected void onUpdateForm(long formId) { + HiLog.info(TAG, "onUpdateForm"); + super.onUpdateForm(formId); + } + + @Override + protected void onDeleteForm(long formId) { + HiLog.info(TAG, "onDeleteForm: formId=" + formId); + super.onDeleteForm(formId); + } + + @Override + protected void onTriggerFormEvent(long formId, String message) { + super.onTriggerFormEvent(formId, message); + ZSONObject zsonObject = new ZSONObject(); + if (isStatus) { + zsonObject.put(STATUS, PAUSE); + isStatus = false; + } else { + zsonObject.put(STATUS, PLAY); + isStatus = true; + } + FormBindingData formBindingData = new FormBindingData(zsonObject); + try { + updateForm(formId, formBindingData); + } catch (FormException e) { + HiLog.info(TAG, "onTriggerFormEvent:" + e.getMessage()); + } + } +} diff --git a/UI/JsFACard/entry/src/main/java/ohos/samples/jsfacard/MyApplication.java b/UI/JsFACard/entry/src/main/java/ohos/samples/jsfacard/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..1fe528672f947fce0311e030dda7099e7f8c3ff2 --- /dev/null +++ b/UI/JsFACard/entry/src/main/java/ohos/samples/jsfacard/MyApplication.java @@ -0,0 +1,30 @@ +/* + * 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. + */ + +package ohos.samples.jsfacard; + +import ohos.aafwk.ability.AbilityPackage; + +/** + * MyApplication + * + * @since 2021-07-05 + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/UI/JsFACard/entry/src/main/js/card/common/ic_default_blue.svg b/UI/JsFACard/entry/src/main/js/card/common/ic_default_blue.svg new file mode 100644 index 0000000000000000000000000000000000000000..79fb28c566dd90caa2725bd6841d5bac6c1f262e --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/card/common/ic_default_blue.svg @@ -0,0 +1,25 @@ + + + + Public/ic_public_list_add_light + Created with Sketch. + + + + + \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/card/common/ic_default_image.png b/UI/JsFACard/entry/src/main/js/card/common/ic_default_image.png new file mode 100644 index 0000000000000000000000000000000000000000..b1cd3a18c1c2b2406580a4e0a9eebdaf1d0c951c Binary files /dev/null and b/UI/JsFACard/entry/src/main/js/card/common/ic_default_image.png differ diff --git a/UI/JsFACard/entry/src/main/js/card/i18n/en-US.json b/UI/JsFACard/entry/src/main/js/card/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..95afaba20b6a7458e2da68f1b41b9bcbeabdc6f5 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/card/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "music": "Music", + "singer": "Singer" + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/card/i18n/zh-CN.json b/UI/JsFACard/entry/src/main/js/card/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..f91dfd0066a88ad7d557e797e88d1f82d806b662 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/card/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "music": "音乐", + "singer": "歌手" + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/card/pages/index/index.css b/UI/JsFACard/entry/src/main/js/card/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5afbbcbd9c738803f33d2609f2bde78d293e4b1f --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/card/pages/index/index.css @@ -0,0 +1,79 @@ +/* + * 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; + width: 100%; + height: 100%; +} + +.main-div { + flex-direction: row; + width: 100%; + height: 100%; + align-items: center; + padding: 8% 15px; + min-height: 126px; + max-height: 150px; + display-index: 2; +} + +.main-image { + width: 126px; + aspect-ratio: 1; + border-radius: 14px; + flex-shrink: 0; + display-index: 2; +} + +.right-div { + flex-direction: column; + margin: 13% 0px 0px; + display-index: 1; + width: 154px; + flex-grow: 1; + justify-content: space-evenly; +} + +.bottom-div { + flex-direction: column; + display-index: 1; + height: 100px; + padding-start: 12px; + padding-end: 12px; +} + +.image-div { + justify-content: space-between; +} + +.check-image { + width: 30px; + aspect-ratio: 1; +} + +.music-text { + font-size: 16px; + font-weight: 500; + margin-bottom: 2px; +} + +.singer-text { + font-size: 12px; + opacity: 0.6; + font-weight: normal; + margin-bottom: 24px; +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/card/pages/index/index.hml b/UI/JsFACard/entry/src/main/js/card/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..748b13d2201fb4647e94ec3daf9dcd168424ce0d --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/card/pages/index/index.hml @@ -0,0 +1,42 @@ + + +
+
+ +
+ {{ $t('strings.music') }} + {{ $t('strings.singer') }} +
+ + + + + +
+
+
+
+ {{ $t('strings.music') }} + {{ $t('strings.singer') }} +
+ + + + + +
+
+
\ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/card/pages/index/index.json b/UI/JsFACard/entry/src/main/js/card/pages/index/index.json new file mode 100644 index 0000000000000000000000000000000000000000..cf44ac53309b8d5b3e43847b13d51013a7c54c9a --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/card/pages/index/index.json @@ -0,0 +1,13 @@ +{ + "data": {}, + "actions": { + "activeEvent": { + "action": "router", + "bundleName": "ohos.samples.jsfacard", + "abilityName": "ohos.samples.jsfacard.MainAbility", + "params": { + "message": "add detail" + } + } + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/default/app.js b/UI/JsFACard/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8e47afff13e928a74fdcc01a108e4422404b9ac9 --- /dev/null +++ b/UI/JsFACard/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/JsFACard/entry/src/main/js/default/common/images/Wallpaper.png b/UI/JsFACard/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/UI/JsFACard/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/UI/JsFACard/entry/src/main/js/default/i18n/en-US.json b/UI/JsFACard/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/default/i18n/zh-CN.json b/UI/JsFACard/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/default/pages/index/index.css b/UI/JsFACard/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..d40090fe59f3d152a0ca5128bf51369166f65c23 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,59 @@ +/* + * 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; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("../../common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} diff --git a/UI/JsFACard/entry/src/main/js/default/pages/index/index.hml b/UI/JsFACard/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..1902b8746737ba8bd2fb89d049bc56e01878ce23 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/UI/JsFACard/entry/src/main/js/default/pages/index/index.js b/UI/JsFACard/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..63f1dda0335591afcfdb78c38bae73e4dae4c861 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/default/pages/index/index.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 { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/UI/JsFACard/entry/src/main/js/jscardtemplate/common/ic_default_image.png b/UI/JsFACard/entry/src/main/js/jscardtemplate/common/ic_default_image.png new file mode 100644 index 0000000000000000000000000000000000000000..d26a30caccb7c77a7b37f21b0d819cf7b969bf9c Binary files /dev/null and b/UI/JsFACard/entry/src/main/js/jscardtemplate/common/ic_default_image.png differ diff --git a/UI/JsFACard/entry/src/main/js/jscardtemplate/i18n/en-US.json b/UI/JsFACard/entry/src/main/js/jscardtemplate/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..06a27810eba3ed5c5c5b168afcf1645f27e14d15 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jscardtemplate/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World", + "title": "Title", + "text": "Text" + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jscardtemplate/i18n/zh-CN.json b/UI/JsFACard/entry/src/main/js/jscardtemplate/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..9e396b2954f8d05c54897834f30d5155d3cfcd19 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jscardtemplate/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "title": "标题", + "text": "文本" + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.css b/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..e9c6b9ff37089c645af63d7b939323848e03d15f --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.css @@ -0,0 +1,73 @@ +/* + * 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; + width: 100%; + height: 100%; +} + +.header-div { + width: 100%; + height: 50%; + flex-shrink: 0; + background-color: dodgerblue; + border-top-left-radius: 14px; + border-top-right-radius: 14px; + flex-direction: column; + justify-content: flex-end; + padding: 12px; +} + +.header-title { + font-size: 16px; + font-weight: 500; + margin-bottom: 2px; + color: white; +} + +.header-description { + font-size: 14px; + color: white; +} + +.foot-div { + justify-content: space-evenly; + align-items: center; + width: 100%; + height: 50%; + flex-direction: row; + flex-shrink: 0; +} + +.item-div { + flex-direction: column; + height: 100%; + width: 84px; + justify-content: center; + align-items: center; +} + +.item-image { + width: 84px; + height: 126px; + border-radius: 14px; +} + +.item-title { + font-size: 14px; + font-weight: 500; + margin-top: 2px; +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.hml b/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..da1eab6a4f7e4a6cc5e009fce17f506c8dc85b1a --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.hml @@ -0,0 +1,43 @@ + + +
+
+ {{ $t('strings.title') }} + {{ $t('strings.text') }} +
+
+
+ + {{ $t('strings.title') }} +
+
+ + {{ $t('strings.title') }} +
+
+ + {{ $t('strings.title') }} +
+
+ + {{ $t('strings.title') }} +
+
+ + {{ $t('strings.title') }} +
+
+
\ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.json b/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.json new file mode 100644 index 0000000000000000000000000000000000000000..cf44ac53309b8d5b3e43847b13d51013a7c54c9a --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jscardtemplate/pages/index/index.json @@ -0,0 +1,13 @@ +{ + "data": {}, + "actions": { + "activeEvent": { + "action": "router", + "bundleName": "ohos.samples.jsfacard", + "abilityName": "ohos.samples.jsfacard.MainAbility", + "params": { + "message": "add detail" + } + } + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_default_image.png b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_default_image.png new file mode 100644 index 0000000000000000000000000000000000000000..3af559f74358e9f54aebbb6f765bf9f5f493760e Binary files /dev/null and b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_default_image.png differ diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_favor.svg b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_favor.svg new file mode 100644 index 0000000000000000000000000000000000000000..4316e98b18cabfb99b6aad5368f32362fa467b12 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_favor.svg @@ -0,0 +1,31 @@ + + + Public/ic_public_favor_filled + + + + + + + + + + \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_ranking.svg b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_ranking.svg new file mode 100644 index 0000000000000000000000000000000000000000..faa46fc72cf8086e0f34ea99b8fbc00eedcd310b --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_ranking.svg @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_recommend.svg b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_recommend.svg new file mode 100644 index 0000000000000000000000000000000000000000..205a88c0405902a92d5e36060eef257e37287cf4 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_recommend.svg @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_search.svg b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_search.svg new file mode 100644 index 0000000000000000000000000000000000000000..81beb56fd3b36415f3afaabe32e5bad38d97fd9c --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/ic_search.svg @@ -0,0 +1,31 @@ + + + Public/ic_public_search_filled + + + + + + + + + + \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/pause.svg b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/pause.svg new file mode 100644 index 0000000000000000000000000000000000000000..ff1be4c8181ee5cf630e102017a18cae92712dfb --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/pause.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/play.svg b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/play.svg new file mode 100644 index 0000000000000000000000000000000000000000..2decbc95faeaf8b29b2fdc643b14814232c3eccd --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/common/play.svg @@ -0,0 +1,31 @@ + + + Public/ic_public_play_norm + + + + + + + + + + \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/i18n/en-US.json b/UI/JsFACard/entry/src/main/js/jsmusictemplate/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..fe5f405e2084dcbda33caaa669b899a2319d1e7c --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "search": "search", + "favor": "favor", + "recommend": "search", + "ranking": "favor" + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/i18n/zh-CN.json b/UI/JsFACard/entry/src/main/js/jsmusictemplate/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..58ba2a5b8fe8166c7911f51a5a842f4ff692a99f --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "search": "搜索", + "favor": "喜欢", + "recommend": "推荐", + "ranking": "排行" + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.css b/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b8bd80ecb76510c01bce4896e81bc84ef3f71b22 --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.css @@ -0,0 +1,116 @@ +/* + * 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. + */ + +.background { + width: 100%; + height: 100%; + background-image: url("/common/ic_default_image.png"); +} + +.container { + width: 100%; + height: 100%; + background-color: #4D000000; + align-items: center; + backdrop-filter: blur(2px); + padding: 12px 0px 0px 12px; +} + +.cover-image { + flex-shrink: 0; + flex-weight: 3; + min-width: 126px; + margin-right: 12px; + height: 100%; + margin-bottom: 12px; + display: flex; + justify-content: center; + align-items: center; + align-content: center; +} + +.default_image { + border-radius: 14px; +} + +.status-image { + width: 32px; + height: 32px; +} + +.absolute-text { + font-size: 16px; + color: white; + position: absolute; + left: 12px; + bottom: 18px; +} + +.absolute-button { + color: white; + position: absolute; + left: 12px; + bottom: 18px; +} + +.main-div { + flex-direction: column; + flex-weight: 2; + min-width: 75px; + margin-right: 12px; + justify-content: space-between; +} + +.wrap-div { + flex-weight: 1; + margin-bottom: 12px; + background-color: #19FFFFFF; + border-radius: 14px; + width: 100%; + min-height: 46px; + flex-wrap: wrap; + flex-direction: column; + justify-content: center; + align-content: center; + align-items: center; +} + +.image-div { + width: 24px; + aspect-ratio: 1; + flex-shrink: 0; + justify-content: center; + align-content: center; + align-items: center; +} + +.image-text { + font-size: 12px; + color: white; + text-align: center; + margin: 0px 12px; +} + +.large-display-index { + display-index: 3; +} + +.medium-display-index { + display-index: 2; +} + +.small-display-index { + display-index: 1; +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.hml b/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..ffb67320bc886addf90a5b61ec1abb6f5b0eac5e --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.hml @@ -0,0 +1,60 @@ + + +
+
+ + + + +
+
+ + {{ $t('strings.search') }} +
+
+ + {{ $t('strings.favor') }} +
+
+ + {{ $t('strings.ranking') }} +
+
+ + {{ $t('strings.recommend') }} +
+
+ +
+
+ + {{ $t('strings.ranking') }} +
+
+ + {{ $t('strings.recommend') }} +
+
+ + {{ $t('strings.favor') }} +
+
+ + {{ $t('strings.search') }} +
+
+
+
\ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.json b/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.json new file mode 100644 index 0000000000000000000000000000000000000000..f07bbdec9fa4f1315ee359cafdbe8e54d4a9a48b --- /dev/null +++ b/UI/JsFACard/entry/src/main/js/jsmusictemplate/pages/index/index.json @@ -0,0 +1,13 @@ +{ + "data": { + "status": "play" + }, + "actions": { + "messageEvent": { + "action": "message", + "params": { + "message": "music change status" + } + } + } +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/resources/base/element/string.json b/UI/JsFACard/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..cc629eb54781858d04e70e3a3f6b1ce836ea21bf --- /dev/null +++ b/UI/JsFACard/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "JsFACard" + }, + { + "name": "mainability_description", + "value": "JS card example" + } + ] +} \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/resources/base/layout/immersion_widget.xml b/UI/JsFACard/entry/src/main/resources/base/layout/immersion_widget.xml new file mode 100644 index 0000000000000000000000000000000000000000..949296d69eccefed016d5bcb8941553e55e310b9 --- /dev/null +++ b/UI/JsFACard/entry/src/main/resources/base/layout/immersion_widget.xml @@ -0,0 +1,29 @@ + + + + + + \ No newline at end of file diff --git a/UI/JsFACard/entry/src/main/resources/base/media/icon.png b/UI/JsFACard/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/UI/JsFACard/entry/src/main/resources/base/media/icon.png differ diff --git a/UI/JsFACard/entry/src/main/resources/en/element/string.json b/UI/JsFACard/entry/src/main/resources/en/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7c414e340c665376d623e255c141f00c5bb95137 --- /dev/null +++ b/UI/JsFACard/entry/src/main/resources/en/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "JsFACard" + }, + { + "name": "mainability_description", + "value": "JS card example" + } + ] +} diff --git a/UI/JsFACard/entry/src/main/resources/zh/element/string.json b/UI/JsFACard/entry/src/main/resources/zh/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1ac418b8183186082fff4465f96c80acb26337bb --- /dev/null +++ b/UI/JsFACard/entry/src/main/resources/zh/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "Js卡片" + }, + { + "name": "mainability_description", + "value": "JS卡片示例" + } + ] +} \ No newline at end of file diff --git a/UI/JsFACard/screenshots/device/Card.png b/UI/JsFACard/screenshots/device/Card.png new file mode 100644 index 0000000000000000000000000000000000000000..cb083b0528a2ef53f0a34f8ebca66e458d782d89 Binary files /dev/null and b/UI/JsFACard/screenshots/device/Card.png differ diff --git a/UI/JsFACard/screenshots/device/JsCardTemplate.png b/UI/JsFACard/screenshots/device/JsCardTemplate.png new file mode 100644 index 0000000000000000000000000000000000000000..cb083b0528a2ef53f0a34f8ebca66e458d782d89 Binary files /dev/null and b/UI/JsFACard/screenshots/device/JsCardTemplate.png differ diff --git a/UI/JsFACard/screenshots/device/JsMusicTemplate.png b/UI/JsFACard/screenshots/device/JsMusicTemplate.png new file mode 100644 index 0000000000000000000000000000000000000000..9cdd1d176c58168c66b4c7ff0247f1e47f69c620 Binary files /dev/null and b/UI/JsFACard/screenshots/device/JsMusicTemplate.png differ diff --git a/UI/JsFACard/settings.gradle b/UI/JsFACard/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07 --- /dev/null +++ b/UI/JsFACard/settings.gradle @@ -0,0 +1 @@ +include ':entry'