diff --git a/DistributedHealthDemoPhone/LICENSE b/DistributedHealthDemoPhone/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..78a533de3abe1e7e83f53f720edf5e8f4b2d87b4 --- /dev/null +++ b/DistributedHealthDemoPhone/LICENSE @@ -0,0 +1,78 @@ + 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. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/DistributedHealthDemoPhone/README.md b/DistributedHealthDemoPhone/README.md new file mode 100644 index 0000000000000000000000000000000000000000..06acfb1df83e2a5023f9a7029d07e00689963629 --- /dev/null +++ b/DistributedHealthDemoPhone/README.md @@ -0,0 +1,52 @@ +#DistributedHealthDemoPhone +简介 +• 此Demo展示如何在手机上调用相应接口,获取手表断的心率和步数等健康数据,配合分布式健康手表端应用,可以实现数据跨设备浏览以及接收心率异常的通知 + +安装要求 +• 安装DevEco Studio +• 设置DevEco Studio开发环境。DevEco Studio开发环境需要连接到网络,以确保该正常使用。可以根据以下两种情况配置开发环境: + 1.如果您可以直接访问Internet,则只需下载HarmonyOS SDK + 2.如果网络无法直接访问Internet,则可以通过代理服务器进行访问 +• 生成密钥并申请证书 + +用户指南 +• 下载此项目 +• 打开HUAWEI DevEco Studio,单击File> Open选择此项目 +• 单击Build> Build App(s)/Hap(s)>Build Debug Hap(s)以编译hap软件包 +• 单击Run> Run 'entry'以运行hap包 + +注意 +• 您可以选择在模拟器或真机上运行hap软件包。 +• 如果在真机上运行它,则需要在项目的File> Project Structure> Modules> Signing Configs中配置签名和证书信息。 + +许可 +请参阅LICENSE文件以获得更多信息。 +What is it? +HarmonyOS supports application deployment based on Ability. +Ability can be classified into Feature Ability (FA) and Particle Ability (PA). +In this document, the Codelab will use Page Ability and Service Ability for development. +Page Ability is the only template supported by the FA to provide the capability of interacting with users. +Service Ability is a type of article Ability (PA) to provide the capability of running tasks in the background. +In addition, you will use the common Java UI layout DirectionalLayout in HarmonyOS, the capabilities of starting the PA service across devices, and synchronizing data across devices to implement a distributed HarmonyOS sports and health application. +This demo enables real-time transmission of heart rate and step count data from watch A to mobile phone A and real-time exception notification. In addition, health data from mobile phone A can be shared with mobile phone B. + +Installation requirements +• Install DevEco Studio and Node.js +• Set up the DevEco Studio development environment. + The DevEco Studio development environment needs to depend on the network environment. It needs to be connected to the network to ensure the normal use of the tool. The development environment can be configured according to the following two situations +1. If you can directly access the Internet, just download the HarmonyOS SDK +2. If the network cannot access the Internet directly, it can be accessed through a proxy server +• Generate secret key and apply for certificate + +User guide +• Download this project +• Open DevEco Studio, click File> Open> Then select and open this Project +• Click Build> Build App(s)/Hap(s)>Build Debug Hap(s) to compile the hap package +• Click Run> Run 'entry' to run the hap package + +Note +• You can choose to run the hap package on the simulator or the phone. +• If you run it on the phone, you need to configure the signature and certificate information in the project's File> Project Structure> Modules> Signing Configs. + +Licensing +Please see LICENSE for more info. \ No newline at end of file diff --git a/DistributedHealthDemoPhone/build.gradle b/DistributedHealthDemoPhone/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..859953eaf84cc3cff308056e618b42de0ed752e6 --- /dev/null +++ b/DistributedHealthDemoPhone/build.gradle @@ -0,0 +1,37 @@ +// 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' + classpath 'com.huawei.ohos:decctest:1.0.0.7' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + jcenter() + } +} diff --git a/DistributedHealthDemoPhone/entry/build.gradle b/DistributedHealthDemoPhone/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..51d73211af5f4b352183c6ad6c05e89a6e05725a --- /dev/null +++ b/DistributedHealthDemoPhone/entry/build.gradle @@ -0,0 +1,13 @@ +apply plugin: 'com.huawei.ohos.hap' +ohos { + compileSdkVersion 5 + defaultConfig { + compatibleSdkVersion 5 + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testCompile 'junit:junit:4.12' +} diff --git a/DistributedHealthDemoPhone/entry/src/main/config.json b/DistributedHealthDemoPhone/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..6b901751ec38d2d0c716800301ab4ae9d7a57bfa --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/config.json @@ -0,0 +1,76 @@ +{ + "app": { + "bundleName": "com.huawei.cookbook", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.huawei.cookbooks", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "portrait", + "name": "com.huawei.cookbooks.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + }, + { + "name": "com.huawei.cookbooks.ServiceAbility", + "icon": "$media:icon", + "description": "$string:serviceability_description", + "type": "service" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC", + "reason": "demo use distribution", + "usedScene": { + "ability": [ + ".MainAbility" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.VIBRATE" + }, + { + "name": "ohos.permission.DISTRIBUTED_DEVICE_STATE_CHANGE" + }, + { + "name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" + } + ] + } +} \ No newline at end of file diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/Entity/WatchEntity.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/Entity/WatchEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..becc3d464ebc4bd49d9e6c4588173ed3a0bd6e2d --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/Entity/WatchEntity.java @@ -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. + */ + +package com.huawei.cookbooks.Entity; + +public class WatchEntity { + + private String time; + + private String data; + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/MainAbility.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/MainAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..db6c0c516f520354f18eb1bfc9f4dae7d911f429 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/MainAbility.java @@ -0,0 +1,45 @@ +/* + * 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 com.huawei.cookbooks; + +import com.huawei.cookbooks.slice.HealthSlice; + +import ohos.aafwk.ability.Ability; +import ohos.aafwk.content.Intent; +import ohos.bundle.IBundleManager; + +public class MainAbility extends Ability { + private static final String DISTRIBUTED_DATASYNC = "ohos.permission.DISTRIBUTED_DATASYNC"; + + private static final int PERMISSION_CODE = 20201203; + + @Override + public void onStart(Intent intent) { + super.onStart(intent); + super.setMainRoute(HealthSlice.class.getName()); + requestPermission(); + } + + private void requestPermission() { + if (verifySelfPermission(DISTRIBUTED_DATASYNC) != IBundleManager.PERMISSION_GRANTED) { + // has no permission + if (canRequestPermission(DISTRIBUTED_DATASYNC)) { + // toast + requestPermissionsFromUser(new String[] {DISTRIBUTED_DATASYNC}, PERMISSION_CODE); + } + } + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/MyApplication.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/MyApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..8bf97b480bb5b3784c4fd500a511509b786941f8 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/MyApplication.java @@ -0,0 +1,25 @@ +/* + * 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 com.huawei.cookbooks; + +import ohos.aafwk.ability.AbilityPackage; + +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/ServiceAbility.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/ServiceAbility.java new file mode 100644 index 0000000000000000000000000000000000000000..5c0febfa20adc16deb91433479da8f901c75cfb9 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/ServiceAbility.java @@ -0,0 +1,63 @@ +/* + * 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 com.huawei.cookbooks; + +import com.huawei.cookbooks.task.NotifyTask; +import com.huawei.cookbooks.util.LogUtils; + +import ohos.aafwk.ability.Ability; +import ohos.aafwk.content.Intent; +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; +import ohos.rpc.IRemoteObject; + +public class ServiceAbility extends Ability { + private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "Demo"); + + @Override + public void onStart(Intent intent) { + LogUtils.info("", "service start success"); + super.onStart(intent); + } + + @Override + public void onBackground() { + super.onBackground(); + HiLog.info(LABEL_LOG, "ServiceAbility::onBackground"); + } + + @Override + public void onStop() { + super.onStop(); + HiLog.info(LABEL_LOG, "ServiceAbility::onStop"); + } + + @Override + public void onCommand(Intent intent, boolean restart, int startId) { + LogUtils.info("", "come to onCommand"); + getUITaskDispatcher().asyncDispatch(new NotifyTask(this.getContext())); + } + + @Override + public IRemoteObject onConnect(Intent intent) { + LogUtils.info("", "come to onConnect"); + return null; + } + + @Override + public void onDisconnect(Intent intent) { + } +} \ No newline at end of file diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/annotation/Bind.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/annotation/Bind.java new file mode 100644 index 0000000000000000000000000000000000000000..36b99bf900a32f8c9f08da1ce8493c5bccfae22d --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/annotation/Bind.java @@ -0,0 +1,35 @@ +/* + * 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 com.huawei.cookbooks.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Bind component + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Bind { + /** + * value + * + * @return int + */ + int value() default 0; +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/enums/KeyEnum.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/enums/KeyEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..f8dd998172c55b8646615a13ca2ad5f523025428 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/enums/KeyEnum.java @@ -0,0 +1,47 @@ +/* + * 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 com.huawei.cookbooks.enums; + +public enum KeyEnum { + LATEST_STEP("latestStep", "最新步数"), + LATEST_RATE("latestRate", "最新心率"), + RATE("rate", "心率数据"),; + + private String value; + + private String desc; + + KeyEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/factory/MyKvManagerFactory.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/factory/MyKvManagerFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..7922b9b8c9239ac72b467c4a1c8fdfb22f861f21 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/factory/MyKvManagerFactory.java @@ -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. + */ + +package com.huawei.cookbooks.factory; + +import com.huawei.cookbooks.util.LogUtils; + +import ohos.data.distributed.common.KvManager; +import ohos.data.distributed.common.KvManagerConfig; +import ohos.data.distributed.common.KvManagerFactory; +import ohos.data.distributed.common.KvStoreException; + +public class MyKvManagerFactory { + private static KvManager instance = null; + + private MyKvManagerFactory() { } + + public static KvManager getInstance(KvManagerConfig config) { + if (instance == null) { + synchronized (MyKvManagerFactory.class) { + if (instance == null) { + try { + instance = KvManagerFactory.getInstance().createKvManager(config); + } catch (KvStoreException e) { + LogUtils.info("KvStoreException", e.getMessage()); + } + } + } + } + return instance; + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/slice/HealthSlice.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/slice/HealthSlice.java new file mode 100644 index 0000000000000000000000000000000000000000..3ba1cfbbb9d2db054f3d2a7875681a64883e5e3e --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/slice/HealthSlice.java @@ -0,0 +1,551 @@ +/* + * 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 com.huawei.cookbooks.slice; + +import com.huawei.cookbooks.Entity.WatchEntity; +import com.huawei.cookbooks.ResourceTable; +import com.huawei.cookbooks.annotation.Bind; +import com.huawei.cookbooks.enums.KeyEnum; +import com.huawei.cookbooks.factory.MyKvManagerFactory; +import com.huawei.cookbooks.task.PushDataTask; +import com.huawei.cookbooks.util.CommonUtils; +import com.huawei.cookbooks.util.LogUtils; +import com.huawei.cookbooks.view.HomeLayoutManager; + +import ohos.aafwk.ability.AbilitySlice; +import ohos.aafwk.content.Intent; +import ohos.agp.colors.RgbColor; +import ohos.agp.components.AbsButton; +import ohos.agp.components.Button; +import ohos.agp.components.ComponentContainer; +import ohos.agp.components.ComponentState; +import ohos.agp.components.RoundProgressBar; +import ohos.agp.components.Switch; +import ohos.agp.components.Text; +import ohos.agp.components.element.ShapeElement; +import ohos.agp.components.element.StateElement; +import ohos.agp.utils.LayoutAlignment; +import ohos.agp.window.dialog.ToastDialog; +import ohos.data.distributed.common.Entry; +import ohos.data.distributed.common.KvManager; +import ohos.data.distributed.common.KvManagerConfig; +import ohos.data.distributed.common.KvStoreException; +import ohos.data.distributed.common.KvStoreType; +import ohos.data.distributed.common.Options; +import ohos.data.distributed.common.SyncCallback; +import ohos.data.distributed.common.SyncMode; +import ohos.data.distributed.device.DeviceFilterStrategy; +import ohos.data.distributed.device.DeviceInfo; +import ohos.data.distributed.user.SingleKvStore; +import ohos.eventhandler.EventHandler; +import ohos.eventhandler.EventRunner; +import ohos.eventhandler.InnerEvent; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +/** + * health slice + * + * @since 2021-06-18 + */ +public class HealthSlice extends AbilitySlice { + private static final int EVENT_MESSAGE_NORMAL = 1; + + private static final String STORE_ID = "watch_demo_mine"; + + private static final String STORE_ID2 = "copyToPhone_mine"; + + private static final String TAG = "HealthSlice"; + + private static final int SHOW_TIME = 1500; + + private static final int DIALOG_SIZE_WIDTH = 1000; + + private static final int DIALOG_SIZE_HEIGHT = 100; + + private static final int MAX_HEART_RATE = 120; + + private static final int MIN_HEART_RATE = 60; + + private static final int ERROR_CODE = -1; + + private static final long INTERVAL = 5000L; + + private static final int CORNER_RADIUS = 50; + + private static final int ON_COLOR_SLIDER = 0xFF1E90FF; + + private static final int OFF_COLOR_SLIDER = 0xFFFFFFFF; + + private static final int ON_COLOR = 0xFF87CEFA; + + private static final int OFF_COLOR = 0xFF808080; + + private static final String DOT = "."; + + private HomeLayoutManager manager; + + private ComponentContainer rootLayout; + + private KvManager kvManager; + + private SingleKvStore singleKvStore; + + private SingleKvStore singleKvStore2; + + /** + * Health Data Slice + */ + @Bind(ResourceTable.Id_stepData) + private RoundProgressBar stepData; + + @Bind(ResourceTable.Id_stepTimeText) + private Text stepTime; + + @Bind(ResourceTable.Id_rateData) + private Text rateData; + + @Bind(ResourceTable.Id_rateTimeText) + private Text rateTime; + + @Bind(ResourceTable.Id_rateRange) + private Text rateRange; + + @Bind(ResourceTable.Id_stepDistances) + private Text stepDistances; // 距离 + + @Bind(ResourceTable.Id_stepHeat) + private Text stepHeat; // 热量 + + @Bind(ResourceTable.Id_stepFloor) + private Text stepFloor; // 爬楼层 + + @Bind(ResourceTable.Id_stepData1) + private RoundProgressBar stepData1; + + /** + * Others Data Slice Component + */ + @Bind(ResourceTable.Id_otherStepData) + private RoundProgressBar otherStepData; + + @Bind(ResourceTable.Id_otherStepTimeText) + private Text otherStepTime; + + @Bind(ResourceTable.Id_otherRateData) + private Text otherRateData; + + @Bind(ResourceTable.Id_otherRateTimeText) + private Text otherRateTime; + + @Bind(ResourceTable.Id_otherRateRangeData) + private Text otherRateRangeData; + + @Bind(ResourceTable.Id_otherStepDistances) + private Text otherStepDistances; // 距离 + + @Bind(ResourceTable.Id_otherStepHeat) + private Text otherStepHeat; // 热量 + + @Bind(ResourceTable.Id_otherStepFloor) + private Text otherStepFloor; // 爬楼层 + + @Bind(ResourceTable.Id_otherStepData1) + private RoundProgressBar otherStepData1; + + /** + * Synchronize Data Button + */ + @Bind(ResourceTable.Id_button_syncData) + private Button syncData; + + @Bind(ResourceTable.Id_button_syncPhoneData) + private Button syncPhoneData; + + @Bind(ResourceTable.Id_btn_switch) + private Switch sw; + + private List deviceIdList = new ArrayList<>(0); + + private List rateList = new ArrayList<>(0); + + private List stepList = new ArrayList<>(0); + + private String regex = "-->"; + + private MyEventHandler myHandler; + + private Timer timer; + + @Override + public void onStart(Intent intent) { + super.onStart(intent); + manager = new HomeLayoutManager(this); + rootLayout = manager.initSliceLayout(); + super.setUIContent(rootLayout); + initViewAnnotation(); + initListener(); + initSwitch(); + initDb(); + } + + private void initMyHandler() { + myHandler = new MyEventHandler(EventRunner.current()); + long param = 0L; + Object object = null; + InnerEvent normalInnerEvent = InnerEvent.get(EVENT_MESSAGE_NORMAL, param, object); + myHandler.sendEvent(normalInnerEvent, 0, EventHandler.Priority.IMMEDIATE); + } + + private void initViewAnnotation() { + Field[] fields = getClass().getDeclaredFields(); + for (Field field : fields) { + Bind bind = field.getAnnotation(Bind.class); + if (bind != null) { + if (bind.value() == ERROR_CODE) { + LogUtils.error(TAG, "bind.value is must set!"); + return; + } + try { + field.setAccessible(true); + field.set(this, findComponentById(bind.value())); + } catch (IllegalAccessException e) { + LogUtils.error(TAG, "IllegalAccessException :" + e.getMessage()); + } + } + } + } + + private void initListener() { + syncData.setClickedListener( + va -> { + syncData(singleKvStore); + }); + syncPhoneData.setClickedListener( + va -> { + syncData(singleKvStore2); + }); + sw.setCheckedStateChangedListener(new AbsButton.CheckedStateChangedListener() { + // 回调处理Switch状态改变事件 + @Override + public void onCheckedChanged(AbsButton button, boolean isChecked) { + if (isChecked) { + timer = new Timer(); + initMyHandler(); + } else { + timer.cancel(); + } + } + }); + } + + private void initDb() { + KvManagerConfig config = new KvManagerConfig(this); + kvManager = MyKvManagerFactory.getInstance(config); + Options options = new Options(); + options.setCreateIfMissing(true).setEncrypt(false).setKvStoreType(KvStoreType.SINGLE_VERSION); + try { + singleKvStore = kvManager.getKvStore(options, STORE_ID); + singleKvStore2 = kvManager.getKvStore(options, STORE_ID2); + } catch (KvStoreException e) { + LogUtils.info(TAG, "KvStore Exception Occur"); + } + } + + private void syncData(SingleKvStore kvStore) { + List deviceInfoList = kvManager.getConnectedDevicesInfo(DeviceFilterStrategy.NO_FILTER); + if (deviceInfoList.size() == 0) { + String message = "未发现手表/手机设备"; + showTip(message); + renderingData(kvStore); + return; + } + deviceIdList.clear(); + for (DeviceInfo deviceInfo : deviceInfoList) { + deviceIdList.add(deviceInfo.getId()); + } + inferredSyncDevice(kvStore); + } + + private void inferredSyncDevice(SingleKvStore kvStore) { + if (kvStore.equals(singleKvStore)) { + String message = "同步手表数据成功"; + doSync(message, kvStore); + renderingData(kvStore); + } else if (kvStore.equals(singleKvStore2)) { + String message = "同步手机数据成功"; + doSync(message, kvStore); + renderingData(kvStore); + } else { + LogUtils.info("syncData()==>", "DATA BASE NOT EXIST"); + } + } + + private void doSync(String message, SingleKvStore kvStore) { + kvStore.registerSyncCallback( + new SyncCallback() { + @Override + public void syncCompleted(Map map) { + getUITaskDispatcher() + .asyncDispatch( + new Runnable() { + @Override + public void run() { + showTip(message); + } + }); + kvStore.unRegisterSyncCallback(); + } + }); + try { + LogUtils.info(TAG, "Start to get data"); + kvStore.sync(deviceIdList, SyncMode.PULL_ONLY); + } catch (KvStoreException e) { + LogUtils.info(TAG, "doSync KvStoreException"); + } + } + + private void renderingData(SingleKvStore kvStore) { + if (kvStore != null) { + List entries = kvStore.getEntries(""); + if (entries.size() == 0 || entries.isEmpty() || entries.equals(null)) { + String message = "未找到数据"; + showTip(message); + return; + } + dealEntries(entries, kvStore); + } + } + + private void dealEntries(List entries, SingleKvStore kvStore) { + for (Entry entry : entries) { + finishPageInitialization(entry.getKey(), kvStore, createWatchDataEntity(entry)); + } + populateRateRangePage(entries, kvStore); + } + + private void finishPageInitialization(String key, SingleKvStore kvStore, WatchEntity watchEntity) { + if (KeyEnum.LATEST_STEP.getValue().equals(key)) { + populateStepPage(kvStore, watchEntity); + } else if (KeyEnum.LATEST_RATE.getValue().equals(key)) { + if (kvStore.equals(singleKvStore)) { + populateRatePage(rateData, rateTime, watchEntity); + } else { + populateRatePage(otherRateData, otherRateTime, watchEntity); + } + } else if (key.contains(KeyEnum.RATE.getValue())) { + rateList.add(Integer.valueOf(watchEntity.getData())); + } else { + stepList.add(Integer.valueOf(watchEntity.getData())); + } + } + + private void populateRateRangePage(List entries, SingleKvStore kvStore) { + if (rateList.size() == 0) { + return; + } + doPopulateRateRangePage(entries, kvStore); + } + + private void doPopulateRateRangePage(List entries, SingleKvStore kvStore) { + Integer min = Collections.min(rateList); + Integer max = Collections.max(rateList); + if (kvStore.equals(singleKvStore)) { + rateRange.setText(min + "~" + max); + List entries2s = singleKvStore2.getEntries(""); + getUITaskDispatcher().asyncDispatch(new PushDataTask(entries, entries2s, singleKvStore2)); + } else { + otherRateRangeData.setText(min + "~" + max); + if (min < MIN_HEART_RATE || max > MAX_HEART_RATE) { + String message = "他人心率异常"; + showTip(message); + } + } + } + + private WatchEntity createWatchDataEntity(Entry entry) { + String value = entry.getValue().getString(); + String[] splits = value.split(regex); + WatchEntity watchEntity = new WatchEntity(); + watchEntity.setTime(splits[0]); + watchEntity.setData(splits[1].substring(0, splits[1].indexOf(DOT))); + return watchEntity; + } + + private void populateStepPage(SingleKvStore kvStore, WatchEntity watchDataEntity) { + if (kvStore.equals(singleKvStore)) { // 我的数据 + stepData.setProgressHintText("步数 " + watchDataEntity.getData() + " 步"); + stepData.setProgressValue(CommonUtils.getProgressWithSteps(Integer.parseInt(watchDataEntity.getData()))); + stepTime.setText(watchDataEntity.getTime()); + // 距离 + stepDistances.setText("距离" + CommonUtils.getDistanceWithSteps( + Integer.parseInt(watchDataEntity.getData())) + "公里 |"); + // 热量 + stepHeat.setText("热量" + CommonUtils.getCalorieWithSteps( + Integer.parseInt(watchDataEntity.getData())) + "千卡 |"); + // 爬楼层 + stepFloor.setText("爬楼" + CommonUtils.getFloorWithSteps( + Integer.parseInt(watchDataEntity.getData())) + "层"); + // 强度 + Map intensityMap = CommonUtils.getIntensityWithSteps( + Integer.parseInt(watchDataEntity.getData())); + stepData1.setProgressHintText(intensityMap.get("text")); + stepData1.setProgressValue(Integer.parseInt(intensityMap.get("progress"))); + } else { // 他人数据 + otherStepData.setProgressHintText("步数 " + watchDataEntity.getData() + " 步"); + otherStepData.setProgressValue(CommonUtils.getProgressWithSteps( + Integer.parseInt(watchDataEntity.getData()))); + otherStepTime.setText(watchDataEntity.getTime()); + // 距离 + otherStepDistances.setText("距离" + CommonUtils.getDistanceWithSteps( + Integer.parseInt(watchDataEntity.getData())) + "公里 |"); + // 热量 + otherStepHeat.setText("热量" + CommonUtils.getCalorieWithSteps( + Integer.parseInt(watchDataEntity.getData())) + "千卡 |"); + // 爬楼层 + otherStepFloor.setText("爬楼" + CommonUtils.getFloorWithSteps( + Integer.parseInt(watchDataEntity.getData())) + "层"); + // 强度 + Map intensityMap = CommonUtils.getIntensityWithSteps( + Integer.parseInt(watchDataEntity.getData())); + otherStepData1.setProgressHintText(intensityMap.get("text")); + otherStepData1.setProgressValue(Integer.parseInt(intensityMap.get("progress"))); + } + } + + private void populateRatePage(Text rateDataText, Text rateTimeText, WatchEntity watchDataEntity) { + rateDataText.setText(watchDataEntity.getData()); + rateTimeText.setText(watchDataEntity.getTime()); + } + + private void showTip(String message) { + myHandler.postTask(new Runnable() { + @Override + public void run() { + new ToastDialog(getContext()) + .setAlignment(LayoutAlignment.TOP) + .setText(message) + .setDuration(SHOW_TIME) + .setSize(DIALOG_SIZE_WIDTH, DIALOG_SIZE_HEIGHT) + .show(); + } + }); + } + + /** + * myenven handler + * + * @since 2021-06-18 + */ + class MyEventHandler extends EventHandler { + MyEventHandler(EventRunner runner) throws IllegalArgumentException { + super(runner); + } + + @Override + protected void processEvent(InnerEvent event) { + super.processEvent(event); + if (event == null) { + return; + } + int eventId = event.eventId; + switch (eventId) { + case EVENT_MESSAGE_NORMAL: + timer.schedule(new TimerTask() { + public void run() { + getUITaskDispatcher().syncDispatch(new Runnable() { + @Override + public void run() { + syncData(singleKvStore); + } + }); + } + }, 0, INTERVAL); + break; + default: + break; + } + } + } + + private StateElement trackElementInit(ShapeElement on, ShapeElement off) { + StateElement trackElement = new StateElement(); + trackElement.addState(new int[]{ComponentState.COMPONENT_STATE_CHECKED}, on); + trackElement.addState(new int[]{ComponentState.COMPONENT_STATE_EMPTY}, off); + return trackElement; + } + + private StateElement thumbElementInit(ShapeElement on, ShapeElement off) { + StateElement thumbElement = new StateElement(); + thumbElement.addState(new int[]{ComponentState.COMPONENT_STATE_CHECKED}, on); + thumbElement.addState(new int[]{ComponentState.COMPONENT_STATE_EMPTY}, off); + return thumbElement; + } + + private void initSwitch() { + // 开启状态下滑块的样式 + ShapeElement elementThumbOn = new ShapeElement(); + elementThumbOn.setShape(ShapeElement.OVAL); + elementThumbOn.setRgbColor(RgbColor.fromArgbInt(ON_COLOR_SLIDER)); + elementThumbOn.setCornerRadius(CORNER_RADIUS); + + // 关闭状态下滑块的样式 + ShapeElement elementThumbOff = new ShapeElement(); + elementThumbOff.setShape(ShapeElement.OVAL); + elementThumbOff.setRgbColor(RgbColor.fromArgbInt(OFF_COLOR_SLIDER)); + elementThumbOff.setCornerRadius(CORNER_RADIUS); + + // 开启状态下轨迹样式 + ShapeElement elementTrackOn = new ShapeElement(); + elementTrackOn.setShape(ShapeElement.RECTANGLE); + elementTrackOn.setRgbColor(RgbColor.fromArgbInt(ON_COLOR)); + elementTrackOn.setCornerRadius(CORNER_RADIUS); + + // 关闭状态下轨迹样式 + ShapeElement elementTrackOff = new ShapeElement(); + elementTrackOff.setShape(ShapeElement.RECTANGLE); + elementTrackOff.setRgbColor(RgbColor.fromArgbInt(OFF_COLOR)); + elementTrackOff.setCornerRadius(CORNER_RADIUS); + + sw.setTrackElement(trackElementInit(elementTrackOn, elementTrackOff)); + sw.setThumbElement(thumbElementInit(elementThumbOn, elementThumbOff)); + } + + @Override + public void onActive() { + super.onActive(); + } + + @Override + public void onForeground(Intent intent) { + super.onForeground(intent); + } + + @Override + protected void onStop() { + super.onStop(); + kvManager.closeKvStore(singleKvStore); + kvManager.deleteKvStore(STORE_ID); + kvManager.closeKvStore(singleKvStore2); + kvManager.deleteKvStore(STORE_ID2); + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/task/NotifyTask.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/task/NotifyTask.java new file mode 100644 index 0000000000000000000000000000000000000000..db4fb7d1752c5b6ed973897ea2bb94d7fa4b5ecb --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/task/NotifyTask.java @@ -0,0 +1,110 @@ +/* + * 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 com.huawei.cookbooks.task; + +import com.huawei.cookbooks.util.LogUtils; + +import ohos.aafwk.content.Intent; +import ohos.aafwk.content.Operation; +import ohos.app.Context; +import ohos.event.intentagent.IntentAgent; +import ohos.event.intentagent.IntentAgentConstant; +import ohos.event.intentagent.IntentAgentHelper; +import ohos.event.intentagent.IntentAgentInfo; +import ohos.event.notification.NotificationHelper; +import ohos.event.notification.NotificationRequest; +import ohos.event.notification.NotificationSlot; +import ohos.rpc.RemoteException; +import ohos.vibrator.agent.VibratorAgent; + +import java.util.ArrayList; +import java.util.List; + +/** + * Notification Task + */ +public class NotifyTask implements Runnable { + private static final String TAG = "NotifyTask"; + + private static final int TIME_DURATION = 1000; + + private static final int REQUEST_CODE = 200; + + private Context context; + + /** + * Control gadget - vibrator + */ + private VibratorAgent vibratorAgent = new VibratorAgent(); + + private List vibratorList = null; + + /** + * Notify abnormal data which use notification bar. + */ + private NotificationSlot slot = new NotificationSlot("slot_001", "slot_default", NotificationSlot.LEVEL_MIN); + + private int notificationId = 1; + + private NotificationRequest request = new NotificationRequest(notificationId); + + private NotificationRequest.NotificationNormalContent content = new NotificationRequest.NotificationNormalContent(); + + private String title = "通知"; + + private String text = "心率异常"; + + public NotifyTask(Context context) { + this.context = context; + } + + @Override + public void run() { + vibratorList = vibratorAgent.getVibratorIdList(); + vibratorAgent.startOnce(vibratorList.get(0), TIME_DURATION); + try { + NotificationHelper.addNotificationSlot(slot); + request.setSlotId(slot.getId()); + content.setTitle(title).setText(text); + NotificationRequest.NotificationContent notificationContent = + new NotificationRequest.NotificationContent(content); + request.setContent(notificationContent); + request.setIntentAgent(initStartFa()); + NotificationHelper.publishNotification(request); + } catch (RemoteException ex) { + LogUtils.info(TAG, "Exception occurred during addNotificationSlot .invocation"); + } + } + + private IntentAgent initStartFa() { + Intent intent = new Intent(); + Operation operation = new Intent.OperationBuilder() + .withDeviceId("") + .withBundleName("com.huawei.cookbook") + .withAbilityName("com.huawei.cookbooks.MainAbility") + .build(); + intent.setOperation(operation); + List intentList = new ArrayList<>(); + intentList.add(intent); + int requestCode = REQUEST_CODE; + List flags = new ArrayList<>(); + flags.add(IntentAgentConstant.Flags.UPDATE_PRESENT_FLAG); + IntentAgentInfo paramsInfo = new IntentAgentInfo(requestCode, + IntentAgentConstant.OperationType.START_ABILITY, flags, intentList, null); + IntentAgent agent = IntentAgentHelper.getIntentAgent(context, paramsInfo); + return agent; + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/task/PushDataTask.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/task/PushDataTask.java new file mode 100644 index 0000000000000000000000000000000000000000..3832bac20ee6c30f0bd77d6165e7930fee106094 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/task/PushDataTask.java @@ -0,0 +1,47 @@ +/* + * 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 com.huawei.cookbooks.task; + +import ohos.data.distributed.common.Entry; +import ohos.data.distributed.user.SingleKvStore; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class PushDataTask implements Runnable { + private List entries = new ArrayList<>(); + + private List entries2 = new ArrayList<>(); + + private SingleKvStore singleKvStore; + + public PushDataTask(List entries, List entries2, SingleKvStore singleKvStore) { + this.entries = entries; + this.entries2 = entries2; + this.singleKvStore = singleKvStore; + } + + @Override + public void run() { + for (Iterator item = entries.iterator(); item.hasNext(); ) { + Entry entry = (Entry) item.next(); + if (!entries2.contains(entry)) { + singleKvStore.putString(entry.getKey(), entry.getValue().getString()); + } + } + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/util/CommonUtils.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/util/CommonUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..4d116ba67d8b91badba5df8dc2fa9710f65d2112 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/util/CommonUtils.java @@ -0,0 +1,134 @@ +/* + * 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 com.huawei.cookbooks.util; + +import ohos.app.Context; +import ohos.global.resource.NotExistException; +import ohos.global.resource.WrongTypeException; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * Common utils + * + * @since 2021-06-18 + */ +public class CommonUtils { + private static final String TAG = "Common Utils"; + private static final int GET_COLOR_STATE_FAILED = -1; + private static final float DISTANCE_UNIT = 0.6f / 1000; // 计算距离 + private static final float CALORIE_UNIT = 0.6f * 60 * 1.036f / 1000; // 计算热量 + private static final float FLOOR_UNIT = 0.6f / 28; // 计算楼层 + private static final float PROGRESS_UNIT = 0.1f; // 进度条百分比 1k步为100% + private static final int INTENSITY_ONE = 400; // 低强度 + private static final int INTENSITY_TWO = 600; // 中等强度 + private static final int INTENSITY_THR = 800; // 中高强度 + private static final String PROGRESS_ONE = "25"; // 低强度 + private static final String PROGRESS_TWO = "50"; // 中等强度 + private static final String PROGRESS_THR = "75"; // 中高强度 + private static final String PROGRESS_FOU = "100"; // 高强度 + private static final String TEXT = "text"; + private static final String PROGRESS = "progress"; + + private CommonUtils() { + } + + /** + * Get color method + * + * @param context context resourceID res id + * @param resourceId res id + * @return color + */ + public static int getColor(Context context, int resourceId) { + try { + return context.getResourceManager().getElement(resourceId).getColor(); + } catch (IOException | NotExistException | WrongTypeException e) { + LogUtils.info(TAG, "some exception happen"); + } + return GET_COLOR_STATE_FAILED; + } + + /** + * 根据步数计算公里数 + * + * @param steps steps + * @return string + */ + public static String getDistanceWithSteps(int steps) { + return String.format("%.2f", steps * DISTANCE_UNIT); + } + + /** + * 根据步数计算热量-千卡 + * + * @param steps steps + * @return string + */ + public static String getCalorieWithSteps(int steps) { + return String.format("%.2f", steps * CALORIE_UNIT); + } + + /** + * 根据步数计算楼层 + * + * @param steps steps + * @return float + */ + public static int getFloorWithSteps(int steps) { + return (int) (steps * FLOOR_UNIT); + } + + /** + * 根据步数计算progress 1k步为100% + * + * @param steps steps + * @return float + */ + public static int getProgressWithSteps(int steps) { + return (int) (steps * PROGRESS_UNIT); + } + + /** + * 根据步数获取强度 + * 0-400 低强度,401-600 中等强度,601-800 中高强度,大于800 高强度 + * + * @param steps steps + * @return map + */ + public static Map getIntensityWithSteps(int steps) { + Map intensityMap = new HashMap<>(0); + if (steps <= INTENSITY_ONE) { + intensityMap.put(TEXT, "低强度"); + intensityMap.put(PROGRESS, PROGRESS_ONE); + } + if (steps > INTENSITY_ONE && steps <= INTENSITY_TWO) { + intensityMap.put(TEXT, "中等强度"); + intensityMap.put(PROGRESS, PROGRESS_TWO); + } + if (steps > INTENSITY_TWO && steps <= INTENSITY_THR) { + intensityMap.put(TEXT, "中高强度"); + intensityMap.put(PROGRESS, PROGRESS_THR); + } + if (steps > INTENSITY_THR) { + intensityMap.put(TEXT, "高强度"); + intensityMap.put(PROGRESS, PROGRESS_FOU); + } + return intensityMap; + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/util/LogUtils.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/util/LogUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..10669d8dbeb43e07005a4bd8bc50dc62038a3ec5 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/util/LogUtils.java @@ -0,0 +1,52 @@ +/* + * 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 com.huawei.cookbooks.util; + +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; + +/** + * LogUtils common log print + */ +public class LogUtils { + private static final String TAG_LOG = "LogUtil"; + + private static final HiLogLabel LABEL_LOG = new HiLogLabel(0, 0, LogUtils.TAG_LOG); + + private static final String LOG_FORMAT = "%{public}s: %{public}s"; + + private LogUtils() { } + + /** + * Print info log + * + * @param tag log tag + * @param msg log message + */ + public static void info(String tag, String msg) { + HiLog.info(LABEL_LOG, LOG_FORMAT, tag, msg); + } + + /** + * Print error log + * + * @param tag log tag + * @param msg log message + */ + public static void error(String tag, String msg) { + HiLog.error(LABEL_LOG, LOG_FORMAT, tag, msg); + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/AbstractTabView.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/AbstractTabView.java new file mode 100644 index 0000000000000000000000000000000000000000..6f24bc7af086d610f040deb15c166c6018872cf2 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/AbstractTabView.java @@ -0,0 +1,112 @@ +/* + * 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 com.huawei.cookbooks.view; + +import ohos.aafwk.ability.AbilitySlice; +import ohos.agp.components.ComponentContainer; +import ohos.agp.components.ComponentContainer.LayoutConfig; +import ohos.agp.components.DirectionalLayout; + +/** + * Tab view abstract class + * + * @since 2020-06-03 + */ +public abstract class AbstractTabView { + private int id; + + private String name; + + private int normalIcon; + + private int activeIcon; + + private ComponentContainer rootLayout; + + private AbilitySlice slice; + + /** + * Constructor + * + * @param id tab view id + * @param name tab view name + * @param normalIcon normalIcon + * @param activeIcon activeIcon + * @param slice tab view slice + */ + public AbstractTabView(int id, String name, int normalIcon, int activeIcon, AbilitySlice slice) { + super(); + this.id = id; + this.name = name; + this.normalIcon = normalIcon; + this.activeIcon = activeIcon; + this.slice = slice; + + initRootLayout(); + initTabView(); + } + + private void initRootLayout() { + rootLayout = new DirectionalLayout(slice); + rootLayout.setWidth(LayoutConfig.MATCH_PARENT); + rootLayout.setHeight(LayoutConfig.MATCH_CONTENT); + } + + /** + * Init tab view components + */ + public abstract void initTabView(); + + /** + * tab content on init + */ + public void onSelected() { + return; + } + + /** + * Get ability slice + * + * @return ability slice + */ + protected final AbilitySlice getAbilitySlice() { + return slice; + } + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public ComponentContainer getRootLayout() { + return rootLayout; + } + + public int getNormalIcon() { + return normalIcon; + } + + public int getActiveIcon() { + return activeIcon; + } + + public void setRootLayout(ComponentContainer rootLayout) { + this.rootLayout = rootLayout; + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/HomeLayoutManager.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/HomeLayoutManager.java new file mode 100644 index 0000000000000000000000000000000000000000..0bb5e08c3b556a9f5bdc041024d9e5609e035fc1 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/HomeLayoutManager.java @@ -0,0 +1,182 @@ +/* + * 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 com.huawei.cookbooks.view; + +import com.huawei.cookbooks.ResourceTable; +import com.huawei.cookbooks.util.CommonUtils; +import com.huawei.cookbooks.util.LogUtils; + +import ohos.aafwk.ability.AbilitySlice; +import ohos.agp.components.Component; +import ohos.agp.components.ComponentContainer; +import ohos.agp.components.DependentLayout; +import ohos.agp.components.LayoutScatter; +import ohos.agp.components.ScrollView; +import ohos.agp.components.TabList; +import ohos.agp.utils.TextAlignment; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Home Tab View + * + * @since 2020-12-07 + */ +public class HomeLayoutManager { + private static final String TAG = HomeLayoutManager.class.getSimpleName(); + private static final int HOME_TAB_ID = 1; + private static final int OTHER_TAB_ID = 2; + private static final int TABBAR_TEXT_SIZE = 30 * 3; + private static final int TABBAR_TOP_PADDING = 8 * 3; + private AbilitySlice slice; + private Map tabViews; + private List tabViewList; + private TabList.Tab defaultSelectedTab; + + /** + * constructor of HomeLayoutManager + * + * @param slice AbilitySlice + */ + public HomeLayoutManager(AbilitySlice slice) { + this.slice = slice; + initFrameLayoutView(); + } + + /** + * Init framelayout view + */ + private void initFrameLayoutView() { + tabViews = new HashMap<>(0); + tabViewList = new ArrayList<>(0); + AbstractTabView othersTabView = + new OtherTabView( + OTHER_TAB_ID, "他人数据", ResourceTable.Media_recommend, ResourceTable.Media_recommend, slice); + tabViews.put(othersTabView.getId(), othersTabView); + tabViewList.add(othersTabView); + + AbstractTabView selfTabView = + new HomeTabView(HOME_TAB_ID, "健康数据", ResourceTable.Media_ranking, ResourceTable.Media_ranking, slice); + tabViews.put(selfTabView.getId(), selfTabView); + tabViewList.add(selfTabView); + } + + /** + * Init home layout + * + * @return layout + */ + public ComponentContainer initSliceLayout() { + Component tempView = LayoutScatter.getInstance(slice).parse(ResourceTable.Layout_root, null, false); + if (!(tempView instanceof DependentLayout)) { + LogUtils.info(TAG, "load root layout view failed"); + return new DependentLayout(slice); + } + LogUtils.info(getClass().getName(), "load layout xml success"); + DependentLayout rootLayout = (DependentLayout) tempView; + addTabPage(rootLayout); + addTabBar(rootLayout); + return rootLayout; + } + + /** + * Add bottom navigation bar + * + * @param rootLayout DependentLayout + */ + private void addTabBar(DependentLayout rootLayout) { + Component tabView = rootLayout.findComponentById(ResourceTable.Id_footer_tab); + if (tabView == null) { + LogUtils.info(TAG, "cannot find footer tab view"); + return; + } + if (!(tabView instanceof TabList)) { + LogUtils.info(TAG, "footer_tab is not TabList"); + return; + } + TabList tabBars = (TabList) tabView; + tabBars.setFixedMode(true); + tabBars.setTabTextSize(TABBAR_TEXT_SIZE); + tabBars.setTabTextAlignment(TextAlignment.CENTER); + tabBars.setSelectedTabIndicatorHeight(0); + tabBars.setPadding(0, TABBAR_TOP_PADDING, 0, 0); + tabBars.setTabTextColors( + CommonUtils.getColor(slice.getContext(), ResourceTable.Color_text_off), + CommonUtils.getColor(slice.getContext(), ResourceTable.Color_text_on)); + tabViewList.forEach( + item -> { + TabList.Tab tab = tabBars.new Tab(slice); + tab.setId(item.getId()); + tab.setText(item.getName()); + tab.setTextAlignment(TextAlignment.CENTER); + tabBars.addTab(tab); + defaultSelectedTab = tab; + LogUtils.info(TAG, "add tab view: " + item); + }); + tabBars.addTabSelectedListener(new SelectedTabListener()); + tabBars.selectTab(defaultSelectedTab); + } + + /** + * Add page + * + * @param rootLayout DependentLayout + */ + private void addTabPage(DependentLayout rootLayout) { + Component tabPage = rootLayout.findComponentById(ResourceTable.Id_page); + if (!(tabPage instanceof ScrollView)) { + LogUtils.info(TAG, "cannot find page tab view"); + return; + } + tabViewList.forEach( + item -> { + item.getRootLayout().setVisibility(Component.INVISIBLE); + ((ScrollView) tabPage).addComponent(item.getRootLayout()); + }); + } + + /** + * Selected Tab Listener + * + * @since 2020-12-07 + */ + private class SelectedTabListener implements TabList.TabSelectedListener { + @Override + public void onSelected(TabList.Tab tab) { + LogUtils.info(TAG, "Select tab " + tab.getId()); + int id = tab.getId(); + AbstractTabView selected = tabViews.get(id); + selected.onSelected(); + selected.getRootLayout().setVisibility(Component.VISIBLE); + } + + @Override + public void onUnselected(TabList.Tab tab) { + LogUtils.info(TAG, " onTabUnselected"); + int id = tab.getId(); + AbstractTabView unSelected = tabViews.get(id); + unSelected.getRootLayout().setVisibility(Component.INVISIBLE); + } + + @Override + public void onReselected(TabList.Tab tab) { + LogUtils.info(TAG, "onTabReselected: " + tab.getText()); + } + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/HomeTabView.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/HomeTabView.java new file mode 100644 index 0000000000000000000000000000000000000000..0ab485b0e524dc45e60a3eae970974067b6773d8 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/HomeTabView.java @@ -0,0 +1,45 @@ +/* + * 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 com.huawei.cookbooks.view; + +import com.huawei.cookbooks.ResourceTable; + +import ohos.aafwk.ability.AbilitySlice; +import ohos.agp.components.Component; +import ohos.agp.components.ComponentContainer; +import ohos.agp.components.LayoutScatter; + +/** + * Home Tab View + * + * @since 2020-12-07 + * + */ +public class HomeTabView extends AbstractTabView { + public HomeTabView(int id, String name, int normalIcon, int activeIcon, AbilitySlice slice) { + super(id, name, normalIcon, activeIcon, slice); + } + + @Override + public void initTabView() { + Component rootView = + LayoutScatter.getInstance(getAbilitySlice()).parse(ResourceTable.Layout_ability_main, null, false); + if (!(rootView instanceof ComponentContainer)) { + return; + } + setRootLayout((ComponentContainer) rootView); + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/OtherTabView.java b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/OtherTabView.java new file mode 100644 index 0000000000000000000000000000000000000000..5a2952f30e3e4e1d1beacc916c509fcf9382892b --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/java/com/huawei/cookbooks/view/OtherTabView.java @@ -0,0 +1,54 @@ +/* + * 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 com.huawei.cookbooks.view; + +import com.huawei.cookbooks.ResourceTable; + +import ohos.aafwk.ability.AbilitySlice; +import ohos.agp.components.Component; +import ohos.agp.components.ComponentContainer; +import ohos.agp.components.LayoutScatter; + +/** + * UserTabView + * + * @since 2020-12-07 + * + */ +public class OtherTabView extends AbstractTabView { + /** + * Constructor + * + * @param id tab view id + * @param name tab view name + * @param normalIcon normalIcon + * @param activeIcon activeIcon + * @param slice tab view slice + */ + public OtherTabView(int id, String name, int normalIcon, int activeIcon, AbilitySlice slice) { + super(id, name, normalIcon, activeIcon, slice); + } + + @Override + public void initTabView() { + Component rootView = + LayoutScatter.getInstance(getAbilitySlice()).parse(ResourceTable.Layout_tablist_layout, null, false); + if (!(rootView instanceof ComponentContainer)) { + return; + } + setRootLayout((ComponentContainer) rootView); + } +} diff --git a/DistributedHealthDemoPhone/entry/src/main/resources/base/element/color.json b/DistributedHealthDemoPhone/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..dac2748c64e8fd73bc340a2f79eb92f69dec537b --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/resources/base/element/color.json @@ -0,0 +1,13 @@ +{ + "color": [ + + { + "name": "text_on", + "value": "#4169E1" + }, + { + "name": "text_off", + "value": "#708090" + } + ] +} diff --git a/DistributedHealthDemoPhone/entry/src/main/resources/base/element/string.json b/DistributedHealthDemoPhone/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b848de32bf64cdde2c89c7d3df906ce77de1cc17 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "app_name", + "value": "HealthDemo" + }, + { + "name": "mainability_description", + "value": "Java_Phone_Empty Feature Ability" + }, + { + "name": "serviceability_description", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/circle_element.xml b/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/circle_element.xml new file mode 100644 index 0000000000000000000000000000000000000000..365f6c355c7209c107d0f47e09f6ea8da9b3361b --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/circle_element.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/range.xml b/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/range.xml new file mode 100644 index 0000000000000000000000000000000000000000..d613fc5673e2b3c2ab8e343b0b29f3704b3efee0 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/range.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/rate.xml b/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/rate.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b01ac2b1b44863c047cbfa9ddc9ef07b5af5e24 --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/rate.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/step.xml b/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/step.xml new file mode 100644 index 0000000000000000000000000000000000000000..bda72274764823015d8e624cba65e3187debe84a --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/resources/base/graphic/step.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/DistributedHealthDemoPhone/entry/src/main/resources/base/layout/ability_main.xml b/DistributedHealthDemoPhone/entry/src/main/resources/base/layout/ability_main.xml new file mode 100644 index 0000000000000000000000000000000000000000..cc39782bd85ce6ce2ec68ead7332d509fab61f5e --- /dev/null +++ b/DistributedHealthDemoPhone/entry/src/main/resources/base/layout/ability_main.xml @@ -0,0 +1,246 @@ + + + + +